filter

package
v0.0.0-...-3a1a44b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

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.

func Source

func Source(opt opt.Options, store *core.StoreInfo, filters []Filter) bool

Source checks if store can pass all Filters as source store.

func Target

func Target(opt opt.Options, store *core.StoreInfo, filters []Filter) bool

Target checks if store can pass all Filters as target store.

Types

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 NewExcludedFilter

func NewExcludedFilter(scope string, sources, targets map[uint64]struct{}) Filter

NewExcludedFilter creates a Filter that filters all specified stores.

func NewHealthFilter

func NewHealthFilter(scope string) Filter

NewHealthFilter creates a Filter that filters all stores that are Busy or Down.

func NewStateFilter

func NewStateFilter(scope string) Filter

NewStateFilter creates a Filter that filters all stores that are not UP.

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

func (f StoreStateFilter) Source(opt opt.Options, store *core.StoreInfo) bool

Source returns true when the store cannot be selected as the schedule source.

func (StoreStateFilter) Target

func (f StoreStateFilter) Target(opts opt.Options, store *core.StoreInfo) bool

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.

Jump to

Keyboard shortcuts

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