// 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; option java_package = "io.greptime.v1"; option java_outer_classname = "Database"; option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1"; import "greptime/v1/ddl.proto"; import "greptime/v1/column.proto"; import "greptime/v1/row.proto"; import "greptime/v1/prom.proto"; import "greptime/v1/common.proto"; service GreptimeDatabase { rpc Handle(GreptimeRequest) returns (GreptimeResponse); rpc HandleRequests(stream GreptimeRequest) returns (GreptimeResponse); } message GreptimeRequest { RequestHeader header = 1; oneof request { InsertRequests inserts = 2; QueryRequest query = 3; DdlRequest ddl = 4; DeleteRequests deletes = 5; RowInsertRequests row_inserts = 6; RowDeleteRequest row_delete = 7; } } message GreptimeResponse { ResponseHeader header = 1; oneof response { AffectedRows affected_rows = 2; } } message QueryRequest { oneof query { string sql = 1; bytes logical_plan = 2; PromRangeQuery prom_range_query = 3; } } message InsertRequests { repeated InsertRequest inserts = 1; } message InsertRequest { string table_name = 1; // Data is represented here. repeated Column columns = 3; // The row_count of all columns, which include null and non-null values. // // Note: the row_count of all columns in a InsertRequest must be same. uint32 row_count = 4; // The region number of current insert request. uint32 region_number = 5; } message DeleteRequests { repeated DeleteRequest deletes = 1; } message DeleteRequest { // The table name to delete from. Catalog name and schema name are in the // `RequestHeader`. string table_name = 1; // The region number of current delete request. uint32 region_number = 2; // The data to delete, indexed by key columns. repeated Column key_columns = 3; // The row count of all columns above. uint32 row_count = 4; } message RowInsertRequests { repeated RowInsertRequest inserts = 1; } message RowInsertRequest { string table_name = 1; // Data is represented here. Rows rows = 2; // The region number of current insert request. uint32 region_number = 3; } message RowDeleteRequest { // The table name to delete from. Catalog name and schema name are in the // `RequestHeader`. string table_name = 1; // The data to delete. Rows rows = 2; // The region number of current delete request. uint32 region_number = 3; }