coord

package
v0.0.0-...-963c118 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2024 License: PostgreSQL Imports: 13 Imported by: 0

Documentation

Index

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

func (a *Adapter) AddDataShard(ctx context.Context, shard *datashards.DataShard) error

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

func (a *Adapter) AddWorldShard(ctx context.Context, shard *datashards.DataShard) error

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

func (a *Adapter) AlterDistributionDetach(ctx context.Context, id string, relName string) error

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

func (a *Adapter) BatchMoveKeyRange(ctx context.Context, req *kr.BatchMoveKeyRange) error

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

func (a *Adapter) CreateKeyRange(ctx context.Context, kr *kr.KeyRange) error

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

func (a *Adapter) DropDistribution(ctx context.Context, id string) error

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

func (a *Adapter) DropKeyRange(ctx context.Context, krid string) error

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

func (a *Adapter) DropKeyRangeAll(ctx context.Context) error

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

func (a *Adapter) DropShard(ctx context.Context, shardId string) error

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

func (a *Adapter) GetBalancerTask(ctx context.Context) (*tasks.BalancerTask, error)

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

func (a *Adapter) GetCoordinator(ctx context.Context) (string, error)

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

func (a *Adapter) GetKeyRange(ctx context.Context, krId string) (*kr.KeyRange, error)

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

func (a *Adapter) GetMoveTaskGroup(ctx context.Context) (*tasks.MoveTaskGroup, error)

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

func (a *Adapter) GetShard(ctx context.Context, shardID string) (*datashards.DataShard, error)

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

func (a *Adapter) ListAllKeyRanges(ctx context.Context) ([]*kr.KeyRange, error)

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

func (a *Adapter) ListKeyRanges(ctx context.Context, distribution string) ([]*kr.KeyRange, error)

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

func (a *Adapter) ListRouters(ctx context.Context) ([]*topology.Router, error)

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

func (a *Adapter) ListShards(ctx context.Context) ([]*datashards.DataShard, error)

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

func (a *Adapter) LockKeyRange(ctx context.Context, krid string) (*kr.KeyRange, error)

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

func (a *Adapter) Move(ctx context.Context, move *kr.MoveKeyRange) error

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) QDB

func (a *Adapter) QDB() qdb.QDB

Parameters: - None.

Returns: - qdb.QDB: The QDB object.

func (*Adapter) RedistributeKeyRange

func (a *Adapter) RedistributeKeyRange(ctx context.Context, req *kr.RedistributeKeyRange) error

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

func (a *Adapter) RegisterRouter(ctx context.Context, r *topology.Router) error

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

func (a *Adapter) RemoveBalancerTask(ctx context.Context) error

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

func (a *Adapter) RemoveMoveTaskGroup(ctx context.Context) error

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

func (a *Adapter) RenameKeyRange(ctx context.Context, krId, krIdNew string) error

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

func (a *Adapter) ShareKeyRange(id string) error

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

func (a *Adapter) Split(ctx context.Context, split *kr.SplitKeyRange) error

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

func (a *Adapter) SyncRouterCoordinatorAddress(ctx context.Context, router *topology.Router) error

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

func (a *Adapter) SyncRouterMetadata(ctx context.Context, router *topology.Router) error

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

func (a *Adapter) Unite(ctx context.Context, unite *kr.UniteKeyRange) error

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

func (a *Adapter) UnlockKeyRange(ctx context.Context, krid string) error

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

func (a *Adapter) UnregisterRouter(ctx context.Context, id string) error

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

func (a *Adapter) UpdateCoordinator(ctx context.Context, address string) error

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

func (a *Adapter) WriteBalancerTask(ctx context.Context, task *tasks.BalancerTask) error

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

func (a *Adapter) WriteMoveTaskGroup(ctx context.Context, taskGroup *tasks.MoveTaskGroup) error

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL