Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster interface { GetRegion(id uint64) *core.RegionInfo GetStores() []*core.StoreInfo GetStore(id uint64) *core.StoreInfo GetRegionStores(region *core.RegionInfo) []*core.StoreInfo }
Cluster provides an overview of a cluster's region distribution.
type Config ¶
type Config struct {
Constraints []*Constraint
}
Config is consist of a list of constraints.
func ParseConfig ¶
ParseConfig parses a user configuration string.
type Constraint ¶
type Constraint struct { Function string // One of "count", "label_values", "count_leader", "isolation_level". Filters []Filter // "key:value" formed parameters. Labels []string // "key" formed parameters. Op string // One of "<", "<=", "=", ">=", ">". Value int // Expected expression evaluate value. }
Constraint represents a user-defined region placement rule. Each constraint is configured as an expression, for example 'count(zone:z1,rack:r1,host)>=3'.
func (Constraint) Score ¶
func (c Constraint) Score(region *core.RegionInfo, cluster Cluster) int
Score calculates the score of the constraint expression. The greater score is better. A nagative score means the constraint is not satisfied.
Click to show internal directories.
Click to hide internal directories.