/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ syntax = "proto3"; package meta_service; option go_package = "github.com/apache/incubator-horaedb-proto/golang/pkg/metaservicepb"; import "common.proto"; import "cluster.proto"; service MetaRpcService { 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; }