manager

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidTopologyType = coderr.NewCodeError(coderr.InvalidParams, "invalid topology type")

Functions

This section is empty.

Types

type SchedulerManager

type SchedulerManager interface {
	ListScheduler() []scheduler.Scheduler

	Start(ctx context.Context) error

	Stop(ctx context.Context) error

	UpdateEnableSchedule(ctx context.Context, enableSchedule bool)

	// UpdateDeployMode can only be used in dynamic mode, it will throw error when topology type is static.
	// when deploy mode is true, shard topology will not be updated, it is usually used in scenarios such as cluster deploy.
	UpdateDeployMode(ctx context.Context, enable bool) error

	// GetDeployMode can only be used in dynamic mode, it will throw error when topology type is static.
	GetDeployMode(ctx context.Context) (bool, error)

	// AddShardAffinityRule adds a shard affinity rule to the manager, and then apply it to the underlying schedulers.
	AddShardAffinityRule(ctx context.Context, rule scheduler.ShardAffinityRule) error

	// Remove the shard rules applied to some specific rule.
	RemoveShardAffinityRule(ctx context.Context, shardID storage.ShardID) error

	// ListShardAffinityRules lists all the rules about shard affinity of all the registered schedulers.
	ListShardAffinityRules(ctx context.Context) (map[string]scheduler.ShardAffinityRule, error)

	// 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) []scheduler.ScheduleResult
}

SchedulerManager 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) SchedulerManager

Jump to

Keyboard shortcuts

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