Documentation
¶
Overview ¶
Package partition implements a location system to find a shard or index rule. This system reflects the entity identity which is a intermediate result in calculating the target shard.
Index ¶
- Variables
- func GetTagByOffset(value []*modelv1.TagFamilyForWrite, fIndex, tIndex int) (*modelv1.TagValue, error)
- func ParseIndexRuleLocators(entity *databasev1.Entity, families []*databasev1.TagFamilySpec, ...) (locators IndexRuleLocator, fil FieldIndexLocation)
- func ShardID(key []byte, shardNum uint32) (uint, error)
- type FieldIndexLocation
- type FieldWithType
- type IndexRuleLocator
- type Locator
- type TagLocator
Constants ¶
This section is empty.
Variables ¶
var ErrMalformedElement = errors.New("element is malformed")
ErrMalformedElement indicates the element is malformed.
Functions ¶
func GetTagByOffset ¶
func GetTagByOffset(value []*modelv1.TagFamilyForWrite, fIndex, tIndex int) (*modelv1.TagValue, error)
GetTagByOffset gets a tag value based of a tag family offset and a tag offset in this family.
func ParseIndexRuleLocators ¶
func ParseIndexRuleLocators(entity *databasev1.Entity, families []*databasev1.TagFamilySpec, indexRules []*databasev1.IndexRule, indexMode bool, ) (locators IndexRuleLocator, fil FieldIndexLocation)
ParseIndexRuleLocators returns a IndexRuleLocator based on the tag family spec and index rules.
Types ¶
type FieldIndexLocation ¶ added in v0.7.0
type FieldIndexLocation map[string]map[string]FieldWithType
FieldIndexLocation is a helper struct to store the field index location.
type FieldWithType ¶ added in v0.7.0
FieldWithType is a helper struct to store the field type.
type IndexRuleLocator ¶
type IndexRuleLocator struct {
EntitySet map[string]int
TagFamilyTRule []map[string]*databasev1.IndexRule
}
IndexRuleLocator is a helper struct to locate the index rule by tag name.
type Locator ¶ added in v0.9.0
type Locator struct {
TagLocators []TagLocator
ModRevision int64
}
Locator combines several TagLocators that help find the entity or sharding key value.
func NewEntityLocator ¶
func NewEntityLocator(families []*databasev1.TagFamilySpec, entity *databasev1.Entity, modRevision int64) Locator
NewEntityLocator return a Locator based on tag family spec and entity spec.
func NewShardingKeyLocator ¶ added in v0.9.0
func NewShardingKeyLocator(families []*databasev1.TagFamilySpec, shardingKey *databasev1.ShardingKey) Locator
NewShardingKeyLocator returns a Locator based on tag family spec and sharding key spec.
type TagLocator ¶
TagLocator contains offsets to retrieve a tag swiftly.