Documentation ¶
Index ¶
- Constants
- Variables
- func ExecuteCommands(saver func() error, commands ...Command) error
- type BalancerTask
- type Command
- type CustomCommand
- type DataTransferTransaction
- type DeleteCommand
- type DistributedRelation
- type DistributedXactKepper
- type Distribution
- type DistributionKeyEntry
- type DropCommand
- type EtcdQDB
- func (q *EtcdQDB) AddRouter(ctx context.Context, r *Router) error
- func (q *EtcdQDB) AddShard(ctx context.Context, shard *Shard) error
- func (q *EtcdQDB) AlterDistributionAttach(ctx context.Context, id string, rels []*DistributedRelation) error
- func (q *EtcdQDB) AlterDistributionDetach(ctx context.Context, id string, relName string) error
- func (q *EtcdQDB) CheckLockedKeyRange(ctx context.Context, id string) (*KeyRange, error)
- func (q *EtcdQDB) Client() *clientv3.Client
- func (q *EtcdQDB) CloseRouter(ctx context.Context, id string) error
- func (q *EtcdQDB) CreateDistribution(ctx context.Context, distribution *Distribution) error
- func (q *EtcdQDB) CreateKeyRange(ctx context.Context, keyRange *KeyRange) error
- func (q *EtcdQDB) DeleteKeyRangeMove(ctx context.Context, moveId string) error
- func (q *EtcdQDB) DeleteRouter(ctx context.Context, id string) error
- func (q *EtcdQDB) DropDistribution(ctx context.Context, id string) error
- func (q *EtcdQDB) DropKeyRange(ctx context.Context, id string) error
- func (q *EtcdQDB) DropKeyRangeAll(ctx context.Context) error
- func (q *EtcdQDB) DropShard(ctx context.Context, id string) error
- func (q *EtcdQDB) GetBalancerTask(ctx context.Context) (*BalancerTask, error)
- func (q *EtcdQDB) GetCoordinator(ctx context.Context) (string, error)
- func (q *EtcdQDB) GetDistribution(ctx context.Context, id string) (*Distribution, error)
- func (q *EtcdQDB) GetKeyRange(ctx context.Context, id string) (*KeyRange, error)
- func (q *EtcdQDB) GetMoveTaskGroup(ctx context.Context) (*MoveTaskGroup, error)
- func (q *EtcdQDB) GetRedistributeTask(ctx context.Context) (*RedistributeTask, error)
- func (q *EtcdQDB) GetRelationDistribution(ctx context.Context, relName string) (*Distribution, error)
- func (q *EtcdQDB) GetShard(ctx context.Context, id string) (*Shard, error)
- func (q *EtcdQDB) GetTransferTx(ctx context.Context, key string) (*DataTransferTransaction, error)
- func (q *EtcdQDB) ListAllKeyRanges(ctx context.Context) ([]*KeyRange, error)
- func (q *EtcdQDB) ListDistributions(ctx context.Context) ([]*Distribution, error)
- func (q *EtcdQDB) ListKeyRangeMoves(ctx context.Context) ([]*MoveKeyRange, error)
- func (q *EtcdQDB) ListKeyRanges(ctx context.Context, distribution string) ([]*KeyRange, error)
- func (q *EtcdQDB) ListRouters(ctx context.Context) ([]*Router, error)
- func (q *EtcdQDB) ListShards(ctx context.Context) ([]*Shard, error)
- func (q *EtcdQDB) LockKeyRange(ctx context.Context, id string) (*KeyRange, error)
- func (q *EtcdQDB) OpenRouter(ctx context.Context, id string) error
- func (q *EtcdQDB) RecordKeyRangeMove(ctx context.Context, m *MoveKeyRange) error
- func (q *EtcdQDB) RecordTransferTx(ctx context.Context, key string, info *DataTransferTransaction) error
- func (q *EtcdQDB) RemoveBalancerTask(ctx context.Context) error
- func (q *EtcdQDB) RemoveMoveTaskGroup(ctx context.Context) error
- func (q *EtcdQDB) RemoveRedistributeTask(ctx context.Context) error
- func (q *EtcdQDB) RemoveTransferTx(ctx context.Context, key string) error
- func (q *EtcdQDB) RenameKeyRange(ctx context.Context, krId, krIdNew string) error
- func (q *EtcdQDB) ShareKeyRange(id string) error
- func (q *EtcdQDB) TryCoordinatorLock(ctx context.Context) error
- func (q *EtcdQDB) UnlockKeyRange(ctx context.Context, id string) error
- func (q *EtcdQDB) UpdateCoordinator(ctx context.Context, address string) error
- func (q *EtcdQDB) UpdateKeyRange(ctx context.Context, keyRange *KeyRange) error
- func (q *EtcdQDB) UpdateKeyRangeMoveStatus(ctx context.Context, moveId string, s MoveKeyRangeStatus) error
- func (q *EtcdQDB) WriteBalancerTask(ctx context.Context, task *BalancerTask) error
- func (q *EtcdQDB) WriteMoveTaskGroup(ctx context.Context, group *MoveTaskGroup) error
- func (q *EtcdQDB) WriteRedistributeTask(ctx context.Context, task *RedistributeTask) error
- type KeyRange
- type KeyRangeStatus
- type MemQDB
- func (q *MemQDB) AddRouter(_ context.Context, r *Router) error
- func (q *MemQDB) AddShard(_ context.Context, shard *Shard) error
- func (q *MemQDB) AlterDistributionAttach(_ context.Context, id string, rels []*DistributedRelation) error
- func (q *MemQDB) AlterDistributionDetach(_ context.Context, id string, relName string) error
- func (q *MemQDB) CheckLockedKeyRange(ctx context.Context, id string) (*KeyRange, error)
- func (q *MemQDB) CloseRouter(_ context.Context, id string) error
- func (q *MemQDB) CreateDistribution(_ context.Context, distribution *Distribution) error
- func (q *MemQDB) CreateKeyRange(_ context.Context, keyRange *KeyRange) error
- func (q *MemQDB) DeleteKeyRangeMove(ctx context.Context, moveId string) error
- func (q *MemQDB) DeleteRouter(_ context.Context, id string) error
- func (q *MemQDB) DropDistribution(_ context.Context, id string) error
- func (q *MemQDB) DropKeyRange(_ context.Context, id string) error
- func (q *MemQDB) DropKeyRangeAll(_ context.Context) error
- func (q *MemQDB) DropShard(_ context.Context, id string) error
- func (q *MemQDB) DumpState() error
- func (q *MemQDB) GetBalancerTask(_ context.Context) (*BalancerTask, error)
- func (q *MemQDB) GetCoordinator(ctx context.Context) (string, error)
- func (q *MemQDB) GetDistribution(_ context.Context, id string) (*Distribution, error)
- func (q *MemQDB) GetKeyRange(_ context.Context, id string) (*KeyRange, error)
- func (q *MemQDB) GetMoveTaskGroup(_ context.Context) (*MoveTaskGroup, error)
- func (q *MemQDB) GetRedistributeTask(_ context.Context) (*RedistributeTask, error)
- func (q *MemQDB) GetRelationDistribution(_ context.Context, relation string) (*Distribution, error)
- func (q *MemQDB) GetShard(_ context.Context, id string) (*Shard, error)
- func (q *MemQDB) GetTransferTx(_ context.Context, key string) (*DataTransferTransaction, error)
- func (q *MemQDB) ListAllKeyRanges(_ context.Context) ([]*KeyRange, error)
- func (q *MemQDB) ListDistributions(_ context.Context) ([]*Distribution, error)
- func (q *MemQDB) ListKeyRangeMoves(ctx context.Context) ([]*MoveKeyRange, error)
- func (q *MemQDB) ListKeyRanges(_ context.Context, distribution string) ([]*KeyRange, error)
- func (q *MemQDB) ListRouters(_ context.Context) ([]*Router, error)
- func (q *MemQDB) ListShards(_ context.Context) ([]*Shard, error)
- func (q *MemQDB) LockKeyRange(_ context.Context, id string) (*KeyRange, error)
- func (q *MemQDB) OpenRouter(_ context.Context, id string) error
- func (q *MemQDB) RecordKeyRangeMove(ctx context.Context, m *MoveKeyRange) error
- func (q *MemQDB) RecordTransferTx(_ context.Context, key string, info *DataTransferTransaction) error
- func (q *MemQDB) RemoveBalancerTask(_ context.Context) error
- func (q *MemQDB) RemoveMoveTaskGroup(_ context.Context) error
- func (q *MemQDB) RemoveRedistributeTask(_ context.Context) error
- func (q *MemQDB) RemoveTransferTx(_ context.Context, key string) error
- func (q *MemQDB) RenameKeyRange(_ context.Context, krId, krIdNew string) error
- func (q *MemQDB) ShareKeyRange(id string) error
- func (q *MemQDB) TryCoordinatorLock(_ context.Context) error
- func (q *MemQDB) TryLockKeyRange(lock *sync.RWMutex, id string, read bool) error
- func (q *MemQDB) UnlockKeyRange(_ context.Context, id string) error
- func (q *MemQDB) UpdateCoordinator(_ context.Context, address string) error
- func (q *MemQDB) UpdateKeyRange(_ context.Context, keyRange *KeyRange) error
- func (q *MemQDB) UpdateKeyRangeMoveStatus(ctx context.Context, moveId string, s MoveKeyRangeStatus) error
- func (q *MemQDB) WriteBalancerTask(_ context.Context, task *BalancerTask) error
- func (q *MemQDB) WriteMoveTaskGroup(_ context.Context, group *MoveTaskGroup) error
- func (q *MemQDB) WriteRedistributeTask(_ context.Context, task *RedistributeTask) error
- type MoveKeyRange
- type MoveKeyRangeStatus
- type MoveTask
- type MoveTaskGroup
- type QDB
- type RedistributeTask
- type Router
- type RouterState
- type Shard
- type ShardKey
- type ShardingSchemaKeeper
- type TopolodyKeeper
- type TxStatus
- type UpdateCommand
- type XQDB
Constants ¶
const ( MoveKeyRangePlanned = MoveKeyRangeStatus("PLANNED") MoveKeyRangeStarted = MoveKeyRangeStatus("STARTED") MoveKeyRangeComplete = MoveKeyRangeStatus("COMPLETE") )
const ( CLOSED = RouterState("CLOSED") OPENED = RouterState("OPENED") )
const ( Planned = TxStatus("planned") DataCopied = TxStatus("data_copied") )
const (
CoordKeepAliveTtl = 3
)
const KRLocked = KeyRangeStatus("LOCKED")
const KRUnLocked = KeyRangeStatus("UNLOCKED")
Variables ¶
var ( ColumnTypeVarchar = "varchar" ColumnTypeVarcharHashed = "varchar hashed" ColumnTypeVarcharDeprecated = "_varchar" ColumnTypeInteger = "integer" ColumnTypeUinteger = "uinteger" )
Functions ¶
func ExecuteCommands ¶
Types ¶
type BalancerTask ¶
type CustomCommand ¶
type CustomCommand struct {
// contains filtered or unexported fields
}
func NewCustomCommand ¶
func NewCustomCommand(do func() error, undo func() error) *CustomCommand
func (*CustomCommand) Do ¶
func (c *CustomCommand) Do() error
func (*CustomCommand) Undo ¶
func (c *CustomCommand) Undo() error
type DataTransferTransaction ¶
type DataTransferTransaction struct { ToShardId string `json:"to_shard"` FromShardId string `json:"from_shard"` Status TxStatus `json:"status"` }
DataTransferTransaction contains information about data transfer from one shard to another
type DeleteCommand ¶
type DeleteCommand[T any] struct { // contains filtered or unexported fields }
func NewDeleteCommand ¶
func NewDeleteCommand[T any](m map[string]T, key string) *DeleteCommand[T]
func (*DeleteCommand[T]) Do ¶
func (c *DeleteCommand[T]) Do() error
func (*DeleteCommand[T]) Undo ¶
func (c *DeleteCommand[T]) Undo() error
type DistributedRelation ¶
type DistributedRelation struct { Name string `json:"name"` DistributionKey []DistributionKeyEntry `json:"column_names"` ReplicatedRelation bool `json:"replicated_relation,omitempty"` }
type DistributedXactKepper ¶
type DistributedXactKepper interface { RecordTransferTx(ctx context.Context, key string, info *DataTransferTransaction) error GetTransferTx(ctx context.Context, key string) (*DataTransferTransaction, error) RemoveTransferTx(ctx context.Context, key string) error }
Keep track of the status of the two-phase data move transaction.
type Distribution ¶
type Distribution struct { ID string `json:"id"` ColTypes []string `json:"col_types,omitempty"` Relations map[string]*DistributedRelation `json:"relations"` }
func NewDistribution ¶
func NewDistribution(id string, coltypes []string) *Distribution
type DistributionKeyEntry ¶
type DropCommand ¶
type DropCommand[T any] struct { // contains filtered or unexported fields }
func NewDropCommand ¶
func NewDropCommand[T any](m map[string]T) *DropCommand[T]
func (*DropCommand[T]) Do ¶
func (c *DropCommand[T]) Do() error
func (*DropCommand[T]) Undo ¶
func (c *DropCommand[T]) Undo() error
type EtcdQDB ¶
type EtcdQDB struct {
// contains filtered or unexported fields
}
func NewEtcdQDB ¶
func (*EtcdQDB) AlterDistributionAttach ¶
func (q *EtcdQDB) AlterDistributionAttach(ctx context.Context, id string, rels []*DistributedRelation) error
TODO : unit tests
func (*EtcdQDB) AlterDistributionDetach ¶
TODO: unit tests
func (*EtcdQDB) CheckLockedKeyRange ¶
TODO : unit tests
func (*EtcdQDB) CloseRouter ¶
TODO : unit tests
func (*EtcdQDB) CreateDistribution ¶
func (q *EtcdQDB) CreateDistribution(ctx context.Context, distribution *Distribution) error
TODO : unit tests
func (*EtcdQDB) CreateKeyRange ¶
TODO : unit tests
func (*EtcdQDB) DeleteKeyRangeMove ¶
func (*EtcdQDB) DeleteRouter ¶
TODO : unit tests
func (*EtcdQDB) DropDistribution ¶
TODO : unit tests
func (*EtcdQDB) DropKeyRange ¶
TODO : unit tests
func (*EtcdQDB) DropKeyRangeAll ¶
TODO : unit tests
func (*EtcdQDB) GetBalancerTask ¶
func (q *EtcdQDB) GetBalancerTask(ctx context.Context) (*BalancerTask, error)
TODO: unit tests
func (*EtcdQDB) GetCoordinator ¶
TODO : unit tests
func (*EtcdQDB) GetDistribution ¶
TODO : unit tests
func (*EtcdQDB) GetKeyRange ¶
TODO : unit tests
func (*EtcdQDB) GetMoveTaskGroup ¶
func (q *EtcdQDB) GetMoveTaskGroup(ctx context.Context) (*MoveTaskGroup, error)
TODO: unit tests
func (*EtcdQDB) GetRedistributeTask ¶
func (q *EtcdQDB) GetRedistributeTask(ctx context.Context) (*RedistributeTask, error)
TODO: unit tests
func (*EtcdQDB) GetRelationDistribution ¶
func (q *EtcdQDB) GetRelationDistribution(ctx context.Context, relName string) (*Distribution, error)
TODO : unit tests
func (*EtcdQDB) GetTransferTx ¶
TODO : unit tests
func (*EtcdQDB) ListAllKeyRanges ¶
TODO : unit tests
func (*EtcdQDB) ListDistributions ¶
func (q *EtcdQDB) ListDistributions(ctx context.Context) ([]*Distribution, error)
TODO : unit tests
func (*EtcdQDB) ListKeyRangeMoves ¶
func (q *EtcdQDB) ListKeyRangeMoves(ctx context.Context) ([]*MoveKeyRange, error)
TODO : unit tests
func (*EtcdQDB) ListKeyRanges ¶
TODO : unit tests
func (*EtcdQDB) ListRouters ¶
TODO : unit tests
func (*EtcdQDB) ListShards ¶
TODO : unit tests
func (*EtcdQDB) LockKeyRange ¶
TODO : unit tests
func (*EtcdQDB) OpenRouter ¶
TODO : unit tests
func (*EtcdQDB) RecordKeyRangeMove ¶
func (q *EtcdQDB) RecordKeyRangeMove(ctx context.Context, m *MoveKeyRange) error
TODO : unit tests
func (*EtcdQDB) RecordTransferTx ¶
func (q *EtcdQDB) RecordTransferTx(ctx context.Context, key string, info *DataTransferTransaction) error
TODO : unit tests
func (*EtcdQDB) RemoveBalancerTask ¶
TODO: unit tests
func (*EtcdQDB) RemoveMoveTaskGroup ¶
TODO: unit tests
func (*EtcdQDB) RemoveRedistributeTask ¶
TODO: unit tests
func (*EtcdQDB) RemoveTransferTx ¶
TODO : unit tests
func (*EtcdQDB) RenameKeyRange ¶
TODO: unit tests
func (*EtcdQDB) TryCoordinatorLock ¶
TODO : unit tests
func (*EtcdQDB) UnlockKeyRange ¶
TODO : unit tests
func (*EtcdQDB) UpdateCoordinator ¶
TODO : unit tests TODO : implement
func (*EtcdQDB) UpdateKeyRange ¶
TODO : unit tests
func (*EtcdQDB) UpdateKeyRangeMoveStatus ¶
func (q *EtcdQDB) UpdateKeyRangeMoveStatus(ctx context.Context, moveId string, s MoveKeyRangeStatus) error
TODO : unit tests
func (*EtcdQDB) WriteBalancerTask ¶
func (q *EtcdQDB) WriteBalancerTask(ctx context.Context, task *BalancerTask) error
TODO: unit tests
func (*EtcdQDB) WriteMoveTaskGroup ¶
func (q *EtcdQDB) WriteMoveTaskGroup(ctx context.Context, group *MoveTaskGroup) error
TODO: unit tests
func (*EtcdQDB) WriteRedistributeTask ¶
func (q *EtcdQDB) WriteRedistributeTask(ctx context.Context, task *RedistributeTask) error
TODO: unit tests
type KeyRangeStatus ¶
type KeyRangeStatus string
type MemQDB ¶
type MemQDB struct { Locks map[string]*sync.RWMutex `json:"locks"` Freq map[string]bool `json:"freq"` Krs map[string]*KeyRange `json:"krs"` Shards map[string]*Shard `json:"shards"` Distributions map[string]*Distribution `json:"distributions"` RelationDistribution map[string]string `json:"relation_distribution"` Routers map[string]*Router `json:"routers"` Transactions map[string]*DataTransferTransaction `json:"transactions"` Coordinator string `json:"coordinator"` MoveTaskGroup *MoveTaskGroup `json:"taskGroup"` RedistributeTask *RedistributeTask `json:"redistributeTask"` BalancerTask *BalancerTask `json:"balancerTask"` // contains filtered or unexported fields }
func (*MemQDB) AlterDistributionAttach ¶
func (q *MemQDB) AlterDistributionAttach(_ context.Context, id string, rels []*DistributedRelation) error
TODO : unit tests
func (*MemQDB) AlterDistributionDetach ¶
TODO: unit tests
func (*MemQDB) CheckLockedKeyRange ¶
TODO : unit tests
func (*MemQDB) CloseRouter ¶
TODO : unit tests
func (*MemQDB) CreateDistribution ¶
func (q *MemQDB) CreateDistribution(_ context.Context, distribution *Distribution) error
TODO : unit tests
func (*MemQDB) CreateKeyRange ¶
TODO : unit tests
func (*MemQDB) DeleteKeyRangeMove ¶
func (*MemQDB) DeleteRouter ¶
TODO : unit tests
func (*MemQDB) DropDistribution ¶
TODO : unit tests
func (*MemQDB) DropKeyRange ¶
TODO : unit tests
func (*MemQDB) DropKeyRangeAll ¶
TODO : unit tests
func (*MemQDB) GetBalancerTask ¶
func (q *MemQDB) GetBalancerTask(_ context.Context) (*BalancerTask, error)
TODO: unit tests
func (*MemQDB) GetCoordinator ¶
func (*MemQDB) GetDistribution ¶
TODO : unit tests
func (*MemQDB) GetKeyRange ¶
func (*MemQDB) GetMoveTaskGroup ¶
func (q *MemQDB) GetMoveTaskGroup(_ context.Context) (*MoveTaskGroup, error)
TODO: unit tests
func (*MemQDB) GetRedistributeTask ¶
func (q *MemQDB) GetRedistributeTask(_ context.Context) (*RedistributeTask, error)
TODO: unit tests
func (*MemQDB) GetRelationDistribution ¶
func (*MemQDB) GetTransferTx ¶
TODO : unit tests
func (*MemQDB) ListAllKeyRanges ¶
TODO : unit tests
func (*MemQDB) ListDistributions ¶
func (q *MemQDB) ListDistributions(_ context.Context) ([]*Distribution, error)
TODO : unit tests
func (*MemQDB) ListKeyRangeMoves ¶
func (q *MemQDB) ListKeyRangeMoves(ctx context.Context) ([]*MoveKeyRange, error)
func (*MemQDB) ListKeyRanges ¶
TODO : unit tests
func (*MemQDB) ListRouters ¶
TODO : unit tests
func (*MemQDB) ListShards ¶
TODO : unit tests
func (*MemQDB) LockKeyRange ¶
TODO : unit tests
func (*MemQDB) OpenRouter ¶
TODO : unit tests
func (*MemQDB) RecordKeyRangeMove ¶
func (q *MemQDB) RecordKeyRangeMove(ctx context.Context, m *MoveKeyRange) error
func (*MemQDB) RecordTransferTx ¶
func (q *MemQDB) RecordTransferTx(_ context.Context, key string, info *DataTransferTransaction) error
TODO : unit tests
func (*MemQDB) RemoveBalancerTask ¶
TODO: unit tests
func (*MemQDB) RemoveMoveTaskGroup ¶
TODO: unit tests
func (*MemQDB) RemoveRedistributeTask ¶
TODO: unit tests
func (*MemQDB) RemoveTransferTx ¶
TODO : unit tests
func (*MemQDB) RenameKeyRange ¶
TODO: unit tests
func (*MemQDB) TryLockKeyRange ¶
TODO : unit tests
func (*MemQDB) UnlockKeyRange ¶
TODO : unit tests
func (*MemQDB) UpdateCoordinator ¶
TODO : unit tests
func (*MemQDB) UpdateKeyRange ¶
TODO : unit tests
func (*MemQDB) UpdateKeyRangeMoveStatus ¶
func (*MemQDB) WriteBalancerTask ¶
func (q *MemQDB) WriteBalancerTask(_ context.Context, task *BalancerTask) error
TODO: unit tests
func (*MemQDB) WriteMoveTaskGroup ¶
func (q *MemQDB) WriteMoveTaskGroup(_ context.Context, group *MoveTaskGroup) error
TODO: unit tests
func (*MemQDB) WriteRedistributeTask ¶
func (q *MemQDB) WriteRedistributeTask(_ context.Context, task *RedistributeTask) error
TODO: unit tests
type MoveKeyRange ¶
type MoveKeyRange struct { MoveId string `json:"move_id"` ShardId string `json:"shard_id"` KeyRangeID string `json:"key_range_id"` Status MoveKeyRangeStatus `json:"status"` }
type MoveKeyRangeStatus ¶
type MoveKeyRangeStatus string
type MoveTaskGroup ¶
type QDB ¶
type QDB interface { CreateKeyRange(ctx context.Context, keyRange *KeyRange) error GetKeyRange(ctx context.Context, id string) (*KeyRange, error) UpdateKeyRange(ctx context.Context, keyRange *KeyRange) error DropKeyRange(ctx context.Context, id string) error DropKeyRangeAll(ctx context.Context) error ListKeyRanges(_ context.Context, distribution string) ([]*KeyRange, error) ListAllKeyRanges(_ context.Context) ([]*KeyRange, error) LockKeyRange(ctx context.Context, id string) (*KeyRange, error) UnlockKeyRange(ctx context.Context, id string) error CheckLockedKeyRange(ctx context.Context, id string) (*KeyRange, error) RenameKeyRange(ctx context.Context, krId, ktIdNew string) error AddShard(ctx context.Context, shard *Shard) error ListShards(ctx context.Context) ([]*Shard, error) GetShard(ctx context.Context, shardID string) (*Shard, error) DropShard(ctx context.Context, shardID string) error CreateDistribution(ctx context.Context, distr *Distribution) error ListDistributions(ctx context.Context) ([]*Distribution, error) DropDistribution(ctx context.Context, id string) error AlterDistributionAttach(ctx context.Context, id string, rels []*DistributedRelation) error AlterDistributionDetach(ctx context.Context, id string, relName string) error GetDistribution(ctx context.Context, id string) (*Distribution, error) // TODO: fix this by passing FQRN (fully qualified relation name (+schema)) GetRelationDistribution(ctx context.Context, relation string) (*Distribution, error) GetMoveTaskGroup(ctx context.Context) (*MoveTaskGroup, error) WriteMoveTaskGroup(ctx context.Context, group *MoveTaskGroup) error RemoveMoveTaskGroup(ctx context.Context) error GetRedistributeTask(ctx context.Context) (*RedistributeTask, error) WriteRedistributeTask(ctx context.Context, task *RedistributeTask) error RemoveRedistributeTask(ctx context.Context) error GetBalancerTask(ctx context.Context) (*BalancerTask, error) WriteBalancerTask(ctx context.Context, task *BalancerTask) error RemoveBalancerTask(ctx context.Context) error UpdateCoordinator(ctx context.Context, address string) error GetCoordinator(ctx context.Context) (string, error) }
This is a generic interface to be used by both the coordinator and the router.
* The router should use a memory-based version of this interface to cache * the state of the routing schema, while the coordinator should use an etcd-based * implementation to keep the distributed state in sync.
type RedistributeTask ¶
type Router ¶
type Router struct { Address string `json:"address"` ID string `json:"id"` State RouterState `json:"state,omitempty"` }
func NewRouter ¶
func NewRouter(addr, id string, rst RouterState) *Router
type RouterState ¶
type RouterState string
type Shard ¶
type ShardingSchemaKeeper ¶
type ShardingSchemaKeeper interface { /* persist start of key range move in distributed storage */ RecordKeyRangeMove(ctx context.Context, m *MoveKeyRange) error /* list all key-range moves in progress */ ListKeyRangeMoves(ctx context.Context) ([]*MoveKeyRange, error) /* mark key range move as completed */ UpdateKeyRangeMoveStatus(ctx context.Context, moveId string, s MoveKeyRangeStatus) error // DeleteKeyRangeMove deletes info about key range move DeleteKeyRangeMove(ctx context.Context, moveId string) error }
type TopolodyKeeper ¶
type TopolodyKeeper interface { AddRouter(ctx context.Context, r *Router) error DeleteRouter(ctx context.Context, rID string) error ListRouters(ctx context.Context) ([]*Router, error) // OpenRouter: change state of router to online // Making it usable to use for query executiong. // "Online" mode. OpenRouter(ctx context.Context, rID string) error // CloseRouter: change state of router to offline // Making it unusable to use for query executiong. // "Offline" mode. CloseRouter(ctx context.Context, rID string) error }
type UpdateCommand ¶
type UpdateCommand[T any] struct { // contains filtered or unexported fields }
func NewUpdateCommand ¶
func NewUpdateCommand[T any](m map[string]T, key string, value T) *UpdateCommand[T]
func (*UpdateCommand[T]) Do ¶
func (c *UpdateCommand[T]) Do() error
func (*UpdateCommand[T]) Undo ¶
func (c *UpdateCommand[T]) Undo() error
type XQDB ¶
type XQDB interface { // routing schema QDB // router topology TopolodyKeeper // data move state ShardingSchemaKeeper DistributedXactKepper TryCoordinatorLock(ctx context.Context) error }
XQDB means extended QDB The coordinator should use an etcd-based implementation to keep the distributed state in sync.