From dcf253314a05c9821bd90e7e09a168256c84f250 Mon Sep 17 00:00:00 2001 From: LFC Date: Mon, 20 Mar 2023 17:55:32 +0800 Subject: [PATCH] feat: add GRPC client stream service to our GreptimeDB (#16) --- go/greptime/v1/database.pb.go | 31 ++++++++++++------- .../main/java/io/greptime/v1/Database.java | 10 +++--- proto/greptime/v1/database.proto | 2 ++ 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/go/greptime/v1/database.pb.go b/go/greptime/v1/database.pb.go index 10bdb9f..fcc77cb 100644 --- a/go/greptime/v1/database.pb.go +++ b/go/greptime/v1/database.pb.go @@ -910,18 +910,23 @@ var file_greptime_v1_database_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x52, 0x0c, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x32, - 0x59, 0x0a, 0x10, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x44, 0x61, 0x74, 0x61, 0x62, - 0x61, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x1c, 0x2e, + 0xaa, 0x01, 0x0a, 0x10, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x44, 0x61, 0x74, 0x61, + 0x62, 0x61, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x1c, + 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x65, + 0x70, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x67, + 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x65, 0x70, 0x74, + 0x69, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0e, 0x48, + 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1c, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, - 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x51, 0x0a, 0x0e, 0x69, 0x6f, - 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x44, 0x61, - 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x2f, - 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x42, 0x51, 0x0a, 0x0e, + 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x08, + 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x65, 0x61, + 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -967,9 +972,11 @@ var file_greptime_v1_database_proto_depIdxs = []int32{ 13, // 10: greptime.v1.InsertRequest.columns:type_name -> greptime.v1.Column 10, // 11: greptime.v1.FlightMetadata.affected_rows:type_name -> greptime.v1.AffectedRows 4, // 12: greptime.v1.GreptimeDatabase.Handle:input_type -> greptime.v1.GreptimeRequest - 6, // 13: greptime.v1.GreptimeDatabase.Handle:output_type -> greptime.v1.GreptimeResponse - 13, // [13:14] is the sub-list for method output_type - 12, // [12:13] is the sub-list for method input_type + 4, // 13: greptime.v1.GreptimeDatabase.HandleRequests:input_type -> greptime.v1.GreptimeRequest + 6, // 14: greptime.v1.GreptimeDatabase.Handle:output_type -> greptime.v1.GreptimeResponse + 6, // 15: greptime.v1.GreptimeDatabase.HandleRequests:output_type -> greptime.v1.GreptimeResponse + 14, // [14:16] is the sub-list for method output_type + 12, // [12:14] is the sub-list for method input_type 12, // [12:12] is the sub-list for extension type_name 12, // [12:12] is the sub-list for extension extendee 0, // [0:12] is the sub-list for field type_name diff --git a/java/src/main/java/io/greptime/v1/Database.java b/java/src/main/java/io/greptime/v1/Database.java index 18d5065..6417960 100644 --- a/java/src/main/java/io/greptime/v1/Database.java +++ b/java/src/main/java/io/greptime/v1/Database.java @@ -10292,11 +10292,13 @@ public final class Database { "(\r\022\025\n\rregion_number\030\005 \001(\r\"\035\n\014AffectedRow" + "s\022\r\n\005value\030\001 \001(\r\"B\n\016FlightMetadata\0220\n\raf" + "fected_rows\030\001 \001(\0132\031.greptime.v1.Affected" + - "Rows2Y\n\020GreptimeDatabase\022E\n\006Handle\022\034.gre" + + "Rows2\252\001\n\020GreptimeDatabase\022E\n\006Handle\022\034.gr" + + "eptime.v1.GreptimeRequest\032\035.greptime.v1." + + "GreptimeResponse\022O\n\016HandleRequests\022\034.gre" + "ptime.v1.GreptimeRequest\032\035.greptime.v1.G" + - "reptimeResponseBQ\n\016io.greptime.v1B\010Datab" + - "aseZ5github.com/GreptimeTeam/greptime-pr" + - "oto/go/greptime/v1b\006proto3" + "reptimeResponse(\001BQ\n\016io.greptime.v1B\010Dat" + + "abaseZ5github.com/GreptimeTeam/greptime-" + + "proto/go/greptime/v1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/proto/greptime/v1/database.proto b/proto/greptime/v1/database.proto index 77e1e3e..994c071 100644 --- a/proto/greptime/v1/database.proto +++ b/proto/greptime/v1/database.proto @@ -11,6 +11,8 @@ import "greptime/v1/column.proto"; service GreptimeDatabase { rpc Handle(GreptimeRequest) returns (GreptimeResponse); + + rpc HandleRequests(stream GreptimeRequest) returns (GreptimeResponse); } message RequestHeader {