hakeeper

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package hakeeper implements MO's hakeeper component.

Index

Constants

View Source
const (
	DefaultTickPerSecond     = 10
	DefaultLogStoreTimeout   = 5 * time.Minute
	DefaultTNStoreTimeout    = 10 * time.Second
	DefaultCNStoreTimeout    = 30 * time.Second
	DefaultProxyStoreTimeout = 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 GetCNStoreHeartbeatCmd(data []byte) []byte

func GetDeleteCNStoreCmd added in v1.0.0

func GetDeleteCNStoreCmd(cnStore pb.DeleteCNStore) []byte

func GetInitialClusterRequestCmd

func GetInitialClusterRequestCmd(numOfLogShards uint64,
	numOfTNShards uint64, numOfLogReplicas uint64, nextID uint64, nextIDByKey map[string]uint64) []byte

func GetLogStoreHeartbeatCmd

func GetLogStoreHeartbeatCmd(data []byte) []byte

func GetPatchCNStoreCmd added in v1.0.0

func GetPatchCNStoreCmd(stateLabel pb.CNStateLabel) []byte

func GetProxyHeartbeatCmd added in v1.1.0

func GetProxyHeartbeatCmd(data []byte) []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 GetTNStoreHeartbeatCmd(data []byte) []byte

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

	// ProxyStoreTimeout is the actual time limit between a proxy store's heartbeat.
	// If HAKeeper does not receive two heartbeat within ProxyStoreTimeout,
	// it regards the proxy store as down.
	ProxyStoreTimeout time.Duration
}

func (Config) CNStoreExpired added in v0.6.0

func (cfg Config) CNStoreExpired(start, current uint64) bool

func (Config) ExpiredTick added in v0.6.0

func (cfg Config) ExpiredTick(start uint64, timeout time.Duration) uint64

func (*Config) Fill added in v0.6.0

func (cfg *Config) Fill()

func (Config) LogStoreExpired added in v0.6.0

func (cfg Config) LogStoreExpired(start, current uint64) bool

func (Config) ProxyStoreExpired added in v1.1.0

func (cfg Config) ProxyStoreExpired(start, current uint64) bool

func (Config) TNStoreExpired added in v1.0.0

func (cfg Config) TNStoreExpired(start, current uint64) bool

func (Config) Validate added in v0.6.0

func (cfg Config) Validate() error

type IDAllocator

type IDAllocator interface {
	// Next returns a new ID that can be used as the replica ID of a TN shard or
	// Log shard. When the return boolean value is false, it means no more ID
	// can be allocated at this time.
	Next() (uint64, bool)
	Set(first uint64, last uint64)
	Capacity() uint64
}

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()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL