scheduler

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

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, procedureExecutingBatchSize uint32) 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 ReopenShardScheduler added in v1.2.5

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

ReopenShardScheduler used to reopen shards in status PartitionOpen.

func NewReopenShardScheduler added in v1.2.5

func NewReopenShardScheduler(factory *coordinator.Factory, procedureExecutingBatchSize uint32) ReopenShardScheduler

func (ReopenShardScheduler) Schedule added in v1.2.5

func (r ReopenShardScheduler) 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, procedureExecutingBatchSize uint32) Scheduler

func NewRebalancedShardScheduler

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

func NewStaticTopologyShardScheduler

func NewStaticTopologyShardScheduler(factory *coordinator.Factory, nodePicker coordinator.NodePicker, procedureExecutingBatchSize uint32) 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