Versions in this module Expand all Collapse all v0 v0.1.0 Mar 12, 2021 Changes in this version + func CompareResourceFit(a, b *ResourceFit) int + func MatchLabelConstraints(container *core.CachedContainer, constraints []LabelConstraint) bool + type ContainerSet interface + GetContainer func(id uint64) *core.CachedContainer + GetContainers func() []*core.CachedContainer + type GroupBundle struct + ID string + Index int + Override bool + Rules []*Rule + func (g GroupBundle) String() string + type LabelConstraint struct + Key string + Op LabelConstraintOp + Values []string + func (c *LabelConstraint) MatchContainer(container *core.CachedContainer) bool + type LabelConstraintOp string + const Exists + const In + const NotExists + const NotIn + type PeerRoleType string + const Follower + const Leader + const Learner + const Voter + func (s PeerRoleType) MetaPeerRole() metapb.PeerRole + type ResourceFit struct + OrphanPeers []metapb.Peer + RuleFits []*RuleFit + func FitResource(containers ContainerSet, res *core.CachedResource, rules []*Rule) *ResourceFit + func (f *ResourceFit) GetRuleFit(peerID uint64) *RuleFit + func (f *ResourceFit) IsSatisfied() bool + type Rule struct + Count int + EndKey []byte + EndKeyHex string + GroupID string + ID string + Index int + IsolationLevel string + LabelConstraints []LabelConstraint + LocationLabels []string + Override bool + Role PeerRoleType + StartKey []byte + StartKeyHex string + func (r *Rule) Key() [2]string + func (r *Rule) StoreKey() string + func (r *Rule) String() string + type RuleFit struct + IsolationScore float64 + Peers []metapb.Peer + PeersWithDifferentRole []metapb.Peer + Rule *Rule + func (f *RuleFit) IsSatisfied() bool + type RuleGroup struct + ID string + Index int + Override bool + func (g *RuleGroup) String() string + type RuleManager struct + func NewRuleManager(storage storage.Storage) *RuleManager + func (m *RuleManager) Batch(todo []RuleOp) error + func (m *RuleManager) DeleteGroupBundle(id string, regex bool) error + func (m *RuleManager) DeleteRule(group, id string) error + func (m *RuleManager) DeleteRuleGroup(id string) error + func (m *RuleManager) FitResource(containers ContainerSet, res *core.CachedResource) *ResourceFit + func (m *RuleManager) GetAllGroupBundles() []GroupBundle + func (m *RuleManager) GetAllRules() []*Rule + func (m *RuleManager) GetGroupBundle(id string) (b GroupBundle) + func (m *RuleManager) GetRule(group, id string) *Rule + func (m *RuleManager) GetRuleGroup(id string) *RuleGroup + func (m *RuleManager) GetRuleGroups() []*RuleGroup + func (m *RuleManager) GetRulesByGroup(group string) []*Rule + func (m *RuleManager) GetRulesByKey(key []byte) []*Rule + func (m *RuleManager) GetRulesForApplyResource(res *core.CachedResource) []*Rule + func (m *RuleManager) GetSplitKeys(start, end []byte) [][]byte + func (m *RuleManager) Initialize(maxReplica int, locationLabels []string) error + func (m *RuleManager) IsInitialized() bool + func (m *RuleManager) SetAllGroupBundles(groups []GroupBundle, override bool) error + func (m *RuleManager) SetGroupBundle(group GroupBundle) error + func (m *RuleManager) SetRule(rule *Rule) error + func (m *RuleManager) SetRuleGroup(group *RuleGroup) error + func (m *RuleManager) SetRules(rules []*Rule) error + type RuleOp struct + Action RuleOpType + DeleteByIDPrefix bool + func (r RuleOp) String() string + type RuleOpType string + const RuleOpAdd + const RuleOpDel