Documentation ¶
Index ¶
- Constants
- func MasterClientURL(namespace, clusterName, scheme string) string
- func MasterPeerClientURL(namespace, clusterName, podName, scheme string) string
- type Action
- type ActionType
- type FakeMasterClient
- func (c *FakeMasterClient) AddReaction(actionType ActionType, reaction Reaction)
- func (c *FakeMasterClient) DeleteMaster(_ string) error
- func (c *FakeMasterClient) DeleteWorker(_ string) error
- func (c *FakeMasterClient) EvictLeader() error
- func (c *FakeMasterClient) GetLeader() (MembersLeader, error)
- func (c *FakeMasterClient) GetMasters() ([]*MastersInfo, error)
- func (c *FakeMasterClient) GetWorkers() ([]*WorkersInfo, error)
- type FakeMasterControl
- func (fmc *FakeMasterControl) GetMasterClient(namespace string, dcName string, tlsEnabled bool) MasterClient
- func (fmc *FakeMasterControl) GetMasterPeerClient(namespace, dcName, podName string, tlsEnabled bool) MasterClient
- func (fmc *FakeMasterControl) SetMasterClient(namespace, dcName string, masterClient MasterClient)
- func (fmc *FakeMasterControl) SetMasterPeerClient(namespace, dcName, podName string, masterPeerClient MasterClient)
- type LeaderResp
- type ListMemberLeader
- type ListMemberMaster
- type ListMemberWorker
- type MasterClient
- type MasterControlInterface
- type MastersInfo
- type MastersResp
- type MembersLeader
- type MembersMaster
- type MembersWorker
- type NotFoundReaction
- type Reaction
- type RespHeader
- type WorkerResp
- type WorkersInfo
Constants ¶
View Source
const (
DefaultTimeout = 5 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func MasterClientURL ¶
MasterClientURL builds the url of master client
func MasterPeerClientURL ¶
MasterPeerClientURL builds the url of master peer client. It's used to evict leader because dm can't forward evict leader command now
Types ¶
type ActionType ¶
type ActionType string
const ( GetMastersActionType ActionType = "GetMasters" GetWorkersActionType ActionType = "GetWorkers" GetLeaderActionType ActionType = "GetLeader" EvictLeaderActionType ActionType = "EvictLeader" DeleteMasterActionType ActionType = "DeleteMaster" DeleteWorkerActionType ActionType = "DeleteWorker" )
type FakeMasterClient ¶
type FakeMasterClient struct {
// contains filtered or unexported fields
}
FakeMasterClient implements a fake version of MasterClient.
func NewFakeMasterClient ¶
func NewFakeMasterClient() *FakeMasterClient
func (*FakeMasterClient) AddReaction ¶
func (c *FakeMasterClient) AddReaction(actionType ActionType, reaction Reaction)
func (*FakeMasterClient) DeleteMaster ¶
func (c *FakeMasterClient) DeleteMaster(_ string) error
func (*FakeMasterClient) DeleteWorker ¶
func (c *FakeMasterClient) DeleteWorker(_ string) error
func (*FakeMasterClient) EvictLeader ¶
func (c *FakeMasterClient) EvictLeader() error
func (*FakeMasterClient) GetLeader ¶
func (c *FakeMasterClient) GetLeader() (MembersLeader, error)
func (*FakeMasterClient) GetMasters ¶
func (c *FakeMasterClient) GetMasters() ([]*MastersInfo, error)
func (*FakeMasterClient) GetWorkers ¶
func (c *FakeMasterClient) GetWorkers() ([]*WorkersInfo, error)
type FakeMasterControl ¶
type FakeMasterControl struct {
// contains filtered or unexported fields
}
FakeMasterControl implements a fake version of MasterControlInterface.
func NewFakeMasterControl ¶
func NewFakeMasterControl(secretLister corelisterv1.SecretLister) *FakeMasterControl
func (*FakeMasterControl) GetMasterClient ¶
func (fmc *FakeMasterControl) GetMasterClient(namespace string, dcName string, tlsEnabled bool) MasterClient
func (*FakeMasterControl) GetMasterPeerClient ¶
func (fmc *FakeMasterControl) GetMasterPeerClient(namespace, dcName, podName string, tlsEnabled bool) MasterClient
func (*FakeMasterControl) SetMasterClient ¶
func (fmc *FakeMasterControl) SetMasterClient(namespace, dcName string, masterClient MasterClient)
func (*FakeMasterControl) SetMasterPeerClient ¶
func (fmc *FakeMasterControl) SetMasterPeerClient(namespace, dcName, podName string, masterPeerClient MasterClient)
type LeaderResp ¶
type LeaderResp struct { RespHeader `json:",inline"` ListMemberResp []*ListMemberLeader `json:"members,omitempty"` }
type ListMemberLeader ¶
type ListMemberLeader struct {
MembersLeader `json:"leader,omitempty"`
}
type ListMemberMaster ¶
type ListMemberMaster struct {
MembersMaster `json:"master,omitempty"`
}
type ListMemberWorker ¶
type ListMemberWorker struct {
MembersWorker `json:"worker,omitempty"`
}
type MasterClient ¶
type MasterClient interface { // GetMasters returns all master members from cluster GetMasters() ([]*MastersInfo, error) GetWorkers() ([]*WorkersInfo, error) GetLeader() (MembersLeader, error) EvictLeader() error DeleteMaster(name string) error DeleteWorker(name string) error }
MasterClient provides master server's api
func NewMasterClient ¶
func NewMasterClient(url string, timeout time.Duration, tlsConfig *tls.Config, disableKeepalive bool) MasterClient
NewMasterClient returns a new MasterClient
type MasterControlInterface ¶
type MasterControlInterface interface { // GetMasterClient provides MasterClient of the dm cluster. GetMasterClient(namespace string, dcName string, tlsEnabled bool) MasterClient GetMasterPeerClient(namespace string, dcName, podName string, tlsEnabled bool) MasterClient }
MasterControlInterface is an interface that knows how to manage and get dm cluster's master client
func NewDefaultMasterControl ¶
func NewDefaultMasterControl(secretLister corelisterv1.SecretLister) MasterControlInterface
NewDefaultMasterControl returns a defaultMasterControl instance
type MastersInfo ¶
type MastersResp ¶
type MastersResp struct { RespHeader `json:",inline"` ListMemberResp []*ListMemberMaster `json:"members,omitempty"` }
type MembersLeader ¶
type MembersMaster ¶
type MembersMaster struct { Msg string `json:"msg,omitempty"` Masters []*MastersInfo `json:"masters,omitempty"` }
type MembersWorker ¶
type MembersWorker struct { Msg string `json:"msg,omitempty"` Workers []*WorkersInfo `json:"workers,omitempty"` }
type NotFoundReaction ¶
type NotFoundReaction struct {
// contains filtered or unexported fields
}
func (*NotFoundReaction) Error ¶
func (nfr *NotFoundReaction) Error() string
type RespHeader ¶
type WorkerResp ¶
type WorkerResp struct { RespHeader `json:",inline"` ListMemberResp []*ListMemberWorker `json:"members,omitempty"` }
Click to show internal directories.
Click to hide internal directories.