Documentation ¶
Index ¶
Constants ¶
View Source
const ( // RuleIndexDefault is the default index for a rule. RuleIndexDefault int = iota // RuleIndexDatabase is the index for a rule of database. RuleIndexDatabase // RuleIndexTable is the index for a rule of table. RuleIndexTable // RuleIndexPartition is the index for a rule of partition. RuleIndexPartition )
View Source
const (
// IDPrefix is the prefix for label rule ID.
IDPrefix = "schema"
)
Variables ¶
View Source
var ( // TableIDFormat is the format of the label rule ID for a table. // The format follows "schema/database_name/table_name". TableIDFormat = "%s/%s/%s" // PartitionIDFormat is the format of the label rule ID for a partition. // The format follows "schema/database_name/table_name/partition_name". PartitionIDFormat = "%s/%s/%s/%s" )
View Source
var ( // ErrInvalidAttributesFormat is from attributes.go ErrInvalidAttributesFormat = errors.New("attributes should be in format 'key=value'") )
Functions ¶
This section is empty.
Types ¶
type AttributesCompatibility ¶
type AttributesCompatibility byte
AttributesCompatibility is the return type of CompatibleWith.
const ( // AttributesCompatible indicates two attributes are compatible. AttributesCompatible AttributesCompatibility = iota // AttributesIncompatible indicates two attributes are incompatible. AttributesIncompatible // AttributesDuplicated indicates two attributes are duplicated. AttributesDuplicated )
type Label ¶
Label is used to describe attributes
func (*Label) CompatibleWith ¶
func (l *Label) CompatibleWith(o *Label) AttributesCompatibility
CompatibleWith will check if two constraints are compatible. Return (compatible, duplicated).
type Labels ¶
type Labels []Label
Labels is a slice of Label.
type Rule ¶
type Rule struct { ID string `json:"id"` Index int `json:"index"` Labels Labels `json:"labels"` RuleType string `json:"rule_type"` Data []interface{} `json:"data"` }
Rule is used to establish the relationship between labels and a key range.
func (*Rule) ApplyAttributesSpec ¶
func (r *Rule) ApplyAttributesSpec(spec *ast.AttributesSpec) error
ApplyAttributesSpec will transfer attributes defined in AttributesSpec to the labels.
type RulePatch ¶
RulePatch is the patch to update the label rules.
func NewRulePatch ¶
NewRulePatch returns a patch of rules which need to be set or deleted.
Click to show internal directories.
Click to hide internal directories.