Documentation ¶
Index ¶
- Variables
- func CmpRangesEqual(bound KeyRangeBound, key KeyRangeBound, types []string) bool
- func CmpRangesLess(bound KeyRangeBound, key KeyRangeBound, types []string) bool
- func CmpRangesLessEqual(bound KeyRangeBound, key KeyRangeBound, types []string) bool
- func CmpRangesLessStringsDeprecated(bound string, key string) bool
- func GetKRCondition(ds *distributions.Distribution, rel *distributions.DistributedRelation, ...) string
- func KeyRangeBoundFromStrings(colTypes []string, vals []string) ([]interface{}, error)
- type KeyRange
- func KeyRangeFromBytes(val [][]byte, colTypes []string) *KeyRange
- func KeyRangeFromDB(krdb *qdb.KeyRange, colTypes []string) *KeyRange
- func KeyRangeFromProto(krproto *proto.KeyRangeInfo, colTypes []string) *KeyRange
- func KeyRangeFromSQL(krsql *spqrparser.KeyRangeDefinition, colTypes []string) (*KeyRange, error)
- func (kr *KeyRange) InFunc(attribInd int, raw []byte)
- func (kr *KeyRange) OutFunc(attribInd int) []byte
- func (kr *KeyRange) Raw() [][]byte
- func (kr *KeyRange) RecvFunc(attribInd int, val string) error
- func (kr *KeyRange) RecvRaw(vals []string) error
- func (kr *KeyRange) SendFunc(attribInd int) string
- func (kr *KeyRange) SendRaw() []string
- func (kr *KeyRange) ToDB() *qdb.KeyRange
- func (kr *KeyRange) ToProto() *proto.KeyRangeInfo
- type KeyRangeBound
- type KeyRangeMgr
- type MoveKeyRange
- type ShardKey
- type SplitKeyRange
- type UniteKeyRange
Constants ¶
This section is empty.
Variables ¶
var MissTypedKeyRange = fmt.Errorf("key range bound is mistyped")
TODO: use it
Functions ¶
func CmpRangesEqual ¶
func CmpRangesEqual(bound KeyRangeBound, key KeyRangeBound, types []string) bool
func CmpRangesLess ¶
func CmpRangesLess(bound KeyRangeBound, key KeyRangeBound, types []string) bool
CmpRangesLess compares two byte slices, kr and other, and returns true if kr is less than other. The comparison is based on the length of the slices and the lexicographic order of their string representations.
Parameters:
- kr: The first byte slice to compare.
- other: The second byte slice to compare.
Returns:
- bool: True if kr is less than other, false otherwise.
TODO : unit tests
func CmpRangesLessEqual ¶
func CmpRangesLessEqual(bound KeyRangeBound, key KeyRangeBound, types []string) bool
func GetKRCondition ¶
func GetKRCondition(ds *distributions.Distribution, rel *distributions.DistributedRelation, kRange *KeyRange, upperBound KeyRangeBound, prefix string) string
GetKRCondition returns SQL condition for elements of distributed relation between two key ranges TODO support multidimensional key ranges
Parameters:
- ds: The distribution object.
- rel: The distributed relation object.
- kRange: The key range object.
- upperBound: The upper bound of the key range.
- prefix: The prefix to use for the column names.
Returns:
- string: The SQL condition for the key range.
Types ¶
type KeyRange ¶
type KeyRange struct { LowerBound KeyRangeBound ShardID string ID string Distribution string ColumnTypes []string }
qdb KeyRange with its distibtion column types stored in case struct for fast convertion/access
func KeyRangeFromBytes ¶
func KeyRangeFromDB ¶
KeyRangeFromDB converts a qdb.KeyRange object to a KeyRange object. It creates a new KeyRange object with the values from the qdb.KeyRange object. It returns a pointer to the new KeyRange object.
Parameters:
- kr: The qdb.KeyRange object to convert.
Returns:
- *KeyRange: A pointer to the new KeyRange object.
TODO : unit tests
func KeyRangeFromProto ¶
func KeyRangeFromProto(krproto *proto.KeyRangeInfo, colTypes []string) *KeyRange
KeyRangeFromProto converts a protobuf KeyRangeInfo to a KeyRange object. If the input KeyRangeInfo is nil, it returns nil. Otherwise, it creates a new KeyRange object with the values from the KeyRangeInfo object and returns a pointer to it.
Parameters:
- kr: The protobuf KeyRangeInfo to convert.
- colTypes: the column types list
Returns:
- *KeyRange: A pointer to the new KeyRange object.
TODO : unit tests
func KeyRangeFromSQL ¶
func KeyRangeFromSQL(krsql *spqrparser.KeyRangeDefinition, colTypes []string) (*KeyRange, error)
KeyRangeFromSQL converts a spqrparser.KeyRangeDefinition into a KeyRange. If kr is nil, it returns nil. Otherwise, it creates a new KeyRange with the provided values and returns a pointer to it.
Parameters:
- kr: The spqrparser.KeyRangeDefinition to convert.
Returns:
- *KeyRange: A pointer to the new KeyRange object.
TODO : unit tests
func (*KeyRange) ToDB ¶
ToDB converts the KeyRange struct to a qdb.KeyRange struct. It returns a pointer to the converted qdb.KeyRange struct.
Returns:
- *qdb.KeyRange: A pointer to the converted qdb.KeyRange struct.
TODO : unit tests
func (*KeyRange) ToProto ¶
func (kr *KeyRange) ToProto() *proto.KeyRangeInfo
ToProto converts the KeyRange struct to a protobuf KeyRangeInfo message. It returns a pointer to the converted KeyRangeInfo message.
Returns:
- *proto.KeyRangeInfo: A pointer to the converted KeyRangeInfo message.
TODO : unit tests
type KeyRangeBound ¶
type KeyRangeBound []interface{}
type KeyRangeMgr ¶
type KeyRangeMgr interface { GetKeyRange(ctx context.Context, krId string) (*KeyRange, error) ListKeyRanges(ctx context.Context, distribution string) ([]*KeyRange, error) ListAllKeyRanges(ctx context.Context) ([]*KeyRange, error) CreateKeyRange(ctx context.Context, kr *KeyRange) error LockKeyRange(ctx context.Context, krid string) (*KeyRange, error) UnlockKeyRange(ctx context.Context, krid string) error Split(ctx context.Context, split *SplitKeyRange) error Unite(ctx context.Context, unite *UniteKeyRange) error Move(ctx context.Context, move *MoveKeyRange) error DropKeyRange(ctx context.Context, krid string) error DropKeyRangeAll(ctx context.Context) error }