syntax = "proto3"; package meta_service; option go_package = "github.com/CeresDB/ceresdbproto/golang/pkg/metaservicepb"; import "common.proto"; import "cluster.proto"; service CeresmetaRpcService { rpc AllocSchemaID(AllocSchemaIdRequest) returns (AllocSchemaIdResponse) {} rpc GetTablesOfShards(GetTablesOfShardsRequest) returns (GetTablesOfShardsResponse) {} rpc CreateTable(CreateTableRequest) returns (CreateTableResponse) {} rpc DropTable(DropTableRequest) returns (DropTableResponse) {} rpc RouteTables(RouteTablesRequest) returns (RouteTablesResponse) {} rpc GetNodes(GetNodesRequest) returns (GetNodesResponse) {} rpc NodeHeartbeat(NodeHeartbeatRequest) returns (NodeHeartbeatResponse) {} } message RequestHeader { string node = 1; string cluster_name = 2; } message AllocSchemaIdRequest { RequestHeader header = 1; string name = 2; } message AllocSchemaIdResponse { common.ResponseHeader header = 1; string name = 2; uint32 id = 3; } message CreateTableRequest { RequestHeader header = 1; string schema_name = 2; string name = 3; bytes encoded_schema = 4; string engine = 5; bool create_if_not_exist = 6; map options = 7; PartitionTableInfo partition_table_info = 8; } message PartitionTableInfo { cluster.PartitionInfo partition_info = 1; repeated string sub_table_names = 2; } message TableInfo { uint64 id = 1; string name = 2; uint32 schema_id = 3; string schema_name = 4; cluster.PartitionInfo partition_info = 5; } message CreateTableResponse { common.ResponseHeader header = 1; TableInfo created_table = 2; ShardInfo shard_info = 3; } message GetTablesOfShardsRequest { RequestHeader header = 1; repeated uint32 shard_ids = 2; } message TablesOfShard { ShardInfo shard_info = 1; repeated TableInfo tables = 2; } message GetTablesOfShardsResponse { common.ResponseHeader header = 1; // ShardId -> TablesOfShard map tables_by_shard = 2; } message RouteTablesRequest { RequestHeader header = 1; string schema_name = 2; repeated string table_names = 3; } message NodeShard { string endpoint = 1; ShardInfo shard_info = 2; } message RouteEntry { TableInfo table = 1; repeated NodeShard node_shards = 2; } message RouteTablesResponse { common.ResponseHeader header = 1; uint64 cluster_topology_version = 2; // TableName -> RouteEntry map entries = 3; } message GetNodesRequest { RequestHeader header = 1; } message GetNodesResponse { common.ResponseHeader header = 1; uint64 cluster_topology_version = 2; repeated NodeShard node_shards = 3; } message DropTableRequest { RequestHeader header = 1; string schema_name = 2; string name = 3; PartitionTableInfo partition_table_info = 4; } message DropTableResponse { common.ResponseHeader header = 1; TableInfo dropped_table = 2; } message NodeHeartbeatRequest { RequestHeader header = 1; NodeInfo info = 2; } message ShardInfo { enum Status { Ready = 0; PartialOpen = 1; } uint32 id = 1; cluster.ShardRole role = 2; uint64 version = 3; // When status is missing, it means Ready optional Status status = 4; } message NodeInfo { // ip:port string endpoint = 1; uint32 lease = 2; string zone = 3; string binary_version = 4; repeated ShardInfo shard_infos = 5; } message NodeHeartbeatResponse { common.ResponseHeader header = 1; }