Documentation ¶
Index ¶
- Constants
- Variables
- type BalanceLeaderCreateOption
- type BalanceRegionCreateOption
- type BaseScheduler
- func (s *BaseScheduler) Cleanup(cluster opt.Cluster)
- func (s *BaseScheduler) EncodeConfig() ([]byte, error)
- func (s *BaseScheduler) GetMinInterval() time.Duration
- func (s *BaseScheduler) GetNextInterval(interval time.Duration) time.Duration
- func (s *BaseScheduler) Prepare(cluster opt.Cluster) error
- func (s *BaseScheduler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type Influence
Constants ¶
const ( // AdjacentRegionName is balance adjacent region scheduler name. AdjacentRegionName = "balance-adjacent-region-scheduler" // AdjacentRegionType is balance adjacent region scheduler type. AdjacentRegionType = "adjacent-region" )
const ( // BalanceLeaderName is balance leader scheduler name. BalanceLeaderName = "balance-leader-scheduler" // BalanceLeaderType is balance leader scheduler type. BalanceLeaderType = "balance-leader" )
const ( // BalanceRegionName is balance region scheduler name. BalanceRegionName = "balance-region-scheduler" // BalanceRegionType is balance region scheduler type. BalanceRegionType = "balance-region" )
const ( MaxScheduleInterval = time.Second * 5 MinScheduleInterval = time.Millisecond * 10 MinSlowScheduleInterval = time.Second * 3 ScheduleIntervalFactor = 1.3 )
options for interval of schedulers
const ( // EvictLeaderName is evict leader scheduler name. EvictLeaderName = "evict-leader-scheduler" // EvictLeaderType is evict leader scheduler type. EvictLeaderType = "evict-leader" // EvictLeaderBatchSize is the number of operators to to transfer // leaders by one scheduling EvictLeaderBatchSize = 3 )
const ( // GrantLeaderName is grant leader scheduler name. GrantLeaderName = "grant-leader-scheduler" // GrantLeaderType is grant leader scheduler type. GrantLeaderType = "grant-leader" )
const ( // HotRegionName is balance hot region scheduler name. HotRegionName = "balance-hot-region-scheduler" // HotRegionType is balance hot region scheduler type. HotRegionType = "hot-region" // HotReadRegionType is hot read region scheduler type. HotReadRegionType = "hot-read-region" // HotWriteRegionType is hot write region scheduler type. HotWriteRegionType = "hot-write-region" )
const ( // LabelName is label scheduler name. LabelName = "label-scheduler" // LabelType is label scheduler type. LabelType = "label" )
const ( // RandomMergeName is random merge scheduler name. RandomMergeName = "random-merge-scheduler" // RandomMergeType is random merge scheduler type. RandomMergeType = "random-merge" )
const ( // ScatterRangeType is scatter range scheduler type ScatterRangeType = "scatter-range" // ScatterRangeName is scatter range scheduler name ScatterRangeName = "scatter-range" )
const ( // ShuffleHotRegionName is shuffle hot region scheduler name. ShuffleHotRegionName = "shuffle-hot-region-scheduler" // ShuffleHotRegionType is shuffle hot region scheduler type. ShuffleHotRegionType = "shuffle-hot-region" )
const ( // ShuffleLeaderName is shuffle leader scheduler name. ShuffleLeaderName = "shuffle-leader-scheduler" // ShuffleLeaderType is shuffle leader scheduler type. ShuffleLeaderType = "shuffle-leader" )
const ( // ShuffleRegionName is shuffle region scheduler name. ShuffleRegionName = "shuffle-region-scheduler" // ShuffleRegionType is shuffle region scheduler type. ShuffleRegionType = "shuffle-region" )
Variables ¶
var ( // ErrSchedulerExisted is error info for scheduler has already existed. ErrSchedulerExisted = errors.New("scheduler existed") // ErrSchedulerNotFound is error info for scheduler is not found. ErrSchedulerNotFound = errors.New("scheduler not found") // ErrScheduleConfigNotExist the config is not correct. ErrScheduleConfigNotExist = errors.New("the config does not exist") )
Functions ¶
This section is empty.
Types ¶
type BalanceLeaderCreateOption ¶
type BalanceLeaderCreateOption func(s *balanceLeaderScheduler)
BalanceLeaderCreateOption is used to create a scheduler with an option.
func WithBalanceLeaderCounter ¶
func WithBalanceLeaderCounter(counter *prometheus.CounterVec) BalanceLeaderCreateOption
WithBalanceLeaderCounter sets the counter for the scheduler.
func WithBalanceLeaderName ¶
func WithBalanceLeaderName(name string) BalanceLeaderCreateOption
WithBalanceLeaderName sets the name for the scheduler.
type BalanceRegionCreateOption ¶
type BalanceRegionCreateOption func(s *balanceRegionScheduler)
BalanceRegionCreateOption is used to create a scheduler with an option.
func WithBalanceRegionCounter ¶
func WithBalanceRegionCounter(counter *prometheus.CounterVec) BalanceRegionCreateOption
WithBalanceRegionCounter sets the counter for the scheduler.
func WithBalanceRegionName ¶
func WithBalanceRegionName(name string) BalanceRegionCreateOption
WithBalanceRegionName sets the name for the scheduler.
type BaseScheduler ¶
type BaseScheduler struct {
OpController *schedule.OperatorController
}
BaseScheduler is a basic scheduler for all other complex scheduler
func NewBaseScheduler ¶
func NewBaseScheduler(opController *schedule.OperatorController) *BaseScheduler
NewBaseScheduler returns a basic scheduler
func (*BaseScheduler) Cleanup ¶
func (s *BaseScheduler) Cleanup(cluster opt.Cluster)
Cleanup does some cleanup work
func (*BaseScheduler) EncodeConfig ¶
func (s *BaseScheduler) EncodeConfig() ([]byte, error)
EncodeConfig encode config for the scheduler
func (*BaseScheduler) GetMinInterval ¶
func (s *BaseScheduler) GetMinInterval() time.Duration
GetMinInterval returns the minimal interval for the scheduler
func (*BaseScheduler) GetNextInterval ¶
func (s *BaseScheduler) GetNextInterval(interval time.Duration) time.Duration
GetNextInterval return the next interval for the scheduler
func (*BaseScheduler) Prepare ¶
func (s *BaseScheduler) Prepare(cluster opt.Cluster) error
Prepare does some prepare work
func (*BaseScheduler) ServeHTTP ¶
func (s *BaseScheduler) ServeHTTP(w http.ResponseWriter, r *http.Request)