Documentation ¶
Index ¶
- Constants
- func IsEndStatus(s OpStatus) bool
- func OpStatusToString(s OpStatus) string
- type AddLogService
- type AddTnReplica
- type Builder
- type ClusterState
- type Controller
- func (c *Controller) Dispatch(ops []*Operator, logState pb.LogState, tnState pb.TNState, cnState pb.CNState, ...) (commands []pb.ScheduleCommand)
- func (c *Controller) GetExecutingReplicas() ExecutingReplicas
- func (c *Controller) GetOperators(shardID uint64) []*Operator
- func (c *Controller) RemoveFinishedOperator(logState pb.LogState, tnState pb.TNState, cnState pb.CNState, ...)
- func (c *Controller) RemoveOperator(op *Operator) bool
- type CreateTaskService
- type DeleteCNStore
- type DeleteProxyStore
- type ExecutingReplicas
- type JoinGossipCluster
- type KillLogZombie
- type OpStatus
- type OpStatusTracker
- func (trk *OpStatusTracker) CheckExpired(exp 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
- type Operator
- func CreateAddReplica(uuid string, shardInfo pb.LogShardInfo, replicaID uint64) (*Operator, error)
- func CreateDeleteCNOp(brief, uuid string) *Operator
- func CreateDeleteProxyOp(brief, uuid string) *Operator
- func CreateKillZombie(brief, uuid string, shardID, replicaID uint64) *Operator
- func CreateRemoveReplica(uuid string, shardInfo pb.LogShardInfo) (*Operator, error)
- func CreateStartReplica(brief, uuid string, shardID, replicaID uint64) *Operator
- func CreateStopReplica(brief string, uuid string, shardID uint64, epoch uint64) *Operator
- func CreateTaskServiceOp(brief, uuid string, serviceType pb.ServiceType, user pb.TaskTableUser) *Operator
- func JoinGossipClusterOp(brief, uuid string, existing []string) *Operator
- func NewOperator(brief string, shardID uint64, epoch uint64, steps ...OpStep) *Operator
- func (o *Operator) Cancel() bool
- func (o *Operator) Check(logState pb.LogState, tnState pb.TNState, cnState pb.CNState, ...) OpStep
- func (o *Operator) CheckExpired() bool
- func (o *Operator) CheckSuccess() bool
- func (o *Operator) GetStartTime() time.Time
- func (o *Operator) HasStarted() bool
- func (o *Operator) IsEnd() bool
- func (o *Operator) OpSteps() []OpStep
- func (o *Operator) SetStatus(status OpStatus)
- func (o *Operator) ShardID() uint64
- func (o *Operator) Status() OpStatus
- type RemoveLogService
- type RemoveTnReplica
- type Replica
- type StartLogService
- type StopLogService
- type StopLogStore
- type StopTnStore
Constants ¶
const ( ExpireTime = 15 * time.Second NoopEpoch uint64 = 0 NoopShardID uint64 = 0 )
Variables ¶
This section is empty.
Functions ¶
func OpStatusToString ¶
OpStatusToString converts Status to string.
Types ¶
type AddLogService ¶
func (AddLogService) IsFinish ¶
func (a AddLogService) IsFinish(state ClusterState) bool
func (AddLogService) String ¶
func (a AddLogService) String() string
type AddTnReplica ¶ added in v1.0.0
func (AddTnReplica) IsFinish ¶ added in v1.0.0
func (a AddTnReplica) IsFinish(state ClusterState) bool
func (AddTnReplica) String ¶ added in v1.0.0
func (a AddTnReplica) String() string
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is used to create operators. Usage:
op, err := NewBuilder(desc, cluster, shard). RemovePeer(store1). AddPeer(peer1). Build(kind)
The generated Operator will choose the most appropriate execution order according to various constraints.
func NewBuilder ¶
func NewBuilder(desc string, shardInfo logservice.LogShardInfo) *Builder
NewBuilder creates a Builder.
func (*Builder) RemovePeer ¶
RemovePeer records a remove peer operation in Builder.
type ClusterState ¶ added in v1.1.0
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is used to manage operators.
func NewController ¶
func NewController() *Controller
func (*Controller) Dispatch ¶
func (c *Controller) Dispatch(ops []*Operator, logState pb.LogState, tnState pb.TNState, cnState pb.CNState, proxyState pb.ProxyState) (commands []pb.ScheduleCommand)
func (*Controller) GetExecutingReplicas ¶ added in v0.6.0
func (c *Controller) GetExecutingReplicas() ExecutingReplicas
func (*Controller) GetOperators ¶
func (c *Controller) GetOperators(shardID uint64) []*Operator
GetOperators gets operators from the given shard.
func (*Controller) RemoveFinishedOperator ¶
func (c *Controller) RemoveFinishedOperator( logState pb.LogState, tnState pb.TNState, cnState pb.CNState, proxyState pb.ProxyState, )
func (*Controller) RemoveOperator ¶
func (c *Controller) RemoveOperator(op *Operator) bool
RemoveOperator removes an operator from the operators.
type CreateTaskService ¶ added in v0.6.0
type CreateTaskService struct { StoreID string StoreType pb.ServiceType TaskUser pb.TaskTableUser }
func (CreateTaskService) IsFinish ¶ added in v0.6.0
func (a CreateTaskService) IsFinish(state ClusterState) bool
func (CreateTaskService) String ¶ added in v0.6.0
func (a CreateTaskService) String() string
type DeleteCNStore ¶ added in v0.7.0
type DeleteCNStore struct {
StoreID string
}
func (DeleteCNStore) IsFinish ¶ added in v0.7.0
func (a DeleteCNStore) IsFinish(state ClusterState) bool
func (DeleteCNStore) String ¶ added in v0.7.0
func (a DeleteCNStore) String() string
type DeleteProxyStore ¶ added in v1.1.0
type DeleteProxyStore struct {
StoreID string
}
func (DeleteProxyStore) IsFinish ¶ added in v1.1.0
func (a DeleteProxyStore) IsFinish(state ClusterState) bool
func (DeleteProxyStore) String ¶ added in v1.1.0
func (a DeleteProxyStore) String() string
type ExecutingReplicas ¶ added in v0.6.0
type JoinGossipCluster ¶ added in v1.0.0
func (JoinGossipCluster) IsFinish ¶ added in v1.0.0
func (a JoinGossipCluster) IsFinish(state ClusterState) bool
func (JoinGossipCluster) String ¶ added in v1.0.0
func (a JoinGossipCluster) String() string
type KillLogZombie ¶ added in v0.6.0
type KillLogZombie struct {
Replica
}
func (KillLogZombie) IsFinish ¶ added in v0.6.0
func (a KillLogZombie) IsFinish(state ClusterState) bool
func (KillLogZombie) String ¶ added in v0.6.0
func (a KillLogZombie) String() string
type OpStatusTracker ¶
type OpStatusTracker struct {
// contains filtered or unexported fields
}
OpStatusTracker represents the status of an operator.
func NewOpStatusTracker ¶
func NewOpStatusTracker() OpStatusTracker
NewOpStatusTracker creates an OpStatus.
func (*OpStatusTracker) CheckExpired ¶
func (trk *OpStatusTracker) CheckExpired(exp time.Duration) bool
CheckExpired checks if expired, and update the current status.
func (*OpStatusTracker) IsEnd ¶
func (trk *OpStatusTracker) IsEnd() bool
IsEnd checks whether the current status is an end status.
func (*OpStatusTracker) ReachTime ¶
func (trk *OpStatusTracker) ReachTime() time.Time
ReachTime returns the reach time of current status.
func (*OpStatusTracker) ReachTimeOf ¶
func (trk *OpStatusTracker) ReachTimeOf(s OpStatus) time.Time
ReachTimeOf returns the time when reached given status. If didn't reached the given status, return zero.
func (*OpStatusTracker) Status ¶
func (trk *OpStatusTracker) Status() OpStatus
Status returns current status.
func (*OpStatusTracker) String ¶
func (trk *OpStatusTracker) String() string
String implements fmt.Stringer.
func (*OpStatusTracker) To ¶
func (trk *OpStatusTracker) To(dst OpStatus) bool
To transfer the current status to dst if this transition is valid, returns whether transferred.
type Operator ¶
type Operator struct {
// contains filtered or unexported fields
}
Operator contains execution steps generated by scheduler.
func CreateAddReplica ¶
func CreateDeleteCNOp ¶ added in v0.7.0
func CreateDeleteProxyOp ¶ added in v1.1.0
func CreateKillZombie ¶ added in v0.6.0
func CreateRemoveReplica ¶
func CreateRemoveReplica(uuid string, shardInfo pb.LogShardInfo) (*Operator, error)
func CreateStartReplica ¶
func CreateStopReplica ¶
func CreateTaskServiceOp ¶ added in v0.6.0
func CreateTaskServiceOp(brief, uuid string, serviceType pb.ServiceType, user pb.TaskTableUser) *Operator
func JoinGossipClusterOp ¶ added in v1.0.0
func NewOperator ¶
NewOperator creates a new operator.
func (*Operator) CheckExpired ¶
CheckExpired checks if the operator is timeout, and update the status.
func (*Operator) CheckSuccess ¶
CheckSuccess checks if all steps are finished, and update the status.
func (*Operator) GetStartTime ¶
GetStartTime gets the start time of operator.
func (*Operator) HasStarted ¶
HasStarted returns whether operator has started.
type RemoveLogService ¶
func (RemoveLogService) IsFinish ¶
func (a RemoveLogService) IsFinish(state ClusterState) bool
func (RemoveLogService) String ¶
func (a RemoveLogService) String() string
type RemoveTnReplica ¶ added in v1.0.0
func (RemoveTnReplica) IsFinish ¶ added in v1.0.0
func (a RemoveTnReplica) IsFinish(state ClusterState) bool
func (RemoveTnReplica) String ¶ added in v1.0.0
func (a RemoveTnReplica) String() string
type StartLogService ¶
type StartLogService struct {
Replica
}
func (StartLogService) IsFinish ¶
func (a StartLogService) IsFinish(state ClusterState) bool
func (StartLogService) String ¶
func (a StartLogService) String() string
type StopLogService ¶
type StopLogService struct {
Replica
}
func (StopLogService) IsFinish ¶
func (a StopLogService) IsFinish(state ClusterState) bool
func (StopLogService) String ¶
func (a StopLogService) String() string
type StopLogStore ¶
type StopLogStore struct {
StoreID string
}
StopLogStore corresponds to log store shutdown command.
func (StopLogStore) IsFinish ¶
func (a StopLogStore) IsFinish(state ClusterState) bool
func (StopLogStore) String ¶
func (a StopLogStore) String() string
type StopTnStore ¶ added in v1.0.0
type StopTnStore struct {
StoreID string
}
StopTnStore corresponds to tn store shutdown command.
func (StopTnStore) IsFinish ¶ added in v1.0.0
func (a StopTnStore) IsFinish(state ClusterState) bool
func (StopTnStore) String ¶ added in v1.0.0
func (a StopTnStore) String() string