Documentation
¶
Index ¶
- Constants
- Variables
- type Cluster
- func (c *Cluster) DropTable(ctx context.Context, schemaName, tableName string, tableID uint64) error
- func (c *Cluster) GetNodes(_ context.Context) (*GetNodesResult, error)
- func (c *Cluster) GetOrCreateSchema(ctx context.Context, schemaName string) (*Schema, error)
- func (c *Cluster) GetOrCreateTable(ctx context.Context, nodeName string, schemaName string, tableName string) (*Table, error)
- func (c *Cluster) GetShardIDs(nodeName string) ([]uint32, error)
- func (c *Cluster) GetTable(ctx context.Context, schemaName, tableName string) (*Table, bool, error)
- func (c *Cluster) GetTables(_ context.Context, shardIDs []uint32, nodeName string) (map[uint32]*ShardTablesWithRole, error)
- func (c *Cluster) Load(ctx context.Context) error
- func (c *Cluster) Name() string
- func (c *Cluster) RegisterNode(ctx context.Context, nodeInfo *metaservicepb.NodeInfo) error
- func (c *Cluster) RouteTables(_ context.Context, schemaName string, tableNames []string) (*RouteTablesResult, error)
- type GetNodesResult
- type Manager
- type Node
- type NodeShard
- type RouteEntry
- type RouteTablesResult
- type Schema
- type Shard
- type ShardInfo
- type ShardTables
- type ShardTablesWithRole
- type Table
- type TableInfo
Constants ¶
View Source
const ( AllocClusterIDPrefix = "ClusterID" AllocSchemaIDPrefix = "SchemaID" AllocTableIDPrefix = "TableID" )
View Source
const DefaultHeartbeatInterval = time.Second * 3
TODO: heartbeatInterval should be set in config
Variables ¶
View Source
var ( ErrCreateCluster = coderr.NewCodeError(coderr.BadRequest, "create clusters") ErrClusterAlreadyExists = coderr.NewCodeError(coderr.Internal, "clusters already exists") ErrClusterNotFound = coderr.NewCodeError(coderr.NotFound, "cluster not found") ErrClusterTopologyNotFound = coderr.NewCodeError(coderr.NotFound, "cluster topology not found") ErrSchemaNotFound = coderr.NewCodeError(coderr.NotFound, "schema not found") ErrTableNotFound = coderr.NewCodeError(coderr.NotFound, "Table not found") ErrShardNotFound = coderr.NewCodeError(coderr.NotFound, "shard not found") ErrNodeNotFound = coderr.NewCodeError(coderr.NotFound, "node not found") ErrNodeShardsIsEmpty = coderr.NewCodeError(coderr.Internal, "node's shard list is empty") ErrGetShardTopology = coderr.NewCodeError(coderr.Internal, "get shard topology") )
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewCluster ¶
func (*Cluster) GetOrCreateSchema ¶
func (*Cluster) GetOrCreateTable ¶
func (*Cluster) RegisterNode ¶
func (*Cluster) RouteTables ¶
type GetNodesResult ¶
type Manager ¶
type Manager interface {
// Start must be called before manager is used.
Start(ctx context.Context) error
// Stop must be called before manager is dropped.
Stop(ctx context.Context) error
CreateCluster(ctx context.Context, clusterName string, nodeCount, replicationFactor, shardTotal uint32) (*Cluster, error)
AllocSchemaID(ctx context.Context, clusterName, schemaName string) (uint32, error)
AllocTableID(ctx context.Context, clusterName, schemaName, tableName, nodeName string) (*Table, error)
GetTables(ctx context.Context, clusterName, nodeName string, shardIDs []uint32) (map[uint32]*ShardTables, error)
DropTable(ctx context.Context, clusterName, schemaName, tableName string, tableID uint64) error
RegisterNode(ctx context.Context, clusterName string, nodeInfo *metaservicepb.NodeInfo) error
GetShards(ctx context.Context, clusterName, nodeName string) ([]uint32, error)
RouteTables(ctx context.Context, clusterName, schemaName string, tableNames []string) (*RouteTablesResult, error)
GetNodes(ctx context.Context, clusterName string) (*GetNodesResult, error)
}
type RouteEntry ¶
type RouteTablesResult ¶
type RouteTablesResult struct {
Version uint64
RouteEntries map[string]*RouteEntry
}
type ShardTables ¶
type ShardTablesWithRole ¶
type ShardTablesWithRole struct {
// contains filtered or unexported fields
}
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (*Table) GetSchemaID ¶
func (*Table) GetSchemaName ¶
func (*Table) GetShardID ¶
Click to show internal directories.
Click to hide internal directories.