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 ¶
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 ¶
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 ¶
func DataShardFromDb ¶
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.
type Router ¶
type Router struct { ID string Address string State qdb.RouterState }
func RouterFromProto ¶
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 }