Documentation ¶
Index ¶
- type Adapter
- func (a *Adapter) AddDataShard(ctx context.Context, shard *datashards.DataShard) error
- func (a *Adapter) AddWorldShard(ctx context.Context, shard *datashards.DataShard) error
- func (a *Adapter) AlterDistributionAttach(ctx context.Context, id string, rels []*distributions.DistributedRelation) error
- func (a *Adapter) AlterDistributionDetach(ctx context.Context, id string, relName string) error
- func (a *Adapter) BatchMoveKeyRange(ctx context.Context, req *kr.BatchMoveKeyRange) error
- func (a *Adapter) Cache() *cache.SchemaCache
- func (a *Adapter) CreateDistribution(ctx context.Context, ds *distributions.Distribution) error
- func (a *Adapter) CreateKeyRange(ctx context.Context, kr *kr.KeyRange) error
- func (a *Adapter) DropDistribution(ctx context.Context, id string) error
- func (a *Adapter) DropKeyRange(ctx context.Context, krid string) error
- func (a *Adapter) DropKeyRangeAll(ctx context.Context) error
- func (a *Adapter) DropShard(ctx context.Context, shardId string) error
- func (a *Adapter) GetBalancerTask(ctx context.Context) (*tasks.BalancerTask, error)
- func (a *Adapter) GetCoordinator(ctx context.Context) (string, error)
- func (a *Adapter) GetDistribution(ctx context.Context, id string) (*distributions.Distribution, error)
- func (a *Adapter) GetKeyRange(ctx context.Context, krId string) (*kr.KeyRange, error)
- func (a *Adapter) GetMoveTaskGroup(ctx context.Context) (*tasks.MoveTaskGroup, error)
- func (a *Adapter) GetRelationDistribution(ctx context.Context, id string) (*distributions.Distribution, error)
- func (a *Adapter) GetShard(ctx context.Context, shardID string) (*datashards.DataShard, error)
- func (a *Adapter) ListAllKeyRanges(ctx context.Context) ([]*kr.KeyRange, error)
- func (a *Adapter) ListDistributions(ctx context.Context) ([]*distributions.Distribution, error)
- func (a *Adapter) ListKeyRanges(ctx context.Context, distribution string) ([]*kr.KeyRange, error)
- func (a *Adapter) ListRouters(ctx context.Context) ([]*topology.Router, error)
- func (a *Adapter) ListShards(ctx context.Context) ([]*datashards.DataShard, error)
- func (a *Adapter) LockKeyRange(ctx context.Context, krid string) (*kr.KeyRange, error)
- func (a *Adapter) Move(ctx context.Context, move *kr.MoveKeyRange) error
- func (a *Adapter) QDB() qdb.QDB
- func (a *Adapter) RedistributeKeyRange(ctx context.Context, req *kr.RedistributeKeyRange) error
- func (a *Adapter) RegisterRouter(ctx context.Context, r *topology.Router) error
- func (a *Adapter) RemoveBalancerTask(ctx context.Context) error
- func (a *Adapter) RemoveMoveTaskGroup(ctx context.Context) error
- func (a *Adapter) RenameKeyRange(ctx context.Context, krId, krIdNew string) error
- func (a *Adapter) ShareKeyRange(id string) error
- func (a *Adapter) Split(ctx context.Context, split *kr.SplitKeyRange) error
- func (a *Adapter) SyncRouterCoordinatorAddress(ctx context.Context, router *topology.Router) error
- func (a *Adapter) SyncRouterMetadata(ctx context.Context, router *topology.Router) error
- func (a *Adapter) Unite(ctx context.Context, unite *kr.UniteKeyRange) error
- func (a *Adapter) UnlockKeyRange(ctx context.Context, krid string) error
- func (a *Adapter) UnregisterRouter(ctx context.Context, id string) error
- func (a *Adapter) UpdateCoordinator(ctx context.Context, address string) error
- func (a *Adapter) WriteBalancerTask(ctx context.Context, task *tasks.BalancerTask) error
- func (a *Adapter) WriteMoveTaskGroup(ctx context.Context, taskGroup *tasks.MoveTaskGroup) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func NewAdapter ¶
func NewAdapter(conn *grpc.ClientConn) *Adapter
NewAdapter creates a new instance of the Adapter struct.
Parameters: - conn (*grpc.ClientConn): a pointer to a grpc.ClientConn object representing the gRPC client connection.
Returns: - a pointer to an Adapter object.
func (*Adapter) AddDataShard ¶
AddDataShard adds a data shard to the system.
Parameters: - ctx (context.Context): The context for the request. - shard (*datashards.DataShard): The datashards.DataShard instance to add.
Returns: - error: An error if the data shard addition fails, otherwise nil.
func (*Adapter) AddWorldShard ¶
AddWorldShard adds a world shard to the system.
Parameters: - ctx (context.Context): The context for the request. - shard (*datashards.DataShard): The datashards.DataShard instance to add.
Returns: - error: An error if the world shard addition fails, otherwise nil.
func (*Adapter) AlterDistributionAttach ¶
func (a *Adapter) AlterDistributionAttach(ctx context.Context, id string, rels []*distributions.DistributedRelation) error
AlterDistributionAttach alters the attachments of a distribution in the system.
Parameters: - ctx (context.Context): The context for the request. - id (string): The ID of the distribution to alter. - rels ([]*distributions.DistributedRelation): The list of distributions.DistributedRelation instances to attach.
Returns: - error: An error if the alteration of the distribution's attachments fails, otherwise nil.
func (*Adapter) AlterDistributionDetach ¶
AlterDistributionDetach detaches a relation from a distribution using the provided ID and relation name.
Parameters: - ctx (context.Context): The context for the request. - id (string): The ID of the distribution to detach from. - relName (string): The name of the relation to detach.
Returns: - error: An error if the detachment fails, otherwise nil.
func (*Adapter) BatchMoveKeyRange ¶
BatchMoveKeyRange moves a specified amount of keys from a key range to another shard.
Parameters: - ctx (context.Context): The context for the request. - req (*kr.BatchMoveKeyRange): The move information for moving the data.
Returns: - error: An error if moving the data was unsuccessful.
func (*Adapter) Cache ¶
func (a *Adapter) Cache() *cache.SchemaCache
func (*Adapter) CreateDistribution ¶
func (a *Adapter) CreateDistribution(ctx context.Context, ds *distributions.Distribution) error
CreateDistribution creates a new distribution in the system.
Parameters: - ctx (context.Context): The context for the request. - ds (*distributions.Distribution): The distributions.Distribution instance to create.
Returns: - error: An error if the creation of the distribution fails, otherwise nil.
func (*Adapter) CreateKeyRange ¶
CreateKeyRange creates a new key range.
Parameters: - ctx (context.Context): The context for the request. - kr (*kr.KeyRange): The key range object to be created.
Returns: - error: An error if creating the key range was unsuccessful.
func (*Adapter) DropDistribution ¶
DropDistribution removes a distribution from the system.
Parameters: - ctx (context.Context): The context for the request. - id (string): The ID of the distribution to remove.
Returns: - error: An error if the removal of the distribution fails, otherwise nil.
func (*Adapter) DropKeyRange ¶
DropKeyRange drops a key range using the provided ID.
Parameters: - ctx (context.Context): The context for the request. - krid (string): The ID of the key range to unlock.
Returns: - error: An error if the key range drop fails, otherwise nil.
func (*Adapter) DropKeyRangeAll ¶
DropKeyRangeAll drops all key ranges.
Parameters: - ctx (context.Context): The context for the request.
Returns: - error: An error if the key range drop fails, otherwise nil.
func (*Adapter) DropShard ¶
DropShard drops a data shard from the system.
Parameters: - ctx (context.Context): The context for the request. - shardId (string): The ID of the data shard to drop.
Returns: - error: An error if the data shard drop fails, otherwise nil.
func (*Adapter) GetBalancerTask ¶
GetBalancerTask retrieves current balancer task from the system.
Parameters:
- ctx (context.Context): The context for the request.
Returns:
- *tasks.BalancerTask: The retrieved balancer task.
- error: An error if the retrieval of the balancer task fails, otherwise nil.
func (*Adapter) GetCoordinator ¶
GetCoordinator retrieves the address of the coordinator from the system.
Parameters: - ctx (context.Context): The context for the request.
Returns: - string: The address of the coordinator. - error: An error if the retrieval operation fails, otherwise nil.
func (*Adapter) GetDistribution ¶
func (a *Adapter) GetDistribution(ctx context.Context, id string) (*distributions.Distribution, error)
GetDistribution retrieves a specific distribution from the system.
Parameters: - ctx (context.Context): The context for the request. - id (string): The ID of the distribution to retrieve.
Returns: - *distributions.Distribution: The retrieved distribution. - error: An error if the retrieval of the distribution fails, otherwise nil.
func (*Adapter) GetKeyRange ¶
GetKeyRange retrieves the key range for the given ID.
Parameters: - ctx (context.Context): The context for the request. - krId (string): The ID of the key range to retrieve.
Returns: - *kr.KeyRange: The retrieved key range. - error: An error if the retrieval was unsuccessful.
func (*Adapter) GetMoveTaskGroup ¶
GetMoveTaskGroup retrieves the task group from the system.
Parameters: - ctx (context.Context): The context for the request.
Returns: - *tasks.MoveTaskGroup: The retrieved task group. - error: An error if the retrieval of the task group fails, otherwise nil.
func (*Adapter) GetRelationDistribution ¶
func (a *Adapter) GetRelationDistribution(ctx context.Context, id string) (*distributions.Distribution, error)
GetRelationDistribution retrieves the distribution related to a specific relation from the system.
Parameters: - ctx (context.Context): The context for the request. - id (string): The ID of the relation (type: string).
Returns: - *distributions.Distribution: The retrieved distribution related to the relation. - error: An error if the retrieval of the distribution fails, otherwise nil.
func (*Adapter) GetShard ¶
GetShard retrieves a specific data shard from the system.
Parameters: - ctx (context.Context): The context for the request. - shardId (string): The ID of the data shard to retrieve.
Returns: - *datashards.DataShard: The retrieved data shard. - error: An error if the retrieval of the shard fails, otherwise nil.
func (*Adapter) ListAllKeyRanges ¶
ListAllKeyRanges lists all key ranges available.
Parameters: - ctx (context.Context): The context for the request.
Returns: - []*kr.KeyRange: A list of all available key ranges. - error: An error if listing all key ranges was unsuccessful.
func (*Adapter) ListDistributions ¶
func (a *Adapter) ListDistributions(ctx context.Context) ([]*distributions.Distribution, error)
ListDistributions retrieves a list of distributions from the system.
Parameters: - ctx (context.Context): The context for the request.
Returns: - []*distributions.Distribution: A list of distributions. - error: An error if the retrieval of distributions fails, otherwise nil.
func (*Adapter) ListKeyRanges ¶
ListKeyRanges lists the key ranges based on the specified distribution.
Parameters: - ctx (context.Context): The context for the request. - distribution (string): The distribution for filtering key ranges.
Returns: - []*kr.KeyRange: A list of key ranges based on the distribution. - error: An error if listing the key ranges was unsuccessful.
func (*Adapter) ListRouters ¶
ListRouters lists all routers available.
Parameters: - ctx (context.Context): The context for the request.
Returns: - []*topology.Router: A list of router instances. - error: An error if listing routers fails, otherwise nil.
func (*Adapter) ListShards ¶
ListShards retrieves a list of data shards from the system.
Parameters: - ctx (context.Context): The context for the request.
Returns: - []*datashards.DataShard: A list of data shards. - error: An error if the retrieval of shards fails, otherwise nil.
func (*Adapter) LockKeyRange ¶
LockKeyRange locks the key range with the given ID.
Parameters: - ctx (context.Context): The context for the request. - krid (string): The ID of the key range to lock.
Returns: - *kr.KeyRange: The locked key range. - error: An error if locking the key range was unsuccessful.
func (*Adapter) Move ¶
Move moves a key range to the specified shard.
Parameters: - ctx (context.Context): The context for the request. - move (*kr.MoveKeyRange): The move information for moving the key range.
Returns: - error: An error if moving the key range was unsuccessful.
func (*Adapter) RedistributeKeyRange ¶
RedistributeKeyRange moves a key range to the specified shard. Data is moved in batches of a given size.
Parameters:
- ctx (context.Context): The context for the request.
- req (*kr.RedistributeKeyRange): The move information for moving the key range.
Returns: - error: An error if moving the key range was unsuccessful.
func (*Adapter) RegisterRouter ¶
RegisterRouter registers a router using the provided context and router instance.
Parameters: - ctx (context.Context): The context for the request. - r (*topology.Router): The topology.Router instance to register.
Returns: - error: An error if the router registration fails, otherwise nil.
func (*Adapter) RemoveBalancerTask ¶
RemoveBalancerTask removes a balancer task from the system.
Parameters:
- ctx (context.Context): The context for the request.
Returns:
- error: An error if the removal of the balancer task fails, otherwise nil.
func (*Adapter) RemoveMoveTaskGroup ¶
RemoveMoveTaskGroup removes a task group from the system.
Parameters: - ctx (context.Context): The context for the request.
Returns: - error: An error if the removal of the task group fails, otherwise nil.
func (*Adapter) RenameKeyRange ¶
RenameKeyRange renames a key range.
Parameters:
- ctx (context.Context): The context for the request.
- krId (string): The ID of the key range to be renamed.
- krIdNew (string): The new ID for the specified key range.
Returns: - error: An error if renaming key range was unsuccessful.
func (*Adapter) ShareKeyRange ¶
ShareKeyRange shares the key range for the given ID.
Parameters: - id (string): The ID of the key range to be shared.
Returns: - error: An error indicating if the key range sharing was successful or not.
func (*Adapter) Split ¶
Split splits a key range based on the provided split information.
Parameters: - ctx (context.Context): The context for the request. - split (*kr.SplitKeyRange): The split information for dividing the key range.
Returns: - error: An error if splitting the key range was unsuccessful.
func (*Adapter) SyncRouterCoordinatorAddress ¶
SyncRouterCoordinatorAddress implements meta.EntityMgr. SyncRouterCoordinatorAddress synchronizes the coordinator address of a router.
Parameters: - ctx (context.Context): The context for the request. - router (*topology.Router): The topology.Router instance to synchronize the coordinator address for.
Returns: - error: An error if the synchronization of the coordinator address fails, otherwise nil.
func (*Adapter) SyncRouterMetadata ¶
SyncRouterMetadata synchronizes the metadata of a router.
Parameters: - ctx (context.Context): The context for the request. - router (*topology.Router): The topology.Router instance to synchronize the metadata for.
Returns: - error: An error if the metadata synchronization fails, otherwise nil.
func (*Adapter) Unite ¶
Unite merges two key ranges based on the provided unite information.
Parameters: - ctx (context.Context): The context for the request. - unite (*kr.UniteKeyRange): The unite information for merging the key ranges.
Returns: - error: An error if merging the key ranges was unsuccessful.
func (*Adapter) UnlockKeyRange ¶
UnlockKeyRange unlocks the key range with the given ID.
Parameters: - ctx (context.Context): The context for the request. - krid (string): The ID of the key range to unlock.
Returns: - error: An error if unlocking the key range was unsuccessful.
func (*Adapter) UnregisterRouter ¶
UnregisterRouter removes a router using the provided ID.
Parameters: - ctx (context.Context): The context for the request. - id (string): The ID of the router to remove.
Returns: - error: An error if the router removal fails, otherwise nil.
func (*Adapter) UpdateCoordinator ¶
UpdateCoordinator updates the coordinator with the given address.
Parameters: - ctx (context.Context): The context for the request. - address (string): The address of the coordinator to update.
Returns: - error: An error if the update operation fails, otherwise nil.
func (*Adapter) WriteBalancerTask ¶
WriteBalancerTask writes a balancer task to the system.
Parameters:
- ctx (context.Context): The context for the request.
- task (*tasks.BalancerTask): The balancer task to be written.
Returns:
- error: An error if the writing of the balancer task fails, otherwise nil.
func (*Adapter) WriteMoveTaskGroup ¶
WriteMoveTaskGroup writes a task group to the system.
Parameters: - ctx (context.Context): The context for the request. - taskGroup (*tasks.MoveTaskGroup): The task group to be written.
Returns: - error: An error if the writing of the task group fails, otherwise nil.