Documentation ¶
Overview ¶
Package hakeeper implements MO's hakeeper component.
Index ¶
- Constants
- func GetCNStoreHeartbeatCmd(data []byte) []byte
- func GetDNStoreHeartbeatCmd(data []byte) []byte
- func GetGetIDCmd(count uint64) []byte
- func GetInitialClusterRequestCmd(numOfLogShards uint64, numOfDNShards uint64, numOfLogReplicas uint64) []byte
- func GetLogStoreHeartbeatCmd(data []byte) []byte
- func GetSetStateCmd(state pb.HAKeeperState) []byte
- func GetSetTaskSchedulerStateCmd(state pb.TaskSchedulerState) []byte
- func GetTaskTableUserCmd(user pb.TaskTableUser) []byte
- func GetTickCmd() []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) DNStoreExpired(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) Validate() error
- type IDAllocator
- type ScheduleCommandQuery
- type StateQuery
- type TaskScheduler
Constants ¶
View Source
const ( DefaultTickPerSecond = 10 DefaultLogStoreTimeout = 5 * time.Minute DefaultDNStoreTimeout = 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 GetCNStoreHeartbeatCmd ¶
func GetDNStoreHeartbeatCmd ¶
func GetGetIDCmd ¶
func GetLogStoreHeartbeatCmd ¶
func GetSetStateCmd ¶
func GetSetStateCmd(state pb.HAKeeperState) []byte
func GetSetTaskSchedulerStateCmd ¶ added in v0.7.0
func GetSetTaskSchedulerStateCmd(state pb.TaskSchedulerState) []byte
func GetTaskTableUserCmd ¶ added in v0.6.0
func GetTaskTableUserCmd(user pb.TaskTableUser) []byte
func GetTickCmd ¶
func GetTickCmd() []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.DNState, 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 // DNStoreTimeout is the actual time limit between a dn store's heartbeat. // If HAKeeper does not receive two heartbeat within DNStoreTimeout, // it regards the dn store as down. DNStoreTimeout 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 dn store as down. CNStoreTimeout time.Duration }
func (Config) CNStoreExpired ¶ added in v0.6.0
func (Config) DNStoreExpired ¶ added in v0.6.0
func (Config) ExpiredTick ¶ added in v0.6.0
func (Config) LogStoreExpired ¶ added in v0.6.0
type IDAllocator ¶
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) // Create an asynchronous task that executes a single time, this method is idempotent, the // same task is not created repeatedly based on multiple calls. Create(context.Context, []task.TaskMetadata) error // 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.