feat: define region server related messages (#79)
* feat: define region server related messages Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * finalise Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * generate language code Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * add missing field Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * push region id down Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * remove type alias for region id and column id Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * define query request Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * remove old java file Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * remove go code Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -35,9 +35,7 @@ message RequestHeader {
|
||||
optional uint64 span_id = 6;
|
||||
}
|
||||
|
||||
message ResponseHeader {
|
||||
Status status = 1;
|
||||
}
|
||||
message ResponseHeader { Status status = 1; }
|
||||
|
||||
message Status {
|
||||
// Corresponding to the `StatusCode` definition of GreptimeDB
|
||||
@@ -69,6 +67,7 @@ enum SemanticType {
|
||||
TIMESTAMP = 2;
|
||||
}
|
||||
|
||||
// TODO: deprecate this, and use the `ColumnDef` in region_server.proto instead
|
||||
message ColumnDef {
|
||||
string name = 1;
|
||||
ColumnDataType datatype = 2;
|
||||
@@ -104,4 +103,3 @@ enum ColumnDataType {
|
||||
INTERVAL_DAY_TIME = 24;
|
||||
INTERVAL_MONTH_DAY_NANO = 25;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
// Copyright 2023 Greptime Team
|
||||
//
|
||||
// Licensed 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 greptime.v1.region;
|
||||
|
||||
option java_package = "io.greptime.v1.region";
|
||||
option java_outer_classname = "Server";
|
||||
option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1/region";
|
||||
|
||||
import "greptime/v1/common.proto";
|
||||
import "greptime/v1/row.proto";
|
||||
|
||||
service RegionServer {
|
||||
rpc Handle(RegionRequest) returns (RegionResponse);
|
||||
// TODO: add stream API
|
||||
}
|
||||
|
||||
message RegionRequest {
|
||||
RequestHeader header = 1;
|
||||
// query request is handled in flight services.
|
||||
oneof request {
|
||||
InsertRequests inserts = 3;
|
||||
DeleteRequests deletes = 4;
|
||||
CreateRequest create = 5;
|
||||
DropRequest drop = 6;
|
||||
OpenRequest open = 7;
|
||||
CloseRequest close = 8;
|
||||
AlterRequest alter = 9;
|
||||
FlushRequest flush = 10;
|
||||
CompactRequest compact = 11;
|
||||
}
|
||||
}
|
||||
|
||||
message RegionResponse {
|
||||
ResponseHeader header = 1;
|
||||
uint64 affacted_rows = 2;
|
||||
}
|
||||
|
||||
message InsertRequests { repeated InsertRequest requests = 1; }
|
||||
|
||||
message DeleteRequests { repeated DeleteRequest requests = 1; }
|
||||
|
||||
message InsertRequest {
|
||||
uint64 region_id = 1;
|
||||
repeated Row rows = 2;
|
||||
}
|
||||
|
||||
message DeleteRequest {
|
||||
uint64 region_id = 1;
|
||||
repeated Row rows = 2;
|
||||
}
|
||||
|
||||
message QueryRequest {
|
||||
uint64 region_id = 1;
|
||||
// substrait plan to query
|
||||
bytes plan = 2;
|
||||
}
|
||||
|
||||
message CreateRequest {
|
||||
uint64 region_id = 1;
|
||||
// Region engine name
|
||||
string engine = 2;
|
||||
// Columns in this region.
|
||||
repeated ColumnDef column_defs = 3;
|
||||
// Columns in the primary key.
|
||||
repeated uint32 primary_key = 4;
|
||||
// Create region if not exists.
|
||||
bool create_if_not_exists = 5;
|
||||
// Directory for region's data home. Usually is composed by catalog and table
|
||||
// id
|
||||
string region_dir = 6;
|
||||
// Options of the created region.
|
||||
map<string, string> options = 7;
|
||||
// TODO: add partition def
|
||||
}
|
||||
|
||||
message DropRequest { uint64 region_id = 1; }
|
||||
|
||||
message OpenRequest {
|
||||
uint64 region_id = 1;
|
||||
// Region engine name
|
||||
string engine = 2;
|
||||
// Data directory of the region.
|
||||
string region_dir = 3;
|
||||
// Options of the opened region.
|
||||
map<string, string> options = 4;
|
||||
}
|
||||
|
||||
message CloseRequest { uint64 region_id = 1; }
|
||||
|
||||
// TODO: implement alter request
|
||||
message AlterRequest { uint64 region_id = 1; }
|
||||
|
||||
message FlushRequest { uint64 region_id = 1; }
|
||||
|
||||
message CompactRequest { uint64 region_id = 1; }
|
||||
|
||||
message ColumnDef {
|
||||
string name = 1;
|
||||
uint32 column_id = 2;
|
||||
ColumnDataType datatype = 3;
|
||||
bool is_nullable = 4;
|
||||
bytes default_constraint = 5;
|
||||
SemanticType semantic_type = 6;
|
||||
}
|
||||
Reference in New Issue
Block a user