Versions in this module Expand all Collapse all v0 v0.1.0 Mar 12, 2021 Changes in this version + const FastOperatorWaitTime + const OperatorExpireTime + const SlowOperatorWaitTime + func IsEndStatus(s OpStatus) bool + func OpStatusToPDPB(s OpStatus) metapb.OperatorStatus + func OpStatusToString(s OpStatus) string + func SetOperatorStatusReachTime(op *Operator, st OpStatus, t time.Time) + func SkipOriginJointStateCheck(b *Builder) + type AddLearner struct + PeerID uint64 + ToContainer uint64 + func (al AddLearner) CheckSafety(res *core.CachedResource) error + func (al AddLearner) ConfVerChanged(res *core.CachedResource) uint64 + func (al AddLearner) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (al AddLearner) IsFinish(res *core.CachedResource) bool + func (al AddLearner) String() string + type AddLightLearner struct + PeerID uint64 + ToContainer uint64 + func (al AddLightLearner) CheckSafety(res *core.CachedResource) error + func (al AddLightLearner) ConfVerChanged(res *core.CachedResource) uint64 + func (al AddLightLearner) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (al AddLightLearner) IsFinish(res *core.CachedResource) bool + func (al AddLightLearner) String() string + type AddLightPeer struct + PeerID uint64 + ToContainer uint64 + func (ap AddLightPeer) CheckSafety(res *core.CachedResource) error + func (ap AddLightPeer) ConfVerChanged(res *core.CachedResource) uint64 + func (ap AddLightPeer) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (ap AddLightPeer) IsFinish(res *core.CachedResource) bool + func (ap AddLightPeer) String() string + type AddPeer struct + PeerID uint64 + ToContainer uint64 + func (ap AddPeer) CheckSafety(res *core.CachedResource) error + func (ap AddPeer) ConfVerChanged(res *core.CachedResource) uint64 + func (ap AddPeer) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (ap AddPeer) IsFinish(res *core.CachedResource) bool + func (ap AddPeer) String() string + type Builder struct + func NewBuilder(desc string, cluster opt.Cluster, res *core.CachedResource, ...) *Builder + func (b *Builder) AddPeer(peer metapb.Peer) *Builder + func (b *Builder) Build(kind OpKind) (*Operator, error) + func (b *Builder) DemoteVoter(containerID uint64) *Builder + func (b *Builder) EnableForceTargetLeader() *Builder + func (b *Builder) EnableLightWeight() *Builder + func (b *Builder) PromoteLearner(containerID uint64) *Builder + func (b *Builder) RemovePeer(containerID uint64) *Builder + func (b *Builder) SetExpectedRoles(roles map[uint64]placement.PeerRoleType) *Builder + func (b *Builder) SetLeader(containerID uint64) *Builder + func (b *Builder) SetPeers(peers map[uint64]metapb.Peer) *Builder + type BuilderOption func(*Builder) + type ChangePeerV2Enter struct + DemoteVoters []DemoteVoter + PromoteLearners []PromoteLearner + func (cpe ChangePeerV2Enter) CheckSafety(res *core.CachedResource) error + func (cpe ChangePeerV2Enter) ConfVerChanged(res *core.CachedResource) uint64 + func (cpe ChangePeerV2Enter) GetRequest() *rpcpb.ChangePeerV2 + func (cpe ChangePeerV2Enter) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (cpe ChangePeerV2Enter) IsFinish(res *core.CachedResource) bool + func (cpe ChangePeerV2Enter) String() string + type ChangePeerV2Leave struct + DemoteVoters []DemoteVoter + PromoteLearners []PromoteLearner + func (cpl ChangePeerV2Leave) CheckSafety(res *core.CachedResource) error + func (cpl ChangePeerV2Leave) ConfVerChanged(res *core.CachedResource) uint64 + func (cpl ChangePeerV2Leave) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (cpl ChangePeerV2Leave) IsFinish(res *core.CachedResource) bool + func (cpl ChangePeerV2Leave) String() string + type ContainerInfluence struct + LeaderCount int64 + LeaderSize int64 + ResourceCount int64 + ResourceSize int64 + StepCost map[limit.Type]int64 + func (s *ContainerInfluence) AdjustStepCost(limitType limit.Type, resourceSize int64) + func (s ContainerInfluence) GetStepCost(limitType limit.Type) int64 + func (s ContainerInfluence) ResourceProperty(kind core.ScheduleKind) int64 + type DemoteFollower struct + PeerID uint64 + ToContainer uint64 + func (df DemoteFollower) CheckSafety(res *core.CachedResource) error + func (df DemoteFollower) ConfVerChanged(res *core.CachedResource) uint64 + func (df DemoteFollower) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (df DemoteFollower) IsFinish(res *core.CachedResource) bool + func (df DemoteFollower) String() string + type DemoteVoter struct + PeerID uint64 + ToContainer uint64 + func (dv DemoteVoter) ConfVerChanged(res *core.CachedResource) bool + func (dv DemoteVoter) IsFinish(res *core.CachedResource) bool + func (dv DemoteVoter) String() string + type MergeResource struct + FromResource metadata.Resource + IsPassive bool + ToResource metadata.Resource + func (mr MergeResource) CheckSafety(res *core.CachedResource) error + func (mr MergeResource) ConfVerChanged(res *core.CachedResource) uint64 + func (mr MergeResource) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (mr MergeResource) IsFinish(res *core.CachedResource) bool + func (mr MergeResource) String() string + type OpHistory struct + FinishTime time.Time + From uint64 + Kind metapb.ResourceKind + To uint64 + type OpInfluence struct + ContainersInfluence map[uint64]*ContainerInfluence + func (m OpInfluence) GetContainerInfluence(id uint64) *ContainerInfluence + type OpKind uint32 + const OpAdmin + const OpHotResource + const OpLeader + const OpMerge + const OpRange + const OpReplica + const OpResource + const OpSplit + func ParseOperatorKind(str string) (OpKind, error) + func (k OpKind) String() string + type OpStatus = uint32 + const CANCELED + const CREATED + const EXPIRED + const REPLACED + const STARTED + const SUCCESS + const TIMEOUT + type OpStatusTracker struct + func NewOpStatusTracker() OpStatusTracker + func (trk *OpStatusTracker) CheckExpired(exp time.Duration) bool + func (trk *OpStatusTracker) CheckTimeout(wait time.Duration) bool + func (trk *OpStatusTracker) IsEnd() bool + func (trk *OpStatusTracker) ReachTime() time.Time + func (trk *OpStatusTracker) ReachTimeOf(s OpStatus) time.Time + func (trk *OpStatusTracker) Status() OpStatus + func (trk *OpStatusTracker) String() string + func (trk *OpStatusTracker) To(dst OpStatus) bool + type OpStep interface + CheckSafety func(res *core.CachedResource) error + ConfVerChanged func(res *core.CachedResource) uint64 + Influence func(opInfluence OpInfluence, res *core.CachedResource) + IsFinish func(res *core.CachedResource) bool + type Operator struct + AdditionalInfos map[string]string + Counters []prometheus.Counter + FinishedCounters []prometheus.Counter + func CreateAddPeerOperator(desc string, cluster opt.Cluster, res *core.CachedResource, peer metapb.Peer, ...) (*Operator, error) + func CreateForceTransferLeaderOperator(desc string, cluster opt.Cluster, res *core.CachedResource, ...) (*Operator, error) + func CreateLeaveJointStateOperator(desc string, cluster opt.Cluster, origin *core.CachedResource) (*Operator, error) + func CreateMergeResourceOperator(desc string, cluster opt.Cluster, source *core.CachedResource, ...) ([]*Operator, error) + func CreateMoveLeaderOperator(desc string, cluster opt.Cluster, res *core.CachedResource, kind OpKind, ...) (*Operator, error) + func CreateMovePeerOperator(desc string, cluster opt.Cluster, res *core.CachedResource, kind OpKind, ...) (*Operator, error) + func CreateMoveResourceOperator(desc string, cluster opt.Cluster, res *core.CachedResource, kind OpKind, ...) (*Operator, error) + func CreatePromoteLearnerOperator(desc string, cluster opt.Cluster, res *core.CachedResource, peer metapb.Peer) (*Operator, error) + func CreateRemovePeerOperator(desc string, cluster opt.Cluster, kind OpKind, res *core.CachedResource, ...) (*Operator, error) + func CreateScatterResourceOperator(desc string, cluster opt.Cluster, origin *core.CachedResource, ...) (*Operator, error) + func CreateSplitResourceOperator(desc string, res *core.CachedResource, kind OpKind, policy metapb.CheckPolicy, ...) (*Operator, error) + func CreateTransferLeaderOperator(desc string, cluster opt.Cluster, res *core.CachedResource, ...) (*Operator, error) + func NewOperator(desc, brief string, resID uint64, resEpoch metapb.ResourceEpoch, kind OpKind, ...) *Operator + func (o *Operator) AttachKind(kind OpKind) + func (o *Operator) Cancel() bool + func (o *Operator) Check(res *core.CachedResource) OpStep + func (o *Operator) CheckExpired() bool + func (o *Operator) CheckSuccess() bool + func (o *Operator) CheckTimeout() bool + func (o *Operator) ConfVerChanged(res *core.CachedResource) (total uint64) + func (o *Operator) Desc() string + func (o *Operator) ElapsedTime() time.Duration + func (o *Operator) GetAdditionalInfo() string + func (o *Operator) GetCreateTime() time.Time + func (o *Operator) GetPriorityLevel() core.PriorityLevel + func (o *Operator) GetReachTimeOf(st OpStatus) time.Time + func (o *Operator) GetStartTime() time.Time + func (o *Operator) HasStarted() bool + func (o *Operator) History() []OpHistory + func (o *Operator) IsEnd() bool + func (o *Operator) Kind() OpKind + func (o *Operator) Len() int + func (o *Operator) MarshalJSON() ([]byte, error) + func (o *Operator) Replace() bool + func (o *Operator) ResourceEpoch() metapb.ResourceEpoch + func (o *Operator) ResourceID() uint64 + func (o *Operator) RunningTime() time.Duration + func (o *Operator) SetDesc(desc string) + func (o *Operator) SetPriorityLevel(level core.PriorityLevel) + func (o *Operator) Start() bool + func (o *Operator) Status() OpStatus + func (o *Operator) Step(i int) OpStep + func (o *Operator) String() string + func (o *Operator) TotalInfluence(opInfluence OpInfluence, res *core.CachedResource) + func (o *Operator) UnfinishedInfluence(opInfluence OpInfluence, res *core.CachedResource) + type PromoteLearner struct + PeerID uint64 + ToContainer uint64 + func (pl PromoteLearner) CheckSafety(res *core.CachedResource) error + func (pl PromoteLearner) ConfVerChanged(res *core.CachedResource) uint64 + func (pl PromoteLearner) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (pl PromoteLearner) IsFinish(res *core.CachedResource) bool + func (pl PromoteLearner) String() string + type RemovePeer struct + FromContainer uint64 + PeerID uint64 + func (rp RemovePeer) CheckSafety(res *core.CachedResource) error + func (rp RemovePeer) ConfVerChanged(res *core.CachedResource) uint64 + func (rp RemovePeer) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (rp RemovePeer) IsFinish(res *core.CachedResource) bool + func (rp RemovePeer) String() string + type SplitResource struct + EndKey []byte + Policy metapb.CheckPolicy + SplitKeys [][]byte + StartKey []byte + func (sr SplitResource) CheckSafety(res *core.CachedResource) error + func (sr SplitResource) ConfVerChanged(res *core.CachedResource) uint64 + func (sr SplitResource) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (sr SplitResource) IsFinish(res *core.CachedResource) bool + func (sr SplitResource) String() string + type TransferLeader struct + FromContainer uint64 + ToContainer uint64 + func (tl TransferLeader) CheckSafety(res *core.CachedResource) error + func (tl TransferLeader) ConfVerChanged(res *core.CachedResource) uint64 + func (tl TransferLeader) Influence(opInfluence OpInfluence, res *core.CachedResource) + func (tl TransferLeader) IsFinish(res *core.CachedResource) bool + func (tl TransferLeader) String() string