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(rel *distributions.DistributedRelation, kRange *KeyRange, ...) (string, error)
- func KeyRangeBoundFromStrings(colTypes []string, vals []string) ([]interface{}, error)
- type BatchMoveKeyRange
- 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) InFuncSQL(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 RedistributeKeyRange
- 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(rel *distributions.DistributedRelation, kRange *KeyRange, upperBound KeyRangeBound, prefix string) (string, error)
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 BatchMoveKeyRange ¶
type BatchMoveKeyRange struct { KrId string // KrId is the source key range id ShardId string // ShardId is the destination shard id Limit int64 /* Limit is kr.RedistributeKeyLimit value specifying the number of keys to transfer. Can be either negative, in which case the whole key range will be moved, or non-negative, where circa specified amount of keys will be moved. */ BatchSize int // BatchSize is the amount of keys to be transferred in every transaction. DestKrId string /* DestKrId is the destination key range id. If the whole key range is being moved, it's still renamed. */ Type tasks.SplitType // Type is the tasks.SplitType value specifying if leftmost or rightmost portion of the key range will be moved }
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 BatchMoveKeyRange(ctx context.Context, req *BatchMoveKeyRange) error RedistributeKeyRange(ctx context.Context, req *RedistributeKeyRange) error RenameKeyRange(ctx context.Context, krId, krIdNew string) error }