scheduler

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AssignReason = "ShardView exists in metadata but shardNode not exists, assign shard to node"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssignShardScheduler

type AssignShardScheduler struct {
	// contains filtered or unexported fields
}

AssignShardScheduler used to assigning shards without nodes.

func (AssignShardScheduler) Schedule

func (a AssignShardScheduler) Schedule(ctx context.Context, clusterSnapshot metadata.Snapshot) (ScheduleResult, error)

type Manager

type Manager interface {
	ListScheduler() []Scheduler

	Start(ctx context.Context) error

	Stop(ctx context.Context) error

	UpdateEnableSchedule(ctx context.Context, enableSchedule bool)

	// Scheduler will be called when received new heartbeat, every scheduler registered in schedulerManager will be called to generate procedures.
	// Scheduler cloud be schedule with fix time interval or heartbeat.
	Scheduler(ctx context.Context, clusterSnapshot metadata.Snapshot) []ScheduleResult
}

Manager used to manage schedulers, it will register all schedulers when it starts.

Each registered scheduler will generate procedures if the cluster topology matches the scheduling condition.

func NewManager

func NewManager(logger *zap.Logger, procedureManager procedure.Manager, factory *coordinator.Factory, clusterMetadata *metadata.ClusterMetadata, client *clientv3.Client, rootPath string, enableSchedule bool, topologyType storage.TopologyType) Manager

type ManagerImpl

type ManagerImpl struct {
	// contains filtered or unexported fields
}

func (*ManagerImpl) ListScheduler

func (m *ManagerImpl) ListScheduler() []Scheduler

func (*ManagerImpl) Scheduler

func (m *ManagerImpl) Scheduler(ctx context.Context, clusterSnapshot metadata.Snapshot) []ScheduleResult

func (*ManagerImpl) Start

func (m *ManagerImpl) Start(ctx context.Context) error

func (*ManagerImpl) Stop

func (m *ManagerImpl) Stop(ctx context.Context) error

func (*ManagerImpl) UpdateEnableSchedule

func (m *ManagerImpl) UpdateEnableSchedule(_ context.Context, enableSchedule bool)

type RebalancedShardScheduler

type RebalancedShardScheduler struct {
	// contains filtered or unexported fields
}

func (RebalancedShardScheduler) Schedule

func (r RebalancedShardScheduler) Schedule(ctx context.Context, clusterSnapshot metadata.Snapshot) (ScheduleResult, error)

type ScheduleResult

type ScheduleResult struct {
	Procedure procedure.Procedure
	// Scheduler will give the reason than why the procedure is generated.
	Reason string
}

type Scheduler

type Scheduler interface {
	// Schedule will generate procedure based on current cluster snapshot, which will be submitted to ProcedureManager, and whether it is actually executed depends on the current state of ProcedureManager.
	Schedule(ctx context.Context, clusterSnapshot metadata.Snapshot) (ScheduleResult, error)
}

func NewAssignShardScheduler

func NewAssignShardScheduler(factory *coordinator.Factory, nodePicker coordinator.NodePicker) Scheduler

func NewRebalancedShardScheduler

func NewRebalancedShardScheduler(logger *zap.Logger, factory *coordinator.Factory, nodePicker coordinator.NodePicker) Scheduler

func NewStaticTopologyShardScheduler

func NewStaticTopologyShardScheduler(factory *coordinator.Factory, nodePicker coordinator.NodePicker) Scheduler

type StaticTopologyShardScheduler

type StaticTopologyShardScheduler struct {
	// contains filtered or unexported fields
}

func (*StaticTopologyShardScheduler) Schedule

func (s *StaticTopologyShardScheduler) Schedule(ctx context.Context, clusterSnapshot metadata.Snapshot) (ScheduleResult, error)

Jump to

Keyboard shortcuts

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