topology

package
v0.0.0-...-c61326f Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: PostgreSQL Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataShardToProto

func DataShardToProto(shard *DataShard) *proto.Shard

DataShardToProto converts a DataShard object to a proto.Shard object. It takes a pointer to a DataShard as input and returns a pointer to a proto.Shard.

Parameters:

  • shard: The DataShard object to convert.

Returns:

  • *proto.Shard: The converted proto.Shard object.

func RouterToDB

func RouterToDB(r *Router) *qdb.Router

RouterToDB converts a Router object to a qdb.Router object. It creates a new qdb.Router object and copies the ID, Address, and State fields from the input Router object. The converted qdb.Router object is then returned.

Parameters:

  • r: The Router object to convert.

Returns:

  • *qdb.Router: The converted qdb.Router object.

func RouterToProto

func RouterToProto(r *Router) *protos.Router

RouterToProto converts a Router object to a protos.Router object. It takes a pointer to a Router object as input and returns a pointer to a protos.Router object. The function maps the fields of the Router object to the corresponding fields of the protos.Router object. The status field of the Router object is converted to a protos.RouterStatus enum value.

Parameters:

  • r: A pointer to the Router object to convert.

Returns:

  • *protos.Router: A pointer to the converted protos.Router object.

Types

type DataShard

type DataShard struct {
	ID  string
	Cfg *config.Shard
}

func DataShardFromDb

func DataShardFromDb(shard *qdb.Shard) *DataShard

DataShardFromDb creates a new DataShard instance from the given qdb.Shard. It initializes the DataShard with the shard ID and hosts from the qdb.Shard, and sets the shard type to config.DataShard.

Parameters:

  • shard: The qdb.Shard object to convert.

Returns:

  • *DataShard: The created DataShard instance.

func DataShardFromProto

func DataShardFromProto(shard *proto.Shard) *DataShard

DataShardFromProto creates a new DataShard instance from the given proto.Shard. It initializes the DataShard with the shard ID and hosts from the proto.Shard, and sets the shard type to config.DataShard.

Parameters:

  • shard: The proto.Shard object to convert.

Returns:

  • *DataShard: The created DataShard instance.

func NewDataShard

func NewDataShard(name string, cfg *config.Shard) *DataShard

NewDataShard creates a new DataShard instance with the given name and configuration.

Parameters:

  • name: The name of the shard.
  • cfg: The configuration of the shard.

Returns:

  • *DataShard: The created DataShard instance.

type Router

type Router struct {
	ID      string
	Address string
	State   qdb.RouterState
}

func RouterFromProto

func RouterFromProto(r *protos.Router) *Router

RouterFromProto converts a protobuf Router object to a Router struct. It takes a pointer to a protos.Router object as input and returns a pointer to a Router object. The function maps the fields of the protos.Router object to the corresponding fields of the Router object. The status field of the protos.Router object is converted to a qdb.RouterState enum value.

Parameters:

  • r: A pointer to the protos.Router object to convert.

Returns:

  • *Router: A pointer to the converted Router object.

type RouterMgr

type RouterMgr interface {
	RegisterRouter(ctx context.Context, r *Router) error
	ListRouters(ctx context.Context) ([]*Router, error)
	UnregisterRouter(ctx context.Context, id string) error
	SyncRouterMetadata(ctx context.Context, router *Router) error
	SyncRouterCoordinatorAddress(ctx context.Context, router *Router) error
	UpdateCoordinator(ctx context.Context, address string) error
	GetCoordinator(ctx context.Context) (string, error)
}

type ShardsMgr

type ShardsMgr interface {
	AddDataShard(ctx context.Context, shard *DataShard) error
	AddWorldShard(ctx context.Context, shard *DataShard) error
	ListShards(ctx context.Context) ([]*DataShard, error)
	GetShard(ctx context.Context, shardID string) (*DataShard, error)
	DropShard(ctx context.Context, id string) error
}

Jump to

Keyboard shortcuts

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