Versions in this module Expand all Collapse all v0 v0.1.0 Jun 15, 2023 Changes in this version + func MatchLabelConstraints(store *core.StoreInfo, constraints []LabelConstraint) bool + func ValidateFit(fit *RegionFit) bool + func ValidateRegion(region *core.RegionInfo) bool + func ValidateStores(stores []*core.StoreInfo) bool + 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) MatchStore(store *core.StoreInfo) 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 RegionFit struct + OrphanPeers []*metapb.Peer + RuleFits []*RuleFit + func (f *RegionFit) GetRegionStores() []*core.StoreInfo + func (f *RegionFit) GetRuleFit(peerID uint64) *RuleFit + func (f *RegionFit) IsSatisfied() bool + func (f *RegionFit) Replace(srcStoreID uint64, dstStore *core.StoreInfo) bool + type RegionRuleFitCacheManager struct + func NewRegionRuleFitCacheManager() *RegionRuleFitCacheManager + func (manager *RegionRuleFitCacheManager) CheckAndGetCache(region *core.RegionInfo, rules []*Rule, stores []*core.StoreInfo) (bool, *RegionFit) + func (manager *RegionRuleFitCacheManager) Invalid(regionID uint64) + func (manager *RegionRuleFitCacheManager) SetCache(region *core.RegionInfo, fit *RegionFit) + type Rule struct + Count int + CreateTimestamp uint64 + EndKey []byte + EndKeyHex string + GroupID string + ID string + Index int + IsWitness bool + IsolationLevel string + LabelConstraints []LabelConstraint + LocationLabels []string + Override bool + Role PeerRoleType + StartKey []byte + StartKeyHex string + Version uint64 + func (r *Rule) Clone() *Rule + 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 + WitnessScore int + 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 endpoint.RuleStorage, storeSetInformer core.StoreSetInformer, ...) *RuleManager + func (m *RuleManager) Batch(todo []RuleOp) error + func (m *RuleManager) CheckIsCachedDirectly(regionID uint64) bool + 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) FitRegion(storeSet StoreSet, region *core.RegionInfo) (fit *RegionFit) + 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) GetRulesForApplyRange(start, end []byte) []*Rule + func (m *RuleManager) GetRulesForApplyRegion(region *core.RegionInfo) []*Rule + func (m *RuleManager) GetSplitKeys(start, end []byte) [][]byte + func (m *RuleManager) Initialize(maxReplica int, locationLabels []string) error + func (m *RuleManager) InvalidCache(regionID uint64) + func (m *RuleManager) IsInitialized() bool + func (m *RuleManager) IsRegionFitCached(storeSet StoreSet, region *core.RegionInfo) bool + func (m *RuleManager) SetAllGroupBundles(groups []GroupBundle, override bool) error + func (m *RuleManager) SetGroupBundle(group GroupBundle) error + func (m *RuleManager) SetKeyType(h string) *RuleManager + func (m *RuleManager) SetPlaceholderRegionFitCache(region *core.RegionInfo) + func (m *RuleManager) SetRegionFitCache(region *core.RegionInfo, fit *RegionFit) + 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 + type StoreSet interface + GetStore func(id uint64) *core.StoreInfo + GetStores func() []*core.StoreInfo