Documentation
¶
Overview ¶
Package hakeeper implements MO's hakeeper component.
Index ¶
- Constants
- func GetAllocateIDCmd(allocID pb.CNAllocateID) []byte
- func GetCNStoreHeartbeatCmd(data []byte) []byte
- func GetDeleteCNStoreCmd(cnStore pb.DeleteCNStore) []byte
- func GetInitialClusterRequestCmd(numOfLogShards uint64, numOfTNShards uint64, numOfLogReplicas uint64, ...) []byte
- func GetLogStoreHeartbeatCmd(data []byte) []byte
- func GetPatchCNStoreCmd(stateLabel pb.CNStateLabel) []byte
- func GetSetStateCmd(state pb.HAKeeperState) []byte
- func GetSetTaskSchedulerStateCmd(state pb.TaskSchedulerState) []byte
- func GetTNStoreHeartbeatCmd(data []byte) []byte
- func GetTaskTableUserCmd(user pb.TaskTableUser) []byte
- func GetTickCmd() []byte
- func GetUpdateCNLabelCmd(label pb.CNStoreLabel) []byte
- func GetUpdateCNWorkStateCmd(state pb.CNWorkState) []byte
- func GetUpdateCommandsCmd(term uint64, cmds []pb.ScheduleCommand) []byte
- func NewStateMachine(shardID uint64, replicaID uint64) sm.IStateMachine
- type BootstrapManager
- type Checker
- type ClusterDetailsQuery
- type Config
- func (cfg Config) CNStoreExpired(start, current uint64) bool
- func (cfg Config) ExpiredTick(start uint64, timeout time.Duration) uint64
- func (cfg *Config) Fill()
- func (cfg Config) LogStoreExpired(start, current uint64) bool
- func (cfg Config) TNStoreExpired(start, current uint64) bool
- func (cfg Config) Validate() error
- type IDAllocator
- type IndexQuery
- type ScheduleCommandQuery
- type StateQuery
- type TaskScheduler
Constants ¶
View Source
const ( DefaultTickPerSecond = 10 DefaultLogStoreTimeout = 5 * time.Minute DefaultTNStoreTimeout = 10 * time.Second DefaultCNStoreTimeout = 30 * time.Second )
View Source
const ( K8SIDRangeStart uint64 = 131072 K8SIDRangeEnd uint64 = 262144 // CheckDuration defines how often HAKeeper checks the health state of the cluster CheckDuration = 3 * time.Second // DefaultHAKeeperShardID is the shard ID assigned to the special HAKeeper // shard. DefaultHAKeeperShardID uint64 = 0 )
Variables ¶
This section is empty.
Functions ¶
func GetAllocateIDCmd ¶ added in v0.8.0
func GetAllocateIDCmd(allocID pb.CNAllocateID) []byte
func GetCNStoreHeartbeatCmd ¶
func GetDeleteCNStoreCmd ¶ added in v1.0.0
func GetDeleteCNStoreCmd(cnStore pb.DeleteCNStore) []byte
func GetLogStoreHeartbeatCmd ¶
func GetPatchCNStoreCmd ¶ added in v1.0.0
func GetPatchCNStoreCmd(stateLabel pb.CNStateLabel) []byte
func GetSetStateCmd ¶
func GetSetStateCmd(state pb.HAKeeperState) []byte
func GetSetTaskSchedulerStateCmd ¶ added in v0.7.0
func GetSetTaskSchedulerStateCmd(state pb.TaskSchedulerState) []byte
func GetTNStoreHeartbeatCmd ¶ added in v1.0.0
func GetTaskTableUserCmd ¶ added in v0.6.0
func GetTaskTableUserCmd(user pb.TaskTableUser) []byte
func GetTickCmd ¶
func GetTickCmd() []byte
func GetUpdateCNLabelCmd ¶ added in v0.8.0
func GetUpdateCNLabelCmd(label pb.CNStoreLabel) []byte
func GetUpdateCNWorkStateCmd ¶ added in v1.0.0
func GetUpdateCNWorkStateCmd(state pb.CNWorkState) []byte
func GetUpdateCommandsCmd ¶
func GetUpdateCommandsCmd(term uint64, cmds []pb.ScheduleCommand) []byte
func NewStateMachine ¶
func NewStateMachine(shardID uint64, replicaID uint64) sm.IStateMachine
Types ¶
type BootstrapManager ¶
type BootstrapManager interface {
Bootstrap(util.IDAllocator, pb.TNState, pb.LogState) ([]pb.ScheduleCommand, error)
CheckBootstrap(pb.LogState) bool
}
BootstrapManager is the interface suppose to be implemented by HAKeeper's bootstrap manager.
type Checker ¶
type Checker interface {
// Check is periodically called by the HAKeeper for checking the cluster
// health status, a list of Operator instances will be returned describing
// actions required to ensure the high availability of the cluster.
Check(alloc util.IDAllocator, state pb.CheckerState) []pb.ScheduleCommand
}
Checker is the interface suppose to be implemented by HAKeeper's coordinator. Checker is supposed to be stateless - Checker is free to maintain whatever internal states, but those states should never be assumed to be persistent across reboots.
type ClusterDetailsQuery ¶ added in v0.5.1
type ClusterDetailsQuery struct{ Cfg Config }
type Config ¶ added in v0.6.0
type Config struct {
// TickPerSecond indicates how many ticks every second.
// In HAKeeper, we do not use actual time to measure time elapse.
// Instead, we use ticks.
TickPerSecond int
// LogStoreTimeout is the actual time limit between a log store's heartbeat.
// If HAKeeper does not receive two heartbeat within LogStoreTimeout,
// it regards the log store as down.
LogStoreTimeout time.Duration
// TNStoreTimeout is the actual time limit between a tn store's heartbeat.
// If HAKeeper does not receive two heartbeat within TNStoreTimeout,
// it regards the tn store as down.
TNStoreTimeout time.Duration
// CNStoreTimeout is the actual time limit between a cn store's heartbeat.
// If HAKeeper does not receive two heartbeat within CNStoreTimeout,
// it regards the tn store as down.
CNStoreTimeout time.Duration
}
func (Config) CNStoreExpired ¶ added in v0.6.0
func (Config) ExpiredTick ¶ added in v0.6.0
func (Config) LogStoreExpired ¶ added in v0.6.0
func (Config) TNStoreExpired ¶ added in v1.0.0
type IDAllocator ¶
type IndexQuery ¶ added in v1.0.0
type IndexQuery struct{}
type ScheduleCommandQuery ¶
type ScheduleCommandQuery struct{ UUID string }
type StateQuery ¶
type StateQuery struct{}
type TaskScheduler ¶ added in v0.6.0
type TaskScheduler interface {
Schedule(cnState pb.CNState, currentTick uint64)
// StartScheduleCronTask start schedule cron tasks. A timer will be started to pull the latest CronTask
// from the TaskStore at regular intervals, and a timer will be maintained in memory for all Cron's to be
// triggered at regular intervals.
StartScheduleCronTask()
// StopScheduleCronTask stop schedule cron tasks.
StopScheduleCronTask()
}
Click to show internal directories.
Click to hide internal directories.