Documentation ¶
Index ¶
- func SelectSourceStores(stores []*core.StoreInfo, filters []Filter, opt opt.Options) []*core.StoreInfo
- func SelectTargetStores(stores []*core.StoreInfo, filters []Filter, opt opt.Options) []*core.StoreInfo
- func Source(opt opt.Options, store *core.StoreInfo, filters []Filter) bool
- func Target(opt opt.Options, store *core.StoreInfo, filters []Filter) bool
- type BlacklistStoreFilter
- func (f *BlacklistStoreFilter) Add(storeID uint64)
- func (f *BlacklistStoreFilter) Scope() string
- func (f *BlacklistStoreFilter) Source(opt opt.Options, store *core.StoreInfo) bool
- func (f *BlacklistStoreFilter) Target(opt opt.Options, store *core.StoreInfo) bool
- func (f *BlacklistStoreFilter) Type() string
- type BlacklistType
- type Filter
- func NewCacheFilter(scope string, cache *cache.TTLUint64) Filter
- func NewDistinctScoreFilter(scope string, labels []string, stores []*core.StoreInfo, ...) Filter
- func NewExcludedFilter(scope string, sources, targets map[uint64]struct{}) Filter
- func NewHealthFilter(scope string) Filter
- func NewLabelConstaintFilter(scope string, constraints []placement.LabelConstraint) Filter
- func NewPendingPeerCountFilter(scope string) Filter
- func NewRuleFitFilter(scope string, fitter RegionFitter, region *core.RegionInfo, oldStoreID uint64) Filter
- func NewSnapshotCountFilter(scope string) Filter
- func NewStateFilter(scope string) Filter
- func NewStorageThresholdFilter(scope string) Filter
- func NewStoreLimitFilter(scope string) Filter
- type RegionFitter
- type StoreStateFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SelectSourceStores ¶
func SelectSourceStores(stores []*core.StoreInfo, filters []Filter, opt opt.Options) []*core.StoreInfo
SelectSourceStores selects stores that be selected as source store from the list.
func SelectTargetStores ¶
func SelectTargetStores(stores []*core.StoreInfo, filters []Filter, opt opt.Options) []*core.StoreInfo
SelectTargetStores selects stores that be selected as target store from the list.
Types ¶
type BlacklistStoreFilter ¶
type BlacklistStoreFilter struct {
// contains filtered or unexported fields
}
BlacklistStoreFilter filters the store according to the blacklist.
func NewBlacklistStoreFilter ¶
func NewBlacklistStoreFilter(scope string, typ BlacklistType) *BlacklistStoreFilter
NewBlacklistStoreFilter creates a blacklist filter.
func (*BlacklistStoreFilter) Add ¶
func (f *BlacklistStoreFilter) Add(storeID uint64)
Add adds the store to the blacklist.
func (*BlacklistStoreFilter) Scope ¶
func (f *BlacklistStoreFilter) Scope() string
Scope returns the scheduler or the checker which the filter acts on.
func (*BlacklistStoreFilter) Type ¶
func (f *BlacklistStoreFilter) Type() string
Type implements the Filter.
type BlacklistType ¶
type BlacklistType int
BlacklistType the type of BlackListStore Filter.
const ( // blacklist associated with the source. BlacklistSource BlacklistType = 1 << iota // blacklist associated with the target. BlacklistTarget )
some flags about blacklist type.
type Filter ¶
type Filter interface { // Scope is used to indicate where the filter will act on. Scope() string Type() string // Return true if the store should not be used as a source store. Source(opt opt.Options, store *core.StoreInfo) bool // Return true if the store should not be used as a target store. Target(opt opt.Options, store *core.StoreInfo) bool }
Filter is an interface to filter source and target store.
func NewCacheFilter ¶
NewCacheFilter creates a Filter that filters all stores that are in the cache.
func NewDistinctScoreFilter ¶
func NewDistinctScoreFilter(scope string, labels []string, stores []*core.StoreInfo, source *core.StoreInfo) Filter
NewDistinctScoreFilter creates a filter that filters all stores that have lower distinct score than specified store.
func NewExcludedFilter ¶
NewExcludedFilter creates a Filter that filters all specified stores.
func NewHealthFilter ¶
NewHealthFilter creates a Filter that filters all stores that are Busy or Down.
func NewLabelConstaintFilter ¶
func NewLabelConstaintFilter(scope string, constraints []placement.LabelConstraint) Filter
NewLabelConstaintFilter creates a filter that selects stores satisfy the constraints.
func NewPendingPeerCountFilter ¶
NewPendingPeerCountFilter creates a Filter that filters all stores that are currently handling too many pending peers.
func NewRuleFitFilter ¶
func NewRuleFitFilter(scope string, fitter RegionFitter, region *core.RegionInfo, oldStoreID uint64) Filter
NewRuleFitFilter creates a filter that ensures after replace a peer with new one, the isolation level will not decrease. Its function is the same as distinctScoreFilter but used when placement rules is enabled.
func NewSnapshotCountFilter ¶
NewSnapshotCountFilter creates a Filter that filters all stores that are currently handling too many snapshots.
func NewStateFilter ¶
NewStateFilter creates a Filter that filters all stores that are not UP.
func NewStorageThresholdFilter ¶
NewStorageThresholdFilter creates a Filter that filters all stores that are almost full.
func NewStoreLimitFilter ¶
NewStoreLimitFilter creates a Filter that filters all stores those exceed the limit of a store.
type RegionFitter ¶
type RegionFitter interface {
FitRegion(*core.RegionInfo) *placement.RegionFit
}
RegionFitter is the interface that can fit a region against placement rules.
type StoreStateFilter ¶
type StoreStateFilter struct { ActionScope string // Set true if the schedule involves any transfer leader operation. TransferLeader bool // Set true if the schedule involves any move region operation. MoveRegion bool }
StoreStateFilter is used to determine whether a store can be selected as the source or target of the schedule based on the store's state.
func (StoreStateFilter) Scope ¶
func (f StoreStateFilter) Scope() string
Scope returns the scheduler or the checker which the filter acts on.
func (StoreStateFilter) Source ¶
Source returns true when the store cannot be selected as the schedule source.
func (StoreStateFilter) Target ¶
Target returns true when the store cannot be selected as the schedule target.
func (StoreStateFilter) Type ¶
func (f StoreStateFilter) Type() string
Type returns the type of the Filter.