Documentation ¶
Overview ¶
Package dcs is a generated GoMock package.
Index ¶
- func InitStore() error
- func SetStore(d DCS)
- type Cluster
- func (c *Cluster) GetLeaderMember() *Member
- func (c *Cluster) GetMemberAddr(member Member) string
- func (c *Cluster) GetMemberAddrWithPort(member Member) string
- func (c *Cluster) GetMemberAddrs() []string
- func (c *Cluster) GetMemberName() []string
- func (c *Cluster) GetMemberShortAddr(member Member) string
- func (c *Cluster) GetMemberWithHost(host string) *Member
- func (c *Cluster) GetMemberWithName(name string) *Member
- func (c *Cluster) HasMember(memberName string) bool
- func (c *Cluster) IsLocked() bool
- type DBState
- type DCS
- type HaConfig
- func (c *HaConfig) AddMemberToDelete(member *Member)
- func (c *HaConfig) FinishDeleted(member *Member)
- func (c *HaConfig) GetDuplicatedMemberToDelete(member *Member) *MemberToDelete
- func (c *HaConfig) GetMaxLagOnSwitchover() int64
- func (c *HaConfig) GetMemberToDelete(member *Member) *MemberToDelete
- func (c *HaConfig) GetTTL() int
- func (c *HaConfig) IsDeleted(member *Member) bool
- func (c *HaConfig) IsDeleting(member *Member) bool
- func (c *HaConfig) IsEnable() bool
- func (c *HaConfig) SetEnable(enable bool)
- func (c *HaConfig) TryToRemoveDeleteRecord(member *Member) bool
- type KubernetesStore
- func (store *KubernetesStore) AddCurrentMember() error
- func (store *KubernetesStore) AttemptAcquireLease() error
- func (store *KubernetesStore) CreateHaConfig() error
- func (store *KubernetesStore) CreateLease() error
- func (store *KubernetesStore) CreateSwitchover(leader, candidate string) error
- func (store *KubernetesStore) DeleteCluster()
- func (store *KubernetesStore) DeleteLeader() error
- func (store *KubernetesStore) DeleteSwitchover() error
- func (store *KubernetesStore) GetCluster() (*Cluster, error)
- func (store *KubernetesStore) GetClusterFromCache() *Cluster
- func (store *KubernetesStore) GetClusterName() string
- func (store *KubernetesStore) GetHaConfig() (*HaConfig, error)
- func (store *KubernetesStore) GetLeader() (*Leader, error)
- func (store *KubernetesStore) GetLeaderConfigMap() (*corev1.ConfigMap, error)
- func (store *KubernetesStore) GetMembers() ([]Member, error)
- func (store *KubernetesStore) GetSwitchOverConfigMap() (*corev1.ConfigMap, error)
- func (store *KubernetesStore) GetSwitchover() (*Switchover, error)
- func (store *KubernetesStore) HasLease() bool
- func (store *KubernetesStore) Initialize() error
- func (store *KubernetesStore) IsLeaseExist() (bool, error)
- func (store *KubernetesStore) ReleaseLease() error
- func (store *KubernetesStore) ResetCluster()
- func (store *KubernetesStore) SetCompName(componentName string)
- func (store *KubernetesStore) UpdateHaConfig() error
- func (store *KubernetesStore) UpdateLease() error
- type Leader
- type Member
- type MemberToDelete
- type MockDCS
- func (m *MockDCS) AddCurrentMember() error
- func (m *MockDCS) AttemptAcquireLease() error
- func (m *MockDCS) CreateLease() error
- func (m *MockDCS) CreateSwitchover(arg0, arg1 string) error
- func (m *MockDCS) DeleteCluster()
- func (m *MockDCS) DeleteSwitchover() error
- func (m *MockDCS) EXPECT() *MockDCSMockRecorder
- func (m *MockDCS) GetCluster() (*Cluster, error)
- func (m *MockDCS) GetClusterFromCache() *Cluster
- func (m *MockDCS) GetClusterName() string
- func (m *MockDCS) GetHaConfig() (*HaConfig, error)
- func (m *MockDCS) GetLeader() (*Leader, error)
- func (m *MockDCS) GetMembers() ([]Member, error)
- func (m *MockDCS) GetSwitchover() (*Switchover, error)
- func (m *MockDCS) HasLease() bool
- func (m *MockDCS) Initialize() error
- func (m *MockDCS) IsLeaseExist() (bool, error)
- func (m *MockDCS) ReleaseLease() error
- func (m *MockDCS) ResetCluster()
- func (m *MockDCS) UpdateHaConfig() error
- func (m *MockDCS) UpdateLease() error
- type MockDCSMockRecorder
- func (mr *MockDCSMockRecorder) AddCurrentMember() *gomock.Call
- func (mr *MockDCSMockRecorder) AttemptAcquireLease() *gomock.Call
- func (mr *MockDCSMockRecorder) CreateLease() *gomock.Call
- func (mr *MockDCSMockRecorder) CreateSwitchover(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockDCSMockRecorder) DeleteCluster() *gomock.Call
- func (mr *MockDCSMockRecorder) DeleteSwitchover() *gomock.Call
- func (mr *MockDCSMockRecorder) GetCluster() *gomock.Call
- func (mr *MockDCSMockRecorder) GetClusterFromCache() *gomock.Call
- func (mr *MockDCSMockRecorder) GetClusterName() *gomock.Call
- func (mr *MockDCSMockRecorder) GetHaConfig() *gomock.Call
- func (mr *MockDCSMockRecorder) GetLeader() *gomock.Call
- func (mr *MockDCSMockRecorder) GetMembers() *gomock.Call
- func (mr *MockDCSMockRecorder) GetSwitchover() *gomock.Call
- func (mr *MockDCSMockRecorder) HasLease() *gomock.Call
- func (mr *MockDCSMockRecorder) Initialize() *gomock.Call
- func (mr *MockDCSMockRecorder) IsLeaseExist() *gomock.Call
- func (mr *MockDCSMockRecorder) ReleaseLease() *gomock.Call
- func (mr *MockDCSMockRecorder) ResetCluster() *gomock.Call
- func (mr *MockDCSMockRecorder) UpdateHaConfig() *gomock.Call
- func (mr *MockDCSMockRecorder) UpdateLease() *gomock.Call
- type Switchover
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cluster ¶
type Cluster struct { ClusterCompName string Namespace string Replicas int32 HaConfig *HaConfig Leader *Leader Members []Member Switchover *Switchover Extra map[string]string Resource any }
func (*Cluster) GetLeaderMember ¶
func (*Cluster) GetMemberAddr ¶
func (*Cluster) GetMemberAddrWithPort ¶
func (*Cluster) GetMemberAddrs ¶
func (*Cluster) GetMemberName ¶
func (*Cluster) GetMemberShortAddr ¶
func (*Cluster) GetMemberWithHost ¶
func (*Cluster) GetMemberWithName ¶
type DCS ¶
type DCS interface { Initialize() error // cluster manage functions GetClusterName() string GetCluster() (*Cluster, error) GetClusterFromCache() *Cluster ResetCluster() DeleteCluster() // cluster scole ha config GetHaConfig() (*HaConfig, error) UpdateHaConfig() error // member manager functions GetMembers() ([]Member, error) AddCurrentMember() error // manual switchover GetSwitchover() (*Switchover, error) CreateSwitchover(string, string) error DeleteSwitchover() error // cluster scope leader lock AttemptAcquireLease() error CreateLease() error IsLeaseExist() (bool, error) HasLease() bool ReleaseLease() error UpdateLease() error GetLeader() (*Leader, error) }
type HaConfig ¶
type HaConfig struct { DeleteMembers map[string]MemberToDelete // contains filtered or unexported fields }
func (*HaConfig) AddMemberToDelete ¶
func (*HaConfig) FinishDeleted ¶
func (*HaConfig) GetDuplicatedMemberToDelete ¶ added in v0.9.0
func (c *HaConfig) GetDuplicatedMemberToDelete(member *Member) *MemberToDelete
GetDuplicatedMemberToDelete get previous duplicated delete record in ha configmap
func (*HaConfig) GetMaxLagOnSwitchover ¶
func (*HaConfig) GetMemberToDelete ¶
func (c *HaConfig) GetMemberToDelete(member *Member) *MemberToDelete
func (*HaConfig) IsDeleting ¶
func (*HaConfig) TryToRemoveDeleteRecord ¶ added in v0.9.0
type KubernetesStore ¶
type KubernetesStore struct { LeaderObservedTime int64 IsLeaderClusterWide bool // contains filtered or unexported fields }
func NewKubernetesStore ¶
func NewKubernetesStore() (*KubernetesStore, error)
func (*KubernetesStore) AddCurrentMember ¶
func (store *KubernetesStore) AddCurrentMember() error
func (*KubernetesStore) AttemptAcquireLease ¶
func (store *KubernetesStore) AttemptAcquireLease() error
func (*KubernetesStore) CreateHaConfig ¶
func (store *KubernetesStore) CreateHaConfig() error
func (*KubernetesStore) CreateLease ¶
func (store *KubernetesStore) CreateLease() error
func (*KubernetesStore) CreateSwitchover ¶
func (store *KubernetesStore) CreateSwitchover(leader, candidate string) error
func (*KubernetesStore) DeleteCluster ¶
func (store *KubernetesStore) DeleteCluster()
func (*KubernetesStore) DeleteLeader ¶
func (store *KubernetesStore) DeleteLeader() error
func (*KubernetesStore) DeleteSwitchover ¶
func (store *KubernetesStore) DeleteSwitchover() error
func (*KubernetesStore) GetCluster ¶
func (store *KubernetesStore) GetCluster() (*Cluster, error)
func (*KubernetesStore) GetClusterFromCache ¶
func (store *KubernetesStore) GetClusterFromCache() *Cluster
func (*KubernetesStore) GetClusterName ¶
func (store *KubernetesStore) GetClusterName() string
func (*KubernetesStore) GetHaConfig ¶
func (store *KubernetesStore) GetHaConfig() (*HaConfig, error)
func (*KubernetesStore) GetLeader ¶
func (store *KubernetesStore) GetLeader() (*Leader, error)
func (*KubernetesStore) GetLeaderConfigMap ¶
func (store *KubernetesStore) GetLeaderConfigMap() (*corev1.ConfigMap, error)
func (*KubernetesStore) GetMembers ¶
func (store *KubernetesStore) GetMembers() ([]Member, error)
func (*KubernetesStore) GetSwitchOverConfigMap ¶
func (store *KubernetesStore) GetSwitchOverConfigMap() (*corev1.ConfigMap, error)
func (*KubernetesStore) GetSwitchover ¶
func (store *KubernetesStore) GetSwitchover() (*Switchover, error)
func (*KubernetesStore) HasLease ¶
func (store *KubernetesStore) HasLease() bool
func (*KubernetesStore) Initialize ¶
func (store *KubernetesStore) Initialize() error
func (*KubernetesStore) IsLeaseExist ¶
func (store *KubernetesStore) IsLeaseExist() (bool, error)
func (*KubernetesStore) ReleaseLease ¶
func (store *KubernetesStore) ReleaseLease() error
func (*KubernetesStore) ResetCluster ¶
func (store *KubernetesStore) ResetCluster()
func (*KubernetesStore) SetCompName ¶
func (store *KubernetesStore) SetCompName(componentName string)
func (*KubernetesStore) UpdateHaConfig ¶
func (store *KubernetesStore) UpdateHaConfig() error
func (*KubernetesStore) UpdateLease ¶
func (store *KubernetesStore) UpdateLease() error
type Member ¶
type Member struct { Index string Name string Role string PodIP string DBPort string LorryPort string HAPort string UID string UseIP bool ComponentName string // contains filtered or unexported fields }
func (*Member) IsLorryReady ¶ added in v0.8.4
type MemberToDelete ¶
type MockDCS ¶
type MockDCS struct {
// contains filtered or unexported fields
}
MockDCS is a mock of DCS interface.
func NewMockDCS ¶
func NewMockDCS(ctrl *gomock.Controller) *MockDCS
NewMockDCS creates a new mock instance.
func (*MockDCS) AddCurrentMember ¶
AddCurrentMember mocks base method.
func (*MockDCS) AttemptAcquireLease ¶
AttemptAcquireLease mocks base method.
func (*MockDCS) CreateSwitchover ¶
CreateSwitchover mocks base method.
func (*MockDCS) DeleteSwitchover ¶
DeleteSwitchover mocks base method.
func (*MockDCS) EXPECT ¶
func (m *MockDCS) EXPECT() *MockDCSMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockDCS) GetCluster ¶
GetCluster mocks base method.
func (*MockDCS) GetClusterFromCache ¶
GetClusterFromCache mocks base method.
func (*MockDCS) GetClusterName ¶
GetClusterName mocks base method.
func (*MockDCS) GetHaConfig ¶
GetHaConfig mocks base method.
func (*MockDCS) GetMembers ¶
GetMembers mocks base method.
func (*MockDCS) GetSwitchover ¶
func (m *MockDCS) GetSwitchover() (*Switchover, error)
GetSwitchover mocks base method.
func (*MockDCS) IsLeaseExist ¶
IsLeaseExist mocks base method.
func (*MockDCS) ReleaseLease ¶
ReleaseLease mocks base method.
func (*MockDCS) UpdateHaConfig ¶
UpdateHaConfig mocks base method.
type MockDCSMockRecorder ¶
type MockDCSMockRecorder struct {
// contains filtered or unexported fields
}
MockDCSMockRecorder is the mock recorder for MockDCS.
func (*MockDCSMockRecorder) AddCurrentMember ¶
func (mr *MockDCSMockRecorder) AddCurrentMember() *gomock.Call
AddCurrentMember indicates an expected call of AddCurrentMember.
func (*MockDCSMockRecorder) AttemptAcquireLease ¶
func (mr *MockDCSMockRecorder) AttemptAcquireLease() *gomock.Call
AttemptAcquireLease indicates an expected call of AttemptAcquireLease.
func (*MockDCSMockRecorder) CreateLease ¶
func (mr *MockDCSMockRecorder) CreateLease() *gomock.Call
CreateLease indicates an expected call of CreateLease.
func (*MockDCSMockRecorder) CreateSwitchover ¶
func (mr *MockDCSMockRecorder) CreateSwitchover(arg0, arg1 interface{}) *gomock.Call
CreateSwitchover indicates an expected call of CreateSwitchover.
func (*MockDCSMockRecorder) DeleteCluster ¶
func (mr *MockDCSMockRecorder) DeleteCluster() *gomock.Call
DeleteCluster indicates an expected call of DeleteCluster.
func (*MockDCSMockRecorder) DeleteSwitchover ¶
func (mr *MockDCSMockRecorder) DeleteSwitchover() *gomock.Call
DeleteSwitchover indicates an expected call of DeleteSwitchover.
func (*MockDCSMockRecorder) GetCluster ¶
func (mr *MockDCSMockRecorder) GetCluster() *gomock.Call
GetCluster indicates an expected call of GetCluster.
func (*MockDCSMockRecorder) GetClusterFromCache ¶
func (mr *MockDCSMockRecorder) GetClusterFromCache() *gomock.Call
GetClusterFromCache indicates an expected call of GetClusterFromCache.
func (*MockDCSMockRecorder) GetClusterName ¶
func (mr *MockDCSMockRecorder) GetClusterName() *gomock.Call
GetClusterName indicates an expected call of GetClusterName.
func (*MockDCSMockRecorder) GetHaConfig ¶
func (mr *MockDCSMockRecorder) GetHaConfig() *gomock.Call
GetHaConfig indicates an expected call of GetHaConfig.
func (*MockDCSMockRecorder) GetLeader ¶
func (mr *MockDCSMockRecorder) GetLeader() *gomock.Call
GetLeader indicates an expected call of GetLeader.
func (*MockDCSMockRecorder) GetMembers ¶
func (mr *MockDCSMockRecorder) GetMembers() *gomock.Call
GetMembers indicates an expected call of GetMembers.
func (*MockDCSMockRecorder) GetSwitchover ¶
func (mr *MockDCSMockRecorder) GetSwitchover() *gomock.Call
GetSwitchover indicates an expected call of GetSwitchover.
func (*MockDCSMockRecorder) HasLease ¶
func (mr *MockDCSMockRecorder) HasLease() *gomock.Call
HasLease indicates an expected call of HasLease.
func (*MockDCSMockRecorder) Initialize ¶
func (mr *MockDCSMockRecorder) Initialize() *gomock.Call
Initialize indicates an expected call of Initialize.
func (*MockDCSMockRecorder) IsLeaseExist ¶
func (mr *MockDCSMockRecorder) IsLeaseExist() *gomock.Call
IsLeaseExist indicates an expected call of IsLeaseExist.
func (*MockDCSMockRecorder) ReleaseLease ¶
func (mr *MockDCSMockRecorder) ReleaseLease() *gomock.Call
ReleaseLease indicates an expected call of ReleaseLease.
func (*MockDCSMockRecorder) ResetCluster ¶
func (mr *MockDCSMockRecorder) ResetCluster() *gomock.Call
ResetCluster indicates an expected call of ResetCluster.
func (*MockDCSMockRecorder) UpdateHaConfig ¶
func (mr *MockDCSMockRecorder) UpdateHaConfig() *gomock.Call
UpdateHaConfig indicates an expected call of UpdateHaConfig.
func (*MockDCSMockRecorder) UpdateLease ¶
func (mr *MockDCSMockRecorder) UpdateLease() *gomock.Call
UpdateLease indicates an expected call of UpdateLease.
type Switchover ¶
func (*Switchover) GetCandidate ¶
func (s *Switchover) GetCandidate() string
func (*Switchover) GetLeader ¶
func (s *Switchover) GetLeader() string