Documentation
¶
Index ¶
- func GetCanUpdateNotChangeableParams(logger logr.Logger) bool
- type Account
- type ChangedParamItemValue
- type ClassInfo
- type ClusterManagerInfo
- type ClusterStatus
- type CmWorkMode
- type CopyType
- type DbClusterBase
- func (dbCluster *DbClusterBase) DeleteCm(ctx context.Context) error
- func (dbCluster *DbClusterBase) DisableHA(ctx context.Context) error
- func (dbCluster *DbClusterBase) EnableHA(ctx context.Context) error
- func (dbCluster *DbClusterBase) EnsureCmAffinity(ctx context.Context, rwHostName string) error
- func (dbCluster *DbClusterBase) FlushParams(ins *DbIns, ctx context.Context) error
- func (dbCluster *DbClusterBase) GetClusterResourceName() string
- func (dbCluster *DbClusterBase) GetEffectiveParams(inoperative bool, canUpdateNotChangeableParams bool) (paramItems map[string]string, changed bool, needRestart bool, err error)
- func (dbCluster *DbClusterBase) GetEffectiveUserParams(resetClassChangeableValue bool, canUpdateNotChangeableParams bool) (map[string]*EffectiveUserParamValue, bool, bool, error)
- func (dbCluster *DbClusterBase) GetRunningParams() (map[string]*ParamItem, error)
- func (dbCluster *DbClusterBase) GetUserParams() (map[string]*ParamItem, string, error)
- func (dbCluster *DbClusterBase) Init(paramsTemplateQuery IEngineParamsTemplateQuery, ...)
- func (dbCluster *DbClusterBase) InitAccount() error
- func (dbCluster *DbClusterBase) InitClass() error
- func (dbCluster *DbClusterBase) InitEngineParams() error
- func (dbCluster *DbClusterBase) InitVersion() (err error)
- func (dbCluster *DbClusterBase) ModifyClassParams() error
- func (dbCluster *DbClusterBase) SaveLatestFlushTime() error
- func (dbCluster *DbClusterBase) UpgradeCmVersion(ctx context.Context, cmImage string) error
- type DbClusterType
- type DbIns
- func (ins *DbIns) CreateAccount(ctx context.Context) error
- func (ins *DbIns) CreatePod(ctx context.Context) error
- func (ins *DbIns) CreateReplicationSlot(ctx context.Context, roResourceName string) error
- func (ins *DbIns) DeletePod(ctx context.Context) error
- func (ins *DbIns) DoHealthCheck(ctx context.Context) error
- func (ins *DbIns) DoHealthCheckWithTimeout(ctx context.Context, timeout time.Duration) error
- func (ins *DbIns) EnsureInsTypeMeta(ctx context.Context, insType string) error
- func (ins *DbIns) FlushParams(ctx context.Context, paramItems map[string]string, restart bool) error
- func (ins *DbIns) GetPrimarySystemIdentifier(ctx context.Context) (string, error)
- func (ins *DbIns) GracefulStopEngine(ctx context.Context) error
- func (ins *DbIns) GrowStorage(ctx context.Context) error
- func (ins *DbIns) Init(managerClient IManagerClient, podManager IEnginePodManager)
- func (ins *DbIns) InstallDbIns(ctx context.Context) error
- func (ins *DbIns) Restart(ctx context.Context) error
- func (ins *DbIns) SetDbInsInstalled() error
- func (ins *DbIns) SetupLogAgent(ctx context.Context) error
- func (ins *DbIns) StartEngine(ctx context.Context) error
- func (ins *DbIns) StopEngineAndDeletePod(ctx context.Context, ignoreStopError bool) error
- func (ins *DbIns) WaitForInstallReady(ctx context.Context) error
- type DbInsId
- type EffectiveUserParamValue
- type EngineClass
- type EngineClasses
- type EngineState
- type EngineStatus
- type EngineType
- type HealthCheckError
- type HealthErrorEnum
- type HostCluster
- type IAccountRepository
- type IClassQuery
- type IClusterManagerClient
- type IClusterManagerCreator
- type IClusterManagerRemover
- type IEngineParamsClassQuery
- type IEngineParamsRepository
- type IEngineParamsTemplateQuery
- type IEnginePodManager
- type IHostClusterQuery
- type IIdGenerator
- type IManagerClient
- type IMinorVersionQuery
- type IPfsdToolClient
- type IPortGenerator
- type IStorageManager
- type ImageInfo
- type InsStatus
- type InstanceResource
- type MinorVersion
- type MinorVersions
- type NetInfo
- type OnPfsdContainerReady
- type ParamItem
- type ParamTemplateItem
- type ParamsTemplate
- type SharedStorageDbClusterBase
- func (dbCluster *SharedStorageDbClusterBase) Init(paramsTemplateQuery IEngineParamsTemplateQuery, ...)
- func (dbCluster *SharedStorageDbClusterBase) ReleaseStorage(ctx context.Context) error
- func (dbCluster *SharedStorageDbClusterBase) SetStorageWriteLock(ctx context.Context, nodeId string) error
- func (dbCluster *SharedStorageDbClusterBase) UseStorage(ctx context.Context, format bool) error
- type StorageInfo
- type StorageTopo
- type StorageTopoNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct {
Account string `json:"account"`
Password string `json:"password"`
PrivilegedType int `json:"priviledge_type"`
}
type ChangedParamItemValue ¶
type ClusterManagerInfo ¶
type ClusterStatus ¶
type DbClusterBase ¶
type DbClusterBase struct {
Name string
Namespace string
Description string
LogicInsId string
ClusterStatus string
ClusterManager *ClusterManagerInfo
ImageInfo *ImageInfo
ClassInfo *ClassInfo
Resources map[string]*InstanceResource
DbClusterType DbClusterType
Interrupt bool
InterruptMsg string
InterruptReason string
EngineType EngineType
ResourceVersion string
PrimarySystemIdentifier string
UseModifyClass bool
UseUpgradeImageInfo bool
OldClassInfo *ClassInfo
OldImageInfo *ImageInfo
ParamsTemplateQuery IEngineParamsTemplateQuery
ParamsClassQuery IEngineParamsClassQuery
EngineParamsRepo IEngineParamsRepository
MinorVersionQuery IMinorVersionQuery
AccountRepo IAccountRepository
HostClusterQuery IHostClusterQuery
IdGenerator IIdGenerator
PortGenerator IPortGenerator
ClassQuery IClassQuery
ClusterManagerClient IClusterManagerClient
ClusterManagerRemover IClusterManagerRemover
Logger logr.Logger
// contains filtered or unexported fields
}
DB集群基类
func (*DbClusterBase) DeleteCm ¶
func (dbCluster *DbClusterBase) DeleteCm(ctx context.Context) error
*
- @Description: 删除DB集群对应的ClusterManager及其元数据
- @receiver dbCluster
- @return error
func (*DbClusterBase) DisableHA ¶
func (dbCluster *DbClusterBase) DisableHA(ctx context.Context) error
*
- @Description: 禁用HA
- @receiver dbCluster
- @return error
func (*DbClusterBase) EnableHA ¶
func (dbCluster *DbClusterBase) EnableHA(ctx context.Context) error
*
- @Description: 启用HA
- @receiver dbCluster
- @return error
func (*DbClusterBase) EnsureCmAffinity ¶
func (dbCluster *DbClusterBase) EnsureCmAffinity(ctx context.Context, rwHostName string) error
func (*DbClusterBase) FlushParams ¶
func (dbCluster *DbClusterBase) FlushParams(ins *DbIns, ctx context.Context) error
*
- @Description: 执行刷参
- @receiver ins
- @return error
func (*DbClusterBase) GetClusterResourceName ¶
func (dbCluster *DbClusterBase) GetClusterResourceName() string
func (*DbClusterBase) GetEffectiveParams ¶
func (dbCluster *DbClusterBase) GetEffectiveParams(inoperative bool, canUpdateNotChangeableParams bool) (paramItems map[string]string, changed bool, needRestart bool, err error)
*
- @Description: 获得最终生效的参数,创建实例和刷参场景,参数合并规则参考 https://yuque.antfin.com/pg-hdb-dev/polardb-o-machine/vozb6o
- @receiver dbCluster
- @param inoperative 是否使未生效值生效
- @param canUpdateNotChangeableParams 是否可以更改不可变参数
- @return paramItems 最终生效参数
- @return changed 参数是否有变更
- @return needRestart 是否需要重启
- @return err
func (*DbClusterBase) GetEffectiveUserParams ¶
func (dbCluster *DbClusterBase) GetEffectiveUserParams(resetClassChangeableValue bool, canUpdateNotChangeableParams bool) (map[string]*EffectiveUserParamValue, bool, bool, error)
当变配时,UserParams要和RunningParams一致,否则管控无法判断以谁为准,要做前置校验。 resetClassChangeableValue 如果前端提示用户规格参数和用户设置的有冲突,console负责把用户解决的冲突写回UserParams,这里设置为false 变配执行时,当前UserParams要合并参数模板中不可变部分和规格默认参数
func (*DbClusterBase) GetRunningParams ¶
func (dbCluster *DbClusterBase) GetRunningParams() (map[string]*ParamItem, error)
获取运行中的参数值
func (*DbClusterBase) GetUserParams ¶
func (dbCluster *DbClusterBase) GetUserParams() (map[string]*ParamItem, string, error)
获取用户设置的参数值
func (*DbClusterBase) Init ¶
func (dbCluster *DbClusterBase) Init( paramsTemplateQuery IEngineParamsTemplateQuery, paramsClassQuery IEngineParamsClassQuery, paramsRepo IEngineParamsRepository, minorVersionQuery IMinorVersionQuery, accountRepo IAccountRepository, idGenerator IIdGenerator, portGenerator IPortGenerator, classQuery IClassQuery, clusterManagerClient IClusterManagerClient, hostClusterQuery IHostClusterQuery, clusterManagerRemover IClusterManagerRemover, logger logr.Logger, )
func (*DbClusterBase) InitAccount ¶
func (dbCluster *DbClusterBase) InitAccount() error
*
- @Description: 初始化账户元数据
- @receiver dbCluster
- @return error
func (*DbClusterBase) InitClass ¶
func (dbCluster *DbClusterBase) InitClass() error
*
- @Description: 初始化规格元数据
- @receiver dbCluster
- @return error
func (*DbClusterBase) InitEngineParams ¶
func (dbCluster *DbClusterBase) InitEngineParams() error
*
- @Description: 初始化引擎参数
- @receiver dbCluster
- @return error
func (*DbClusterBase) InitVersion ¶
func (dbCluster *DbClusterBase) InitVersion() (err error)
*
- @Description: 初始化版本元数据
- @receiver dm
- @return error
func (*DbClusterBase) ModifyClassParams ¶
func (dbCluster *DbClusterBase) ModifyClassParams() error
*
- @Description: 变配时应用新规格参数,或者参数模板不可变参数默认值更新后应用新默认值
- @receiver dbCluster
- @return error
func (*DbClusterBase) SaveLatestFlushTime ¶
func (dbCluster *DbClusterBase) SaveLatestFlushTime() error
*
- @Description: 保存最后刷参成功时间
- @receiver dbCluster
- @return error
func (*DbClusterBase) UpgradeCmVersion ¶
func (dbCluster *DbClusterBase) UpgradeCmVersion(ctx context.Context, cmImage string) error
type DbClusterType ¶
type DbClusterType string
const ( DbClusterTypeStandby DbClusterType = "Standby" DbClusterTypeDataMax DbClusterType = "Datamax" DbClusterTypeMaster DbClusterType = "Master" )
type DbIns ¶
type DbIns struct {
DbInsId
ResourceName string
ResourceNamespace string
Host string
HostIP string
ClientIP string
NetInfo *NetInfo // 网络信息
EngineState *EngineStatus // 实例状态
Installed bool // 是否已经安装完成
StorageHostId string // pfs每个节点需要一个ID
TargetNode string // 指定调度节点
ExcludedNodes []string // 排除的节点
ManagerClient IManagerClient
PodManager IEnginePodManager
// contains filtered or unexported fields
}
func (*DbIns) EnsureInsTypeMeta ¶
func (*DbIns) FlushParams ¶
func (ins *DbIns) FlushParams(ctx context.Context, paramItems map[string]string, restart bool) error
*
- @Description: 执行刷参
- @receiver ins
- @return error
func (*DbIns) Init ¶
func (ins *DbIns) Init(managerClient IManagerClient, podManager IEnginePodManager)
type EffectiveUserParamValue ¶
type EngineClass ¶
type EngineClass struct {
Name string
ClassKey string
CpuRequest *resource.Quantity
CpuLimit *resource.Quantity
MemoryRequest *resource.Quantity
MemoryLimit *resource.Quantity
HugePageLimit *resource.Quantity
MemoryShow *resource.Quantity
StorageMin *resource.Quantity
StorageMax *resource.Quantity
Resource map[string]*InstanceResource
}
type EngineClasses ¶
type EngineClasses struct {
EngineType EngineType
// contains filtered or unexported fields
}
func NewEngineClasses ¶
func NewEngineClasses(engineType EngineType, classQuery IClassQuery) (result *EngineClasses, err error)
func (*EngineClasses) GetClass ¶
func (c *EngineClasses) GetClass(classKey string) (item *EngineClass, err error)
func (*EngineClasses) GetClassList ¶
func (c *EngineClasses) GetClassList() (list []*EngineClass, err error)
type EngineStatus ¶
type EngineStatus struct {
CurrentState EngineState
LastState EngineState
}
type EngineType ¶
type EngineType string
const ( EngineTypeSingle EngineType = "Single" EngineTypeRwo EngineType = "Rwo" EngineTypeDataMax EngineType = "standbyDataMax" EngineTypeStandby EngineType = "Standby" )
type HealthCheckError ¶
type HealthCheckError struct {
Name HealthErrorEnum
Error error // 错误
Reason string // 出错原因
}
func CreateHealthError ¶
func CreateHealthError(name HealthErrorEnum, reason string, err error) *HealthCheckError
type HealthErrorEnum ¶
type HealthErrorEnum string
const ( HealthErrorStartingUp HealthErrorEnum = "StartingUp" HealthErrorContainerNotFound HealthErrorEnum = "ContainerNotFound" HealthErrorUnKnown HealthErrorEnum = "Unknown" )
type HostCluster ¶
type IAccountRepository ¶
type IAccountRepository interface {
/**
* @Description: 保存账户元数据
* @param engine
* @param account
* @return error
*/
EnsureAccountMeta(cluster *DbClusterBase, account *Account) error
/**
* @Description: 获取账户元数据
* @param clusterName
* @param namespace
* @return accounts
* @return error
*/
GetAccounts(clusterName, namespace string) (accounts map[string]*Account, err error)
}
*
- @Description: 引擎内置账户元数据持久化
type IClassQuery ¶
type IClassQuery interface {
/**
* @Description: 获取所有规格清单
* @param engineType 引擎类型
* @param classKey 规格名称,如果为空则获取所有规格,不为空则获取指定规格
* @return classList
* @return err
*/
GetClasses(engineType EngineType, classKey string) (classList []*EngineClass, err error)
}
*
- @Description: 规格元数据查询
type IClusterManagerClient ¶
type IClusterManagerClient interface {
/**
* @Description: 设置跨域主集群
* @param ctx
* @return error
*/
SetLeader(ctx context.Context) error
/**
* @Description: 取消跨域主集群
* @param ctx
* @return error
*/
SetFollower(ctx context.Context) error
/**
* @Description: 初始化
* @param ctx
* @param dbClusterNamespace
* @param dbClusterName
* @param waitCmReady
* @return error
*/
InitWithLocalDbCluster(ctx context.Context, dbClusterNamespace, dbClusterName string, waitCmReady bool) error
/**
* @Description: 添加DataMax节点
* @param ctx
* @param id
* @param ip
* @param podName
* @param port
* @return error
*/
AddDataMax(ctx context.Context, id, ip, podName string, port int) error
/**
* @Description: 更新DataMax节点
* @param ctx
* @param id
* @param ip
* @param podName
* @param port
* @return error
*/
UpdateDataMax(ctx context.Context, id, ip, podName string, port int) error
/**
* @Description: 删除DataMax节点
* @param ctx
* @param id
* @return error
*/
DeleteDataMax(ctx context.Context, id string) error
/**
* @Description: 添加集群节点
* @param ctx
* @param id
* @param ip
* @param port
* @param isClientIP
* @return error
*/
AddCluster(ctx context.Context, id, ip string, port int, isClientIP bool) error
/**
* @Description: 更新集群节点
* @param ctx
* @param id
* @param ip
* @param port
* @param isClientIP
* @return error
*/
UpdateCluster(ctx context.Context, id, ip string, port int, isClientIP bool) error
/**
* @Description: 删除集群节点
* @param ctx
* @param id
* @return error
*/
DeleteCluster(ctx context.Context, id string) error
/**
* @Description: 创建拓扑关系
* @param ctx
* @param upStreamId 上游节点ID
* @param downStreamId 下游节点ID
* @param copyType 复制关系类型
* @return error
*/
AddTopologyEdge(ctx context.Context, upStreamId, downStreamId string, copyType CopyType) error
/**
* @Description: 删除拓扑关系
* @param ctx
* @param upStreamId 上游节点ID
* @param downStreamId 下游节点ID
* @return error
*/
DeleteTopologyEdge(ctx context.Context, upStreamId, downStreamId string) error
/**
* @Description: 设置standby订阅DataMax
* @param ctx
* @param id 集群ID
* @param ip 上游 client IP
* @param port 上游 端口
* @param copyType 复制关系类型
* @param upStreamId 上游ID
* @return error
*/
DemoteStandby(ctx context.Context, id, ip string, port int, copyType CopyType, upStreamId string) error
/**
* @Description: standby promote
* @param ctx
* @return error
*/
PromoteStandby(ctx context.Context) error
/**
* @Description: 禁用HA
* @param ctx
* @return error
*/
DisableHA(ctx context.Context) error
/**
* @Description: 启用HA
* @param ctx
* @return error
*/
EnableHA(ctx context.Context) error
/**
* @Description: 添加实例
* @param ctx
* @param id
* @param ip
* @param port
* @return error
*/
AddIns(ctx context.Context, id, ip, role, sync, hostName string, port int, isClientIP bool) error
/**
* @Description: 删除实例
* @param ctx
* @param id
* @param ip
* @param port
* @return error
*/
RemoveIns(ctx context.Context, id, ip, role, sync, hostName string, port int, isClientIP bool) error
/**
* @Description: 读写切换
* @param ctx
* @param oriRwIp
* @param oriRoIp
* @param port
* @return error
*/
Switchover(ctx context.Context, oriRwIp, oriRoIp, port string, isClientIP bool) error
/**
* @Description: 获取集群状态
* @param ctx
* @return error
*/
GetClusterStatus(ctx context.Context) (*ClusterStatus, error)
EnsureAffinity(ctx context.Context, clusterNamespace, clusterName, rwHostName string) error
UpgradeVersion(ctx context.Context, clusterNamespace, clusterName, image string) error
}
*
- @Description: Cluster Manager Client
type IClusterManagerCreator ¶
type IClusterManagerCreator interface {
/**
* @Description: 创建ClusterManager
* @param ctx
* @param kubeObj dbcluster/standby k8s对象
* @param logicInsId
* @param rwPhyId
* @param cmImage
* @param port
* @return error
*/
CreateClusterManager(ctx context.Context, kubeObj metav1.Object, workMode CmWorkMode, logicInsId, rwPhyId, cmImage string, port int, pluginConf map[string]interface{}, consensusPort int) error
}
*
- @Description: Cluster Manager Creator
type IClusterManagerRemover ¶
type IClusterManagerRemover interface {
/**
* @Description: 删除ClusterManager
* @return error
*/
Remove(dbClusterName, dbClusterNamespace string, ctx context.Context) error
}
*
- @Description: Cluster Manager Remover
type IEngineParamsClassQuery ¶
type IEngineParamsClassQuery interface {
/**
* @Description: 获得某规格特定内核参数
* @param engineType 引擎类型
* @param classKey 规格名称
* @return params 规格特定参数
* @return err
*/
GetClassParams(engineType EngineType, classKey string) (params map[string]string, err error)
}
*
- @Description: 规格参数元数据查询
type IEngineParamsRepository ¶
type IEngineParamsRepository interface {
/**
* @Description: 保存用户设置的参数
* @param engine
* @param initParams
* @return error
*/
SaveUserParams(engine *DbClusterBase, initParams map[string]string) error
/**
* @Description: 获取用户设置的参数
* @param engine
* @return map[string]string
* @return string 最后一次成功刷参的时间
* @return error
*/
GetUserParams(engine *DbClusterBase) (map[string]*ParamItem, string, error)
/**
* @Description: 保存生效参数,初始化时使用,后面由cm更新
* @param engine
* @param initParams
* @return error
*/
SaveRunningParams(engine *DbClusterBase, initParams map[string]string) error
/**
* @Description: 获取运行中的参数
* @param engine
* @return map[string]string
* @return error
*/
GetRunningParams(engine *DbClusterBase) (map[string]*ParamItem, error)
/**
* @Description: 保存最后刷参成功时间
* @param dbClusterName
* @return map[string]string
* @return error
*/
SaveLatestFlushTime(engine *DbClusterBase) error
/**
* @Description: 更新UserParam
* @param dbClusterName
* @return map[string]string
* @return error
*/
UpdateUserParams(engine *DbClusterBase, userParams map[string]*EffectiveUserParamValue) error
}
*
- @Description: 引擎参数元数据
type IEngineParamsTemplateQuery ¶
type IEngineParamsTemplateQuery interface {
/**
* @Description: 获取参数模板
* @param engineType 引擎类型
* @return params 参数模板
* @return err
*/
GetTemplateParams(engineType EngineType) (params []*ParamTemplateItem, err error)
}
*
- @Description: 参数模板元数据查询
type IEnginePodManager ¶
type IEnginePodManager interface {
/**
* @Description: 初始化
* @param domainModel datamax领域模型
*/
Init(domainModel interface{})
/**
* @Description: 设置对应的实例
* @param ins 因为一个DB集群会可能包含多个实例,这里指定操作哪个实例
*/
SetIns(ins *DbIns)
/**
* @Description: 创建Pod并等待Pod就绪
* @param resourceName pod名称
* @param ctx
* @return error
*/
CreatePodAndWaitReady(ctx context.Context) error
/**
* @Description: 删除Pod
* @param resourceName pod名称
* @param ctx
* @return error
*/
DeletePod(ctx context.Context) error
/**
* @Description: pod是否已经被删除
* @param ctx
* @return error
*/
IsDeleted(ctx context.Context) (bool, error)
/**
* @Description: 确保pod的读写类型正确
* @param ctx
* @param insType
* @return error
*/
EnsureInsTypeMeta(ctx context.Context, insType string) error
}
*
- @Description: DataMax容器管理
type IHostClusterQuery ¶
type IHostClusterQuery interface {
/**
* @Description: 获得所有HostCluster
* @return []*domain.HostCluster
* @return error
*/
GetAllHostCluster() ([]*HostCluster, error)
/**
* @Description: 根据名称获取某个HostCluster
* @param name
* @return *domain.HostCluster
* @return error
*/
GetHostCluster(name string) (*HostCluster, error)
/**
* @Description: 获得本地HostCluster信息
* @param name
* @return *domain.HostCluster
* @return error
*/
GetLocalHostCluster() (*HostCluster, error)
}
*
- @Description: HostCluster元数据查询
type IIdGenerator ¶
type IIdGenerator interface {
/**
* @Description: 获得下一批实例ID
* @param n 获得几个ID
* @return []int
* @return error
*/
GetNextClusterScopeHostInsIds(n int) ([]int, error)
}
*
- @Description: 实例ID生成器
type IManagerClient ¶
type IManagerClient interface {
/**
* @Description: 初始化ManagerClient
* @param ctx
* @param domainModel 资源对应的领域模型
*/
Init(domainModel interface{})
/**
* @Description: 设置ManagerClient对应的实例
* @param ins 因为一个DB集群会可能包含多个实例,这里指定操作哪个实例
* @return error
*/
SetIns(ins *DbIns) error
/**
* @Description: 安装引擎
* @param ctx
* @return error
*/
InstallEngine(ctx context.Context) error
/**
* @Description: 创建UE所需元数据
* @param ctx
* @return error
*/
SetupLogAgent(ctx context.Context) error
/**
* @Description: 启动引擎
* @param ctx
* @return error
*/
StartEngine(ctx context.Context) error
/**
* @Description: 安全停止引擎
* @param ctx
* @return error
*/
GracefulStopEngine(ctx context.Context) error
/**
* @Description: 重启引擎
* @param ctx
* @return error
*/
RestartEngine(ctx context.Context) error
/**
* @Description: 锁定引擎
* @param ctx
* @return error
*/
LockEngine(ctx context.Context) error
/**
* @Description: 创建账户
* @param ctx
* @return error
*/
CreateEngineAccount(ctx context.Context) error
/**
* @Description: 更新引擎参数
* @param ctx
* @return error
*/
UpdateEngineParams(ctx context.Context, engineParams map[string]string) error
/**
* @Description: 存储扩容
* @param ctx
* @return error
*/
GrowStorage(ctx context.Context) error
/**
* @Description: 健康检查
* @param ctx
* @return error
*/
CheckHealth(ctx context.Context) (err *HealthCheckError)
/**
* @Description: 强制停止引擎
* @param ctx
* @return error
*/
ForceStopEngine(ctx context.Context) error
/**
* @Description: 获取PrimarySystemIdentifier
* @param ctx
* @return error
*/
GetPrimarySystemIdentifier(ctx context.Context) (string, error)
/**
* @Description: 创建slot
* @param ctx
* @return error
*/
CreateReplicationSlot(ctx context.Context, roResourceName string) error
/**
* @Description: 异步install是否执行成功
* @receiver m
* @return err
*/
CheckInstallIsReady(ctx context.Context) (bool, error)
}
*
- @Description: Manager客户端
type IMinorVersionQuery ¶
type IMinorVersionQuery interface {
/**
* @Description: 获取所有内核小版本信息
* @param engineType 引擎类型
* @return latestVersion 最新版本
* @return versionList 内核小版本列表
* @return err
*/
GetMinorVersions(engineType EngineType) (latestVersion string, versionList []*MinorVersion, err error)
/**
* @Description: 获得最新的内核小版本信息
* @param engineType
* @return version
* @return err
*/
GetLatestMinorVersion(engineType EngineType) (version *MinorVersion, err error)
/**
* @Description: 获得内核小版本信息
* @param engineType
* @param versionName
* @return version
* @return err
*/
GetMinorVersion(engineType EngineType, versionName string) (version *MinorVersion, err error)
}
*
- @Description: 小版本元数据查询
type IPfsdToolClient ¶
type IPfsdToolClient interface {
/**
* @Description: 初始化Pfsd tool
* @param ins 实例领域模型
* @param resources 给容器分配的资源
* @param volumeId
* @return error
*/
Init(ins *DbIns, resources map[string]*InstanceResource, volumeId string)
/**
* @Description: 启动pfsd
* @return error
*/
StartPfsd(ctx context.Context) error
}
*
- @Description: Pfsd tool客户端
type IPortGenerator ¶
type IPortGenerator interface {
/**
* @Description: 获取一个新端口
* @return int
* @return error
*/
GetNextClusterExternalPort() (int, error)
/**
* @Description: 检测Port是否被占用
* @param port
* @param rangeName
* @return bool
* @return error
*/
CheckPortUsed(port int, rangeName string) (bool, error)
}
*
- @Description: 端口生成器
type IStorageManager ¶
type IStorageManager interface {
/**
* @Description: 初始化
* @param ip
* @param port
* @return error
*/
InitWithAddress(ip, port string) error
/**
* @Description: 使用存储
* @param ctx
* @param name pvc名称
* @param name pvc namespace
* @param volumeId
* @param resourceName 关联资源名称
* @param volumeType
* @param format 是否格式化
* @return error
*/
UseStorage(ctx context.Context, name, namespace, volumeId, resourceName string, volumeType string, format bool) error
/**
* @Description: 设置写锁
* @param ctx
* @param name pvc名称
* @param name pvc namespace
* @param nodeId 写节点ID
* @return *StorageTopo 设置后的读写节点拓扑关系
* @return error
*/
SetWriteLock(ctx context.Context, name, namespace, nodeId string) (*StorageTopo, error)
/**
* @Description: 获取读写节点拓扑关系
* @param ctx
* @param name pvc名称
* @param name pvc namespace
* @return *StorageTopo 最新的读写节点拓扑关系
* @return error
*/
GetTopo(ctx context.Context, name, namespace string) (*StorageTopo, error)
/**
* @Description: 扩容
* @param ctx
* @param name pvc名称
* @param name pvc namespace
* @param volumeId
* @param resourceName 关联资源名称
* @param volumeType
* @param reqSize 扩容后容量
* @return error
*/
Expand(ctx context.Context, name, namespace, volumeId, resourceName string, volumeType int, reqSize int64) error
/**
* @Description: 释放存储
* @param ctx
* @param name pvc名称
* @param name pvc namespace
* @param cluster 防止误释放其它集群使用的存储;为空则不校验存储是否被该集群使用,直接释放
* @return error
*/
Release(ctx context.Context, name, namespace, clusterName string) error
}
type InstanceResource ¶
type MinorVersion ¶
type MinorVersions ¶
type MinorVersions struct {
EngineType EngineType
// contains filtered or unexported fields
}
func NewMinorVersion ¶
func NewMinorVersion(engineType EngineType, repository IMinorVersionQuery) (result *MinorVersions, err error)
func (*MinorVersions) GetLatestMinorVersion ¶
func (v *MinorVersions) GetLatestMinorVersion() (version *MinorVersion, err error)
*
- @Description: 获取最新内核小版本信息
- @receiver v *MinorVersions
- @param engineType
- @return *MinorVersion
func (*MinorVersions) GetMinorVersionList ¶
func (v *MinorVersions) GetMinorVersionList() (list []*MinorVersion, err error)
*
- @Description: 获取内核小版本列表
- @receiver v
- @return list
- @return err
type OnPfsdContainerReady ¶
type OnPfsdContainerReady func() error
type ParamTemplateItem ¶
type ParamTemplateItem struct {
Name string `json:"name"` // 参数名
DefaultValue string `json:"default_value"` // 默认值
IsDynamic int `json:"is_dynamic"` // 是否需要重启
IsVisible int `json:"is_visible"` // 控制台是否可见
IsUserChangeable int `json:"is_user_changable"` // 用户是否可更改
Optional string `json:"optional"` // 正则表达式
Unit string `json:"unit"` //
DivideBase string `json:"divide_base"` //
IsDeleted int `json:"is_deleted"` //
Comment string `json:"comment"` //
}
type ParamsTemplate ¶
type ParamsTemplate struct {
EngineType EngineType
ClassKey string
// contains filtered or unexported fields
}
func NewParamsTemplate ¶
func NewParamsTemplate( engineType EngineType, classKey string, paramsTemplateRepo IEngineParamsTemplateQuery, paramsClassRepo IEngineParamsClassQuery, logger logr.Logger, ) (result *ParamsTemplate, err error)
func (*ParamsTemplate) GetClassInitParams ¶
func (t *ParamsTemplate) GetClassInitParams() map[string]string
*
- @Description: 获得某规格默认参数值
- @receiver t *ParamsTemplate
- @return map[string]string
func (*ParamsTemplate) GetMergedTemplateParams ¶
func (t *ParamsTemplate) GetMergedTemplateParams() []*ParamTemplateItem
*
- @Description: 获得合并了规格默认参数之后的参数模板
- @receiver t *ParamsTemplate
- @return []*ParamTemplateItem
type SharedStorageDbClusterBase ¶
type SharedStorageDbClusterBase struct {
// contains filtered or unexported fields
}
基于共享存储的DB集群基类
func (*SharedStorageDbClusterBase) Init ¶
func (dbCluster *SharedStorageDbClusterBase) Init( paramsTemplateQuery IEngineParamsTemplateQuery, paramsClassQuery IEngineParamsClassQuery, paramsRepo IEngineParamsRepository, minorVersionQuery IMinorVersionQuery, accountRepo IAccountRepository, idGenerator IIdGenerator, portGenerator IPortGenerator, storageManager IStorageManager, classQuery IClassQuery, clusterManagerClient IClusterManagerClient, hostClusterQuery IHostClusterQuery, clusterManagerRemover IClusterManagerRemover, logger logr.Logger, )
func (*SharedStorageDbClusterBase) ReleaseStorage ¶
func (dbCluster *SharedStorageDbClusterBase) ReleaseStorage(ctx context.Context) error
*
- @Description: 释放存储
- @receiver dbCluster
- @return error
func (*SharedStorageDbClusterBase) SetStorageWriteLock ¶
func (dbCluster *SharedStorageDbClusterBase) SetStorageWriteLock(ctx context.Context, nodeId string) error
*
- @Description: 为存储设置写锁
- @receiver dbCluster
- @return error
func (*SharedStorageDbClusterBase) UseStorage ¶
func (dbCluster *SharedStorageDbClusterBase) UseStorage(ctx context.Context, format bool) error
*
- @Description: 使用存储
- @receiver dbCluster
- @return error
type StorageInfo ¶
type StorageTopo ¶
type StorageTopo struct {
ReadNodes []*StorageTopoNode `json:"read_nodes"`
WriteNode *StorageTopoNode `json:"write_node"`
}
type StorageTopoNode ¶
Source Files
¶
- account.go
- db_cluster_base.go
- db_cluster_shared_storage_base.go
- db_ins.go
- engine_class.go
- engine_param.go
- engine_params_template.go
- host_cluster.go
- i_account_repository.go
- i_class_query.go
- i_cluster_manager_client.go
- i_cluster_manager_creator.go
- i_cluster_manager_remover.go
- i_engine_params_class_query.go
- i_engine_params_repository.go
- i_engine_params_template_query.go
- i_engine_pod_manager.go
- i_host_cluster_query.go
- i_id_generator.go
- i_manager_client.go
- i_minor_version_query.go
- i_pfsd_tool_client.go
- i_port_generator.go
- i_storage_manager.go
- minor_version.go
Click to show internal directories.
Click to hide internal directories.