From fd18fe5ca312872f384080c5a38f45cb72b03d8c Mon Sep 17 00:00:00 2001 From: yuanbohan Date: Fri, 21 Apr 2023 14:29:48 +0800 Subject: [PATCH] feat: promql service (#26) * feat: promql service * feat: promql service * feat: prometheus service, and common.proto, prom.proto * feat: add header in prom request/response * docs: include new proto files in readme --- Makefile | 4 +- README.md | 63 ++- go/greptime/v1/common.pb.go | 605 +++++++++++++++++++++++ go/greptime/v1/database.pb.go | 791 ++++--------------------------- go/greptime/v1/prom.pb.go | 380 +++++++++++++++ go/greptime/v1/prom_grpc.pb.go | 105 ++++ proto/greptime/v1/common.proto | 44 ++ proto/greptime/v1/database.proto | 46 +- proto/greptime/v1/prom.proto | 34 ++ 9 files changed, 1314 insertions(+), 758 deletions(-) create mode 100644 go/greptime/v1/common.pb.go create mode 100644 go/greptime/v1/prom.pb.go create mode 100644 go/greptime/v1/prom_grpc.pb.go create mode 100644 proto/greptime/v1/common.proto create mode 100644 proto/greptime/v1/prom.proto diff --git a/Makefile b/Makefile index 4e85b26..667affb 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,8 @@ rust: go: go-deps docker run -t -w /greptime-proto \ - --entrypoint ./scripts/generate-go.sh \ - -v ${PWD}:/greptime-proto ${BUILDER_CONTAINER} + --entrypoint ./scripts/generate-go.sh \ + -v ${PWD}:/greptime-proto ${BUILDER_CONTAINER} go-deps: go mod download diff --git a/README.md b/README.md index db5dadd..6148d21 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ GreptimeDB protobuf files. ### Requirement -- [google/protobuf](https://github.com/protocolbuffers/protobuf) v3 +- [google/protobuf][protobuf] v3 ### Command @@ -15,13 +15,13 @@ GreptimeDB protobuf files. ```console make rust ``` - + - **Compile for Go** ```console make go ``` - + The compilation will use builder container `namely/protoc-all`. ## Usage @@ -63,33 +63,64 @@ import ( ## For SDK developers -GreptimeDB's gRPC service is built on top of [Arrow Flight RPC](https://arrow.apache.org/docs/format/Flight.html). You can find the Arrow's official implementation status of each programming language [here](https://arrow.apache.org/docs/status.html#flight-rpc). +GreptimeDB's gRPC service is built on top of [Arrow Flight RPC][flight]. You can find the Arrow's +official implementation status of each programming language [flight rpc][flight-rpc]. -> If you can't find the language you are using, you can always generate the Arrow Flight gRPC service from the raw protobuf definition [here](https://arrow.apache.org/docs/format/Flight.html#protocol-buffer-definitions). Or call into other language binding like C++. +> If you can't find the language you are using, you can always generate the Arrow Flight gRPC +> service from the raw protobuf definition [flight protobuf definitions][flight-protobuf]. Or call +> into other language binding like C++. -Once the Arrow Flight client is ready, you only need to care about the following 3 protobuf files to accomplish our SDK writing: +Once the Arrow Flight client is ready, you only need to care about the following protobuf files to +accomplish our SDK writing: ```console . ├── greptime │   └── v1 -│   ├── column.proto -│   ├── database.proto -│   ├── ddl.proto +│   ├── column.proto +│   ├── common.proto +│   ├── database.proto +│   ├── ddl.proto +│   ├── health.proto +│   └── prom.proto ``` > You can find all protobuf files in the directory "proto" under the project's root. -Right now the GreptimeDB only responds to Arrow Flight's `do_get` interface. All the reads and writes (that are from clients) are handled there. `do_get` needs a "ticket" as the input request, you need to serialize the `GreptimeRequest` message defined in "database.proto" for it. +Right now the GreptimeDB only responds to Arrow Flight's `do_get` interface. All the reads and +writes (that are from clients) are handled there. `do_get` needs a "ticket" as the input request, +you need to serialize the `GreptimeRequest` message defined in "database.proto" for it. There are 3 kinds of `GreptimeRequest`, which are: -- `InsertRequest`, carries the data to be ingested. It's a little verbose to assemble, especially the "column"s that define the schema and value of the input data. You can find the definition of "column" in "column.proto". -- `QueryRequest` has the SQL in it. Note that you can `INSERT INTO` GreptimeDB as well as `SELECT` it. -- `DdlRequest` defines the "Data Definition Language" request, like table creation or deletion. It's sometimes more representative than the normal SQL. `DdlRequest`s are defined in "ddl.proto". +- `InsertRequest`, carries the data to be ingested. It's a little verbose to assemble, especially + the "column"s that define the schema and value of the input data. You can find the definition of + "column" in "column.proto". +- `QueryRequest` has the SQL in it. Note that you can `INSERT INTO` GreptimeDB as well as `SELECT` + it. +- `DdlRequest` defines the "Data Definition Language" request, like table creation or deletion. It's + sometimes more representative than the normal SQL. `DdlRequest`s are defined in "ddl.proto". -There's also `RequestHeader` in the `GreptimeRequest` to specify the "catalog" and "schema" to be used in this request. If either one is not set (or left empty), GreptimeDB will use the default catalog "greptime" and default schema "public". +There's also `RequestHeader` in the `GreptimeRequest` to specify the "catalog" and "schema" to be +used in this request. If either one is not set (or left empty), GreptimeDB will use the default +catalog "greptime" and default schema "public". -The response of `do_get` is handled in Arrow Flight's client. It's a stream of `FlightData`. You can find its definition in Arrow Flight's protobuf file. Special care must be taken when dealing with insertion, that GreptimeDB puts insertion result in `FlightData`'s metadata. Insertion results, either from `InsertRequest` or `INSERT INTO` SQL, are both have the same format, that "Affected Rows: x". "x" represents the rows that are successfully inserted. When dealing with this special `FlightData`, please ignore its `data_body` field, but directly strip the `app_metadata` field from it, and deserialize the bytes as `FlightMetadata` message. You will find the "affected rows" result in it. +The response of `do_get` is handled in Arrow Flight's client. It's a stream of `FlightData`. You can +find its definition in Arrow Flight's protobuf file. Special care must be taken when dealing with +insertion, that GreptimeDB puts insertion result in `FlightData`'s metadata. Insertion results, +either from `InsertRequest` or `INSERT INTO` SQL, are both have the same format, that "Affected +Rows: x". "x" represents the rows that are successfully inserted. When dealing with this special +`FlightData`, please ignore its `data_body` field, but directly strip the `app_metadata` field from +it, and deserialize the bytes as `FlightMetadata` message. You will find the "affected rows" result +in it. -We already have our SDK written in [Java](https://github.com/GreptimeTeam/greptimedb-client-java), [Rust]() and [Go](), feel free to take any of them as an example. +We already have our SDK written in [Java][java-sdk], [Rust]() and [Go][go-sdk], feel free to take +any of them as an example. + + +[protobuf]: https://github.com/protocolbuffers/protobuf +[flight]: https://arrow.apache.org/docs/format/Flight.html +[flight-rpc]: https://arrow.apache.org/docs/status.html#flight-rpc +[flight-protobuf]: https://arrow.apache.org/docs/format/Flight.html#protocol-buffer-definitions +[java-sdk]: https://github.com/GreptimeTeam/greptimedb-client-java +[go-sdk]: https://github.com/GreptimeTeam/greptimedb-client-go diff --git a/go/greptime/v1/common.pb.go b/go/greptime/v1/common.pb.go new file mode 100644 index 0000000..f36601b --- /dev/null +++ b/go/greptime/v1/common.pb.go @@ -0,0 +1,605 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 +// source: greptime/v1/common.proto + +package v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ResponseHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ResponseHeader) Reset() { + *x = ResponseHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResponseHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseHeader) ProtoMessage() {} + +func (x *ResponseHeader) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_common_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResponseHeader.ProtoReflect.Descriptor instead. +func (*ResponseHeader) Descriptor() ([]byte, []int) { + return file_greptime_v1_common_proto_rawDescGZIP(), []int{0} +} + +type RequestHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The `catalog` that is selected to be used in this request. + Catalog string `protobuf:"bytes,1,opt,name=catalog,proto3" json:"catalog,omitempty"` + // The `schema` that is selected to be used in this request. + Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + // The `authorization` header, much like http's authorization header. + Authorization *AuthHeader `protobuf:"bytes,3,opt,name=authorization,proto3" json:"authorization,omitempty"` + // The `dbname` for the request + Dbname string `protobuf:"bytes,4,opt,name=dbname,proto3" json:"dbname,omitempty"` +} + +func (x *RequestHeader) Reset() { + *x = RequestHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_common_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestHeader) ProtoMessage() {} + +func (x *RequestHeader) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_common_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestHeader.ProtoReflect.Descriptor instead. +func (*RequestHeader) Descriptor() ([]byte, []int) { + return file_greptime_v1_common_proto_rawDescGZIP(), []int{1} +} + +func (x *RequestHeader) GetCatalog() string { + if x != nil { + return x.Catalog + } + return "" +} + +func (x *RequestHeader) GetSchema() string { + if x != nil { + return x.Schema + } + return "" +} + +func (x *RequestHeader) GetAuthorization() *AuthHeader { + if x != nil { + return x.Authorization + } + return nil +} + +func (x *RequestHeader) GetDbname() string { + if x != nil { + return x.Dbname + } + return "" +} + +type AuthHeader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to AuthScheme: + // + // *AuthHeader_Basic + // *AuthHeader_Token + AuthScheme isAuthHeader_AuthScheme `protobuf_oneof:"auth_scheme"` +} + +func (x *AuthHeader) Reset() { + *x = AuthHeader{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_common_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthHeader) ProtoMessage() {} + +func (x *AuthHeader) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_common_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthHeader.ProtoReflect.Descriptor instead. +func (*AuthHeader) Descriptor() ([]byte, []int) { + return file_greptime_v1_common_proto_rawDescGZIP(), []int{2} +} + +func (m *AuthHeader) GetAuthScheme() isAuthHeader_AuthScheme { + if m != nil { + return m.AuthScheme + } + return nil +} + +func (x *AuthHeader) GetBasic() *Basic { + if x, ok := x.GetAuthScheme().(*AuthHeader_Basic); ok { + return x.Basic + } + return nil +} + +func (x *AuthHeader) GetToken() *Token { + if x, ok := x.GetAuthScheme().(*AuthHeader_Token); ok { + return x.Token + } + return nil +} + +type isAuthHeader_AuthScheme interface { + isAuthHeader_AuthScheme() +} + +type AuthHeader_Basic struct { + Basic *Basic `protobuf:"bytes,1,opt,name=basic,proto3,oneof"` +} + +type AuthHeader_Token struct { + Token *Token `protobuf:"bytes,2,opt,name=token,proto3,oneof"` +} + +func (*AuthHeader_Basic) isAuthHeader_AuthScheme() {} + +func (*AuthHeader_Token) isAuthHeader_AuthScheme() {} + +type Basic struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *Basic) Reset() { + *x = Basic{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_common_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Basic) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Basic) ProtoMessage() {} + +func (x *Basic) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_common_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Basic.ProtoReflect.Descriptor instead. +func (*Basic) Descriptor() ([]byte, []int) { + return file_greptime_v1_common_proto_rawDescGZIP(), []int{3} +} + +func (x *Basic) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *Basic) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type Token struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *Token) Reset() { + *x = Token{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_common_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Token) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Token) ProtoMessage() {} + +func (x *Token) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_common_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Token.ProtoReflect.Descriptor instead. +func (*Token) Descriptor() ([]byte, []int) { + return file_greptime_v1_common_proto_rawDescGZIP(), []int{4} +} + +func (x *Token) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type AffectedRows struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *AffectedRows) Reset() { + *x = AffectedRows{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_common_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AffectedRows) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AffectedRows) ProtoMessage() {} + +func (x *AffectedRows) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_common_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AffectedRows.ProtoReflect.Descriptor instead. +func (*AffectedRows) Descriptor() ([]byte, []int) { + return file_greptime_v1_common_proto_rawDescGZIP(), []int{5} +} + +func (x *AffectedRows) GetValue() uint32 { + if x != nil { + return x.Value + } + return 0 +} + +type FlightMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AffectedRows *AffectedRows `protobuf:"bytes,1,opt,name=affected_rows,json=affectedRows,proto3" json:"affected_rows,omitempty"` +} + +func (x *FlightMetadata) Reset() { + *x = FlightMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_common_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FlightMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FlightMetadata) ProtoMessage() {} + +func (x *FlightMetadata) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_common_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FlightMetadata.ProtoReflect.Descriptor instead. +func (*FlightMetadata) Descriptor() ([]byte, []int) { + return file_greptime_v1_common_proto_rawDescGZIP(), []int{6} +} + +func (x *FlightMetadata) GetAffectedRows() *AffectedRows { + if x != nil { + return x.AffectedRows + } + return nil +} + +var File_greptime_v1_common_proto protoreflect.FileDescriptor + +var file_greptime_v1_common_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x67, 0x72, 0x65, 0x70, + 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x22, 0x10, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x22, 0x98, 0x01, 0x0a, 0x0d, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3d, 0x0a, + 0x0d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, + 0x64, 0x62, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x62, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x73, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x05, 0x62, 0x61, 0x73, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x42, 0x61, 0x73, 0x69, 0x63, 0x48, 0x00, 0x52, 0x05, 0x62, 0x61, 0x73, 0x69, 0x63, 0x12, 0x2a, + 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x61, 0x75, + 0x74, 0x68, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3f, 0x0a, 0x05, 0x42, 0x61, 0x73, + 0x69, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, + 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x1d, 0x0a, 0x05, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x24, 0x0a, 0x0c, 0x41, 0x66, 0x66, + 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x50, 0x0a, 0x0e, 0x46, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x3e, 0x0a, 0x0d, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x72, 0x6f, + 0x77, 0x73, 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, 0x42, 0x4f, 0x0a, 0x0e, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, + 0x2e, 0x76, 0x31, 0x42, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 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 ( + file_greptime_v1_common_proto_rawDescOnce sync.Once + file_greptime_v1_common_proto_rawDescData = file_greptime_v1_common_proto_rawDesc +) + +func file_greptime_v1_common_proto_rawDescGZIP() []byte { + file_greptime_v1_common_proto_rawDescOnce.Do(func() { + file_greptime_v1_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_greptime_v1_common_proto_rawDescData) + }) + return file_greptime_v1_common_proto_rawDescData +} + +var file_greptime_v1_common_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_greptime_v1_common_proto_goTypes = []interface{}{ + (*ResponseHeader)(nil), // 0: greptime.v1.ResponseHeader + (*RequestHeader)(nil), // 1: greptime.v1.RequestHeader + (*AuthHeader)(nil), // 2: greptime.v1.AuthHeader + (*Basic)(nil), // 3: greptime.v1.Basic + (*Token)(nil), // 4: greptime.v1.Token + (*AffectedRows)(nil), // 5: greptime.v1.AffectedRows + (*FlightMetadata)(nil), // 6: greptime.v1.FlightMetadata +} +var file_greptime_v1_common_proto_depIdxs = []int32{ + 2, // 0: greptime.v1.RequestHeader.authorization:type_name -> greptime.v1.AuthHeader + 3, // 1: greptime.v1.AuthHeader.basic:type_name -> greptime.v1.Basic + 4, // 2: greptime.v1.AuthHeader.token:type_name -> greptime.v1.Token + 5, // 3: greptime.v1.FlightMetadata.affected_rows:type_name -> greptime.v1.AffectedRows + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_greptime_v1_common_proto_init() } +func file_greptime_v1_common_proto_init() { + if File_greptime_v1_common_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_greptime_v1_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ResponseHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthHeader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Basic); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Token); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_common_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AffectedRows); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_common_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FlightMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_greptime_v1_common_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*AuthHeader_Basic)(nil), + (*AuthHeader_Token)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_greptime_v1_common_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_greptime_v1_common_proto_goTypes, + DependencyIndexes: file_greptime_v1_common_proto_depIdxs, + MessageInfos: file_greptime_v1_common_proto_msgTypes, + }.Build() + File_greptime_v1_common_proto = out.File + file_greptime_v1_common_proto_rawDesc = nil + file_greptime_v1_common_proto_goTypes = nil + file_greptime_v1_common_proto_depIdxs = nil +} diff --git a/go/greptime/v1/database.pb.go b/go/greptime/v1/database.pb.go index 0b76644..ccccad8 100644 --- a/go/greptime/v1/database.pb.go +++ b/go/greptime/v1/database.pb.go @@ -20,264 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type RequestHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The `catalog` that is selected to be used in this request. - Catalog string `protobuf:"bytes,1,opt,name=catalog,proto3" json:"catalog,omitempty"` - // The `schema` that is selected to be used in this request. - Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` - // The `authorization` header, much like http's authorization header. - Authorization *AuthHeader `protobuf:"bytes,3,opt,name=authorization,proto3" json:"authorization,omitempty"` - // The `dbname` for the request - Dbname string `protobuf:"bytes,4,opt,name=dbname,proto3" json:"dbname,omitempty"` -} - -func (x *RequestHeader) Reset() { - *x = RequestHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RequestHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestHeader) ProtoMessage() {} - -func (x *RequestHeader) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestHeader.ProtoReflect.Descriptor instead. -func (*RequestHeader) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{0} -} - -func (x *RequestHeader) GetCatalog() string { - if x != nil { - return x.Catalog - } - return "" -} - -func (x *RequestHeader) GetSchema() string { - if x != nil { - return x.Schema - } - return "" -} - -func (x *RequestHeader) GetAuthorization() *AuthHeader { - if x != nil { - return x.Authorization - } - return nil -} - -func (x *RequestHeader) GetDbname() string { - if x != nil { - return x.Dbname - } - return "" -} - -type AuthHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to AuthScheme: - // - // *AuthHeader_Basic - // *AuthHeader_Token - AuthScheme isAuthHeader_AuthScheme `protobuf_oneof:"auth_scheme"` -} - -func (x *AuthHeader) Reset() { - *x = AuthHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthHeader) ProtoMessage() {} - -func (x *AuthHeader) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthHeader.ProtoReflect.Descriptor instead. -func (*AuthHeader) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{1} -} - -func (m *AuthHeader) GetAuthScheme() isAuthHeader_AuthScheme { - if m != nil { - return m.AuthScheme - } - return nil -} - -func (x *AuthHeader) GetBasic() *Basic { - if x, ok := x.GetAuthScheme().(*AuthHeader_Basic); ok { - return x.Basic - } - return nil -} - -func (x *AuthHeader) GetToken() *Token { - if x, ok := x.GetAuthScheme().(*AuthHeader_Token); ok { - return x.Token - } - return nil -} - -type isAuthHeader_AuthScheme interface { - isAuthHeader_AuthScheme() -} - -type AuthHeader_Basic struct { - Basic *Basic `protobuf:"bytes,1,opt,name=basic,proto3,oneof"` -} - -type AuthHeader_Token struct { - Token *Token `protobuf:"bytes,2,opt,name=token,proto3,oneof"` -} - -func (*AuthHeader_Basic) isAuthHeader_AuthScheme() {} - -func (*AuthHeader_Token) isAuthHeader_AuthScheme() {} - -type Basic struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` -} - -func (x *Basic) Reset() { - *x = Basic{} - if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Basic) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Basic) ProtoMessage() {} - -func (x *Basic) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Basic.ProtoReflect.Descriptor instead. -func (*Basic) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{2} -} - -func (x *Basic) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *Basic) GetPassword() string { - if x != nil { - return x.Password - } - return "" -} - -type Token struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` -} - -func (x *Token) Reset() { - *x = Token{} - if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Token) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Token) ProtoMessage() {} - -func (x *Token) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Token.ProtoReflect.Descriptor instead. -func (*Token) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{3} -} - -func (x *Token) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - type GreptimeRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -295,7 +37,7 @@ type GreptimeRequest struct { func (x *GreptimeRequest) Reset() { *x = GreptimeRequest{} if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[4] + mi := &file_greptime_v1_database_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -308,7 +50,7 @@ func (x *GreptimeRequest) String() string { func (*GreptimeRequest) ProtoMessage() {} func (x *GreptimeRequest) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[4] + mi := &file_greptime_v1_database_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -321,7 +63,7 @@ func (x *GreptimeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GreptimeRequest.ProtoReflect.Descriptor instead. func (*GreptimeRequest) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{4} + return file_greptime_v1_database_proto_rawDescGZIP(), []int{0} } func (x *GreptimeRequest) GetHeader() *RequestHeader { @@ -381,44 +123,6 @@ func (*GreptimeRequest_Query) isGreptimeRequest_Request() {} func (*GreptimeRequest_Ddl) isGreptimeRequest_Request() {} -type ResponseHeader struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ResponseHeader) Reset() { - *x = ResponseHeader{} - if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResponseHeader) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResponseHeader) ProtoMessage() {} - -func (x *ResponseHeader) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResponseHeader.ProtoReflect.Descriptor instead. -func (*ResponseHeader) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{5} -} - type GreptimeResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -434,7 +138,7 @@ type GreptimeResponse struct { func (x *GreptimeResponse) Reset() { *x = GreptimeResponse{} if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[6] + mi := &file_greptime_v1_database_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -447,7 +151,7 @@ func (x *GreptimeResponse) String() string { func (*GreptimeResponse) ProtoMessage() {} func (x *GreptimeResponse) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[6] + mi := &file_greptime_v1_database_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -460,7 +164,7 @@ func (x *GreptimeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GreptimeResponse.ProtoReflect.Descriptor instead. func (*GreptimeResponse) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{6} + return file_greptime_v1_database_proto_rawDescGZIP(), []int{1} } func (x *GreptimeResponse) GetHeader() *ResponseHeader { @@ -510,7 +214,7 @@ type QueryRequest struct { func (x *QueryRequest) Reset() { *x = QueryRequest{} if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[7] + mi := &file_greptime_v1_database_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -523,7 +227,7 @@ func (x *QueryRequest) String() string { func (*QueryRequest) ProtoMessage() {} func (x *QueryRequest) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[7] + mi := &file_greptime_v1_database_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -536,7 +240,7 @@ func (x *QueryRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead. func (*QueryRequest) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{7} + return file_greptime_v1_database_proto_rawDescGZIP(), []int{2} } func (m *QueryRequest) GetQuery() isQueryRequest_Query { @@ -589,77 +293,6 @@ func (*QueryRequest_LogicalPlan) isQueryRequest_Query() {} func (*QueryRequest_PromRangeQuery) isQueryRequest_Query() {} -type PromRangeQuery struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` - Start string `protobuf:"bytes,2,opt,name=start,proto3" json:"start,omitempty"` - End string `protobuf:"bytes,3,opt,name=end,proto3" json:"end,omitempty"` - Step string `protobuf:"bytes,4,opt,name=step,proto3" json:"step,omitempty"` -} - -func (x *PromRangeQuery) Reset() { - *x = PromRangeQuery{} - if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PromRangeQuery) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PromRangeQuery) ProtoMessage() {} - -func (x *PromRangeQuery) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PromRangeQuery.ProtoReflect.Descriptor instead. -func (*PromRangeQuery) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{8} -} - -func (x *PromRangeQuery) GetQuery() string { - if x != nil { - return x.Query - } - return "" -} - -func (x *PromRangeQuery) GetStart() string { - if x != nil { - return x.Start - } - return "" -} - -func (x *PromRangeQuery) GetEnd() string { - if x != nil { - return x.End - } - return "" -} - -func (x *PromRangeQuery) GetStep() string { - if x != nil { - return x.Step - } - return "" -} - type InsertRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -679,7 +312,7 @@ type InsertRequest struct { func (x *InsertRequest) Reset() { *x = InsertRequest{} if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[9] + mi := &file_greptime_v1_database_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -692,7 +325,7 @@ func (x *InsertRequest) String() string { func (*InsertRequest) ProtoMessage() {} func (x *InsertRequest) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[9] + mi := &file_greptime_v1_database_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -705,7 +338,7 @@ func (x *InsertRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use InsertRequest.ProtoReflect.Descriptor instead. func (*InsertRequest) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{9} + return file_greptime_v1_database_proto_rawDescGZIP(), []int{3} } func (x *InsertRequest) GetTableName() string { @@ -736,100 +369,6 @@ func (x *InsertRequest) GetRegionNumber() uint32 { return 0 } -type AffectedRows struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *AffectedRows) Reset() { - *x = AffectedRows{} - if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AffectedRows) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AffectedRows) ProtoMessage() {} - -func (x *AffectedRows) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AffectedRows.ProtoReflect.Descriptor instead. -func (*AffectedRows) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{10} -} - -func (x *AffectedRows) GetValue() uint32 { - if x != nil { - return x.Value - } - return 0 -} - -type FlightMetadata struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AffectedRows *AffectedRows `protobuf:"bytes,1,opt,name=affected_rows,json=affectedRows,proto3" json:"affected_rows,omitempty"` -} - -func (x *FlightMetadata) Reset() { - *x = FlightMetadata{} - if protoimpl.UnsafeEnabled { - mi := &file_greptime_v1_database_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FlightMetadata) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FlightMetadata) ProtoMessage() {} - -func (x *FlightMetadata) ProtoReflect() protoreflect.Message { - mi := &file_greptime_v1_database_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FlightMetadata.ProtoReflect.Descriptor instead. -func (*FlightMetadata) Descriptor() ([]byte, []int) { - return file_greptime_v1_database_proto_rawDescGZIP(), []int{11} -} - -func (x *FlightMetadata) GetAffectedRows() *AffectedRows { - if x != nil { - return x.AffectedRows - } - return nil -} - var File_greptime_v1_database_proto protoreflect.FileDescriptor var file_greptime_v1_database_proto_rawDesc = []byte{ @@ -838,46 +377,25 @@ var file_greptime_v1_database_proto_rawDesc = []byte{ 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x15, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x64, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, - 0x6c, 0x75, 0x6d, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, 0x01, 0x0a, 0x0d, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, - 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3d, - 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, - 0x06, 0x64, 0x62, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, - 0x62, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x73, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x05, 0x62, 0x61, 0x73, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x48, 0x00, 0x52, 0x05, 0x62, 0x61, 0x73, 0x69, 0x63, 0x12, - 0x2a, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x61, - 0x75, 0x74, 0x68, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3f, 0x0a, 0x05, 0x42, 0x61, - 0x73, 0x69, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x1d, 0x0a, 0x05, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xe6, 0x01, 0x0a, 0x0f, 0x47, - 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, - 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x12, 0x34, 0x0a, 0x06, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, - 0x52, 0x06, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, - 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x48, 0x00, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x2b, 0x0a, 0x03, 0x64, - 0x64, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, - 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x64, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x48, 0x00, 0x52, 0x03, 0x64, 0x64, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x22, 0x10, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x22, 0x95, 0x01, 0x0a, 0x10, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, + 0x6c, 0x75, 0x6d, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x67, 0x72, 0x65, 0x70, + 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x18, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6, 0x01, 0x0a, + 0x0f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x32, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x06, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x48, 0x00, 0x52, 0x06, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x72, 0x65, 0x70, + 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x2b, 0x0a, + 0x03, 0x64, 0x64, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x65, + 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x64, 0x6c, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x03, 0x64, 0x64, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x10, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, @@ -896,47 +414,34 @@ var file_greptime_v1_database_proto_rawDesc = []byte{ 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6d, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, 0x00, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x6d, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x42, 0x07, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x62, 0x0a, 0x0e, 0x50, 0x72, 0x6f, - 0x6d, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x71, - 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x22, 0x9f, 0x01, - 0x0a, 0x0d, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2d, - 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x13, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, - 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x1b, 0x0a, - 0x09, 0x72, 0x6f, 0x77, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x08, 0x72, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, - 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x0c, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, - 0x24, 0x0a, 0x0c, 0x41, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x50, 0x0a, 0x0e, 0x46, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3e, 0x0a, 0x0d, 0x61, 0x66, 0x66, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x77, 0x73, 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, 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, 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, + 0x42, 0x07, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x9f, 0x01, 0x0a, 0x0d, 0x49, 0x6e, + 0x73, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x63, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x72, + 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, + 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x77, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x72, 0x6f, + 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x72, + 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x32, 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, 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 ( @@ -951,45 +456,37 @@ func file_greptime_v1_database_proto_rawDescGZIP() []byte { return file_greptime_v1_database_proto_rawDescData } -var file_greptime_v1_database_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_greptime_v1_database_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_greptime_v1_database_proto_goTypes = []interface{}{ - (*RequestHeader)(nil), // 0: greptime.v1.RequestHeader - (*AuthHeader)(nil), // 1: greptime.v1.AuthHeader - (*Basic)(nil), // 2: greptime.v1.Basic - (*Token)(nil), // 3: greptime.v1.Token - (*GreptimeRequest)(nil), // 4: greptime.v1.GreptimeRequest - (*ResponseHeader)(nil), // 5: greptime.v1.ResponseHeader - (*GreptimeResponse)(nil), // 6: greptime.v1.GreptimeResponse - (*QueryRequest)(nil), // 7: greptime.v1.QueryRequest + (*GreptimeRequest)(nil), // 0: greptime.v1.GreptimeRequest + (*GreptimeResponse)(nil), // 1: greptime.v1.GreptimeResponse + (*QueryRequest)(nil), // 2: greptime.v1.QueryRequest + (*InsertRequest)(nil), // 3: greptime.v1.InsertRequest + (*RequestHeader)(nil), // 4: greptime.v1.RequestHeader + (*DdlRequest)(nil), // 5: greptime.v1.DdlRequest + (*ResponseHeader)(nil), // 6: greptime.v1.ResponseHeader + (*AffectedRows)(nil), // 7: greptime.v1.AffectedRows (*PromRangeQuery)(nil), // 8: greptime.v1.PromRangeQuery - (*InsertRequest)(nil), // 9: greptime.v1.InsertRequest - (*AffectedRows)(nil), // 10: greptime.v1.AffectedRows - (*FlightMetadata)(nil), // 11: greptime.v1.FlightMetadata - (*DdlRequest)(nil), // 12: greptime.v1.DdlRequest - (*Column)(nil), // 13: greptime.v1.Column + (*Column)(nil), // 9: greptime.v1.Column } var file_greptime_v1_database_proto_depIdxs = []int32{ - 1, // 0: greptime.v1.RequestHeader.authorization:type_name -> greptime.v1.AuthHeader - 2, // 1: greptime.v1.AuthHeader.basic:type_name -> greptime.v1.Basic - 3, // 2: greptime.v1.AuthHeader.token:type_name -> greptime.v1.Token - 0, // 3: greptime.v1.GreptimeRequest.header:type_name -> greptime.v1.RequestHeader - 9, // 4: greptime.v1.GreptimeRequest.insert:type_name -> greptime.v1.InsertRequest - 7, // 5: greptime.v1.GreptimeRequest.query:type_name -> greptime.v1.QueryRequest - 12, // 6: greptime.v1.GreptimeRequest.ddl:type_name -> greptime.v1.DdlRequest - 5, // 7: greptime.v1.GreptimeResponse.header:type_name -> greptime.v1.ResponseHeader - 10, // 8: greptime.v1.GreptimeResponse.affected_rows:type_name -> greptime.v1.AffectedRows - 8, // 9: greptime.v1.QueryRequest.prom_range_query:type_name -> greptime.v1.PromRangeQuery - 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 - 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 + 4, // 0: greptime.v1.GreptimeRequest.header:type_name -> greptime.v1.RequestHeader + 3, // 1: greptime.v1.GreptimeRequest.insert:type_name -> greptime.v1.InsertRequest + 2, // 2: greptime.v1.GreptimeRequest.query:type_name -> greptime.v1.QueryRequest + 5, // 3: greptime.v1.GreptimeRequest.ddl:type_name -> greptime.v1.DdlRequest + 6, // 4: greptime.v1.GreptimeResponse.header:type_name -> greptime.v1.ResponseHeader + 7, // 5: greptime.v1.GreptimeResponse.affected_rows:type_name -> greptime.v1.AffectedRows + 8, // 6: greptime.v1.QueryRequest.prom_range_query:type_name -> greptime.v1.PromRangeQuery + 9, // 7: greptime.v1.InsertRequest.columns:type_name -> greptime.v1.Column + 0, // 8: greptime.v1.GreptimeDatabase.Handle:input_type -> greptime.v1.GreptimeRequest + 0, // 9: greptime.v1.GreptimeDatabase.HandleRequests:input_type -> greptime.v1.GreptimeRequest + 1, // 10: greptime.v1.GreptimeDatabase.Handle:output_type -> greptime.v1.GreptimeResponse + 1, // 11: greptime.v1.GreptimeDatabase.HandleRequests:output_type -> greptime.v1.GreptimeResponse + 10, // [10:12] is the sub-list for method output_type + 8, // [8:10] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_greptime_v1_database_proto_init() } @@ -999,56 +496,10 @@ func file_greptime_v1_database_proto_init() { } file_greptime_v1_ddl_proto_init() file_greptime_v1_column_proto_init() + file_greptime_v1_prom_proto_init() + file_greptime_v1_common_proto_init() if !protoimpl.UnsafeEnabled { file_greptime_v1_database_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_greptime_v1_database_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_greptime_v1_database_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Basic); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_greptime_v1_database_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Token); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_greptime_v1_database_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GreptimeRequest); i { case 0: return &v.state @@ -1060,19 +511,7 @@ func file_greptime_v1_database_proto_init() { return nil } } - file_greptime_v1_database_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResponseHeader); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_greptime_v1_database_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_greptime_v1_database_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GreptimeResponse); i { case 0: return &v.state @@ -1084,7 +523,7 @@ func file_greptime_v1_database_proto_init() { return nil } } - file_greptime_v1_database_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_greptime_v1_database_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryRequest); i { case 0: return &v.state @@ -1096,19 +535,7 @@ func file_greptime_v1_database_proto_init() { return nil } } - file_greptime_v1_database_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PromRangeQuery); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_greptime_v1_database_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_greptime_v1_database_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InsertRequest); i { case 0: return &v.state @@ -1120,44 +547,16 @@ func file_greptime_v1_database_proto_init() { return nil } } - file_greptime_v1_database_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AffectedRows); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_greptime_v1_database_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FlightMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } - file_greptime_v1_database_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*AuthHeader_Basic)(nil), - (*AuthHeader_Token)(nil), - } - file_greptime_v1_database_proto_msgTypes[4].OneofWrappers = []interface{}{ + file_greptime_v1_database_proto_msgTypes[0].OneofWrappers = []interface{}{ (*GreptimeRequest_Insert)(nil), (*GreptimeRequest_Query)(nil), (*GreptimeRequest_Ddl)(nil), } - file_greptime_v1_database_proto_msgTypes[6].OneofWrappers = []interface{}{ + file_greptime_v1_database_proto_msgTypes[1].OneofWrappers = []interface{}{ (*GreptimeResponse_AffectedRows)(nil), } - file_greptime_v1_database_proto_msgTypes[7].OneofWrappers = []interface{}{ + file_greptime_v1_database_proto_msgTypes[2].OneofWrappers = []interface{}{ (*QueryRequest_Sql)(nil), (*QueryRequest_LogicalPlan)(nil), (*QueryRequest_PromRangeQuery)(nil), @@ -1168,7 +567,7 @@ func file_greptime_v1_database_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_greptime_v1_database_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/go/greptime/v1/prom.pb.go b/go/greptime/v1/prom.pb.go new file mode 100644 index 0000000..714d0c0 --- /dev/null +++ b/go/greptime/v1/prom.pb.go @@ -0,0 +1,380 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.6 +// source: greptime/v1/prom.proto + +package v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type PromqlRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // Types that are assignable to Promql: + // + // *PromqlRequest_Query + // *PromqlRequest_RangeQuery + Promql isPromqlRequest_Promql `protobuf_oneof:"promql"` +} + +func (x *PromqlRequest) Reset() { + *x = PromqlRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_prom_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PromqlRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PromqlRequest) ProtoMessage() {} + +func (x *PromqlRequest) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_prom_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PromqlRequest.ProtoReflect.Descriptor instead. +func (*PromqlRequest) Descriptor() ([]byte, []int) { + return file_greptime_v1_prom_proto_rawDescGZIP(), []int{0} +} + +func (x *PromqlRequest) GetHeader() *RequestHeader { + if x != nil { + return x.Header + } + return nil +} + +func (m *PromqlRequest) GetPromql() isPromqlRequest_Promql { + if m != nil { + return m.Promql + } + return nil +} + +func (x *PromqlRequest) GetQuery() string { + if x, ok := x.GetPromql().(*PromqlRequest_Query); ok { + return x.Query + } + return "" +} + +func (x *PromqlRequest) GetRangeQuery() *PromRangeQuery { + if x, ok := x.GetPromql().(*PromqlRequest_RangeQuery); ok { + return x.RangeQuery + } + return nil +} + +type isPromqlRequest_Promql interface { + isPromqlRequest_Promql() +} + +type PromqlRequest_Query struct { + Query string `protobuf:"bytes,2,opt,name=query,proto3,oneof"` +} + +type PromqlRequest_RangeQuery struct { + RangeQuery *PromRangeQuery `protobuf:"bytes,3,opt,name=range_query,json=rangeQuery,proto3,oneof"` +} + +func (*PromqlRequest_Query) isPromqlRequest_Promql() {} + +func (*PromqlRequest_RangeQuery) isPromqlRequest_Promql() {} + +type PromqlResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` // absolutely same format as Prometheus in JSON +} + +func (x *PromqlResponse) Reset() { + *x = PromqlResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_prom_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PromqlResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PromqlResponse) ProtoMessage() {} + +func (x *PromqlResponse) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_prom_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PromqlResponse.ProtoReflect.Descriptor instead. +func (*PromqlResponse) Descriptor() ([]byte, []int) { + return file_greptime_v1_prom_proto_rawDescGZIP(), []int{1} +} + +func (x *PromqlResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *PromqlResponse) GetBody() []byte { + if x != nil { + return x.Body + } + return nil +} + +type PromRangeQuery struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + Start string `protobuf:"bytes,2,opt,name=start,proto3" json:"start,omitempty"` + End string `protobuf:"bytes,3,opt,name=end,proto3" json:"end,omitempty"` + Step string `protobuf:"bytes,4,opt,name=step,proto3" json:"step,omitempty"` +} + +func (x *PromRangeQuery) Reset() { + *x = PromRangeQuery{} + if protoimpl.UnsafeEnabled { + mi := &file_greptime_v1_prom_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PromRangeQuery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PromRangeQuery) ProtoMessage() {} + +func (x *PromRangeQuery) ProtoReflect() protoreflect.Message { + mi := &file_greptime_v1_prom_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PromRangeQuery.ProtoReflect.Descriptor instead. +func (*PromRangeQuery) Descriptor() ([]byte, []int) { + return file_greptime_v1_prom_proto_rawDescGZIP(), []int{2} +} + +func (x *PromRangeQuery) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *PromRangeQuery) GetStart() string { + if x != nil { + return x.Start + } + return "" +} + +func (x *PromRangeQuery) GetEnd() string { + if x != nil { + return x.End + } + return "" +} + +func (x *PromRangeQuery) GetStep() string { + if x != nil { + return x.Step + } + return "" +} + +var File_greptime_v1_prom_proto protoreflect.FileDescriptor + +var file_greptime_v1_prom_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, + 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, + 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x18, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, + 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xa5, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x6d, 0x71, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x32, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x3e, 0x0a, + 0x0b, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x50, 0x72, 0x6f, 0x6d, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x48, + 0x00, 0x52, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x08, 0x0a, + 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x71, 0x6c, 0x22, 0x59, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x6d, 0x71, + 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x72, 0x65, 0x70, + 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x22, 0x62, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x6d, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, + 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x32, 0x56, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x6d, 0x65, 0x74, + 0x68, 0x65, 0x75, 0x73, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x48, + 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x1a, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6d, 0x71, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1b, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x50, 0x72, 0x6f, 0x6d, 0x71, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x53, + 0x0a, 0x0e, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, + 0x42, 0x0a, 0x50, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 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 ( + file_greptime_v1_prom_proto_rawDescOnce sync.Once + file_greptime_v1_prom_proto_rawDescData = file_greptime_v1_prom_proto_rawDesc +) + +func file_greptime_v1_prom_proto_rawDescGZIP() []byte { + file_greptime_v1_prom_proto_rawDescOnce.Do(func() { + file_greptime_v1_prom_proto_rawDescData = protoimpl.X.CompressGZIP(file_greptime_v1_prom_proto_rawDescData) + }) + return file_greptime_v1_prom_proto_rawDescData +} + +var file_greptime_v1_prom_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_greptime_v1_prom_proto_goTypes = []interface{}{ + (*PromqlRequest)(nil), // 0: greptime.v1.PromqlRequest + (*PromqlResponse)(nil), // 1: greptime.v1.PromqlResponse + (*PromRangeQuery)(nil), // 2: greptime.v1.PromRangeQuery + (*RequestHeader)(nil), // 3: greptime.v1.RequestHeader + (*ResponseHeader)(nil), // 4: greptime.v1.ResponseHeader +} +var file_greptime_v1_prom_proto_depIdxs = []int32{ + 3, // 0: greptime.v1.PromqlRequest.header:type_name -> greptime.v1.RequestHeader + 2, // 1: greptime.v1.PromqlRequest.range_query:type_name -> greptime.v1.PromRangeQuery + 4, // 2: greptime.v1.PromqlResponse.header:type_name -> greptime.v1.ResponseHeader + 0, // 3: greptime.v1.PrometheusGateway.Handle:input_type -> greptime.v1.PromqlRequest + 1, // 4: greptime.v1.PrometheusGateway.Handle:output_type -> greptime.v1.PromqlResponse + 4, // [4:5] is the sub-list for method output_type + 3, // [3:4] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_greptime_v1_prom_proto_init() } +func file_greptime_v1_prom_proto_init() { + if File_greptime_v1_prom_proto != nil { + return + } + file_greptime_v1_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_greptime_v1_prom_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PromqlRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_prom_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PromqlResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_greptime_v1_prom_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PromRangeQuery); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_greptime_v1_prom_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*PromqlRequest_Query)(nil), + (*PromqlRequest_RangeQuery)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_greptime_v1_prom_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_greptime_v1_prom_proto_goTypes, + DependencyIndexes: file_greptime_v1_prom_proto_depIdxs, + MessageInfos: file_greptime_v1_prom_proto_msgTypes, + }.Build() + File_greptime_v1_prom_proto = out.File + file_greptime_v1_prom_proto_rawDesc = nil + file_greptime_v1_prom_proto_goTypes = nil + file_greptime_v1_prom_proto_depIdxs = nil +} diff --git a/go/greptime/v1/prom_grpc.pb.go b/go/greptime/v1/prom_grpc.pb.go new file mode 100644 index 0000000..4751886 --- /dev/null +++ b/go/greptime/v1/prom_grpc.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.6 +// source: greptime/v1/prom.proto + +package v1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// PrometheusGatewayClient is the client API for PrometheusGateway service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PrometheusGatewayClient interface { + Handle(ctx context.Context, in *PromqlRequest, opts ...grpc.CallOption) (*PromqlResponse, error) +} + +type prometheusGatewayClient struct { + cc grpc.ClientConnInterface +} + +func NewPrometheusGatewayClient(cc grpc.ClientConnInterface) PrometheusGatewayClient { + return &prometheusGatewayClient{cc} +} + +func (c *prometheusGatewayClient) Handle(ctx context.Context, in *PromqlRequest, opts ...grpc.CallOption) (*PromqlResponse, error) { + out := new(PromqlResponse) + err := c.cc.Invoke(ctx, "/greptime.v1.PrometheusGateway/Handle", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PrometheusGatewayServer is the server API for PrometheusGateway service. +// All implementations must embed UnimplementedPrometheusGatewayServer +// for forward compatibility +type PrometheusGatewayServer interface { + Handle(context.Context, *PromqlRequest) (*PromqlResponse, error) + mustEmbedUnimplementedPrometheusGatewayServer() +} + +// UnimplementedPrometheusGatewayServer must be embedded to have forward compatible implementations. +type UnimplementedPrometheusGatewayServer struct { +} + +func (UnimplementedPrometheusGatewayServer) Handle(context.Context, *PromqlRequest) (*PromqlResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Handle not implemented") +} +func (UnimplementedPrometheusGatewayServer) mustEmbedUnimplementedPrometheusGatewayServer() {} + +// UnsafePrometheusGatewayServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PrometheusGatewayServer will +// result in compilation errors. +type UnsafePrometheusGatewayServer interface { + mustEmbedUnimplementedPrometheusGatewayServer() +} + +func RegisterPrometheusGatewayServer(s grpc.ServiceRegistrar, srv PrometheusGatewayServer) { + s.RegisterService(&PrometheusGateway_ServiceDesc, srv) +} + +func _PrometheusGateway_Handle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PromqlRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PrometheusGatewayServer).Handle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/greptime.v1.PrometheusGateway/Handle", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PrometheusGatewayServer).Handle(ctx, req.(*PromqlRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PrometheusGateway_ServiceDesc is the grpc.ServiceDesc for PrometheusGateway service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PrometheusGateway_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "greptime.v1.PrometheusGateway", + HandlerType: (*PrometheusGatewayServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Handle", + Handler: _PrometheusGateway_Handle_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "greptime/v1/prom.proto", +} diff --git a/proto/greptime/v1/common.proto b/proto/greptime/v1/common.proto new file mode 100644 index 0000000..c168103 --- /dev/null +++ b/proto/greptime/v1/common.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +package greptime.v1; + +option java_package = "io.greptime.v1"; +option java_outer_classname = "Common"; +option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1"; + +message ResponseHeader {} + +message RequestHeader { + // The `catalog` that is selected to be used in this request. + string catalog = 1; + // The `schema` that is selected to be used in this request. + string schema = 2; + // The `authorization` header, much like http's authorization header. + AuthHeader authorization = 3; + // The `dbname` for the request + string dbname = 4; +} + +message AuthHeader { + oneof auth_scheme { + Basic basic = 1; + Token token = 2; + } +} + +message Basic { + string username = 1; + string password = 2; +} + +message Token { + string token = 1; +} + +message AffectedRows { + uint32 value = 1; +} + +message FlightMetadata { + AffectedRows affected_rows = 1; +} diff --git a/proto/greptime/v1/database.proto b/proto/greptime/v1/database.proto index 15426f8..c0db46c 100644 --- a/proto/greptime/v1/database.proto +++ b/proto/greptime/v1/database.proto @@ -8,6 +8,8 @@ option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1"; import "greptime/v1/ddl.proto"; import "greptime/v1/column.proto"; +import "greptime/v1/prom.proto"; +import "greptime/v1/common.proto"; service GreptimeDatabase { rpc Handle(GreptimeRequest) returns (GreptimeResponse); @@ -15,33 +17,6 @@ service GreptimeDatabase { rpc HandleRequests(stream GreptimeRequest) returns (GreptimeResponse); } -message RequestHeader { - // The `catalog` that is selected to be used in this request. - string catalog = 1; - // The `schema` that is selected to be used in this request. - string schema = 2; - // The `authorization` header, much like http's authorization header. - AuthHeader authorization = 3; - // The `dbname` for the request - string dbname = 4; -} - -message AuthHeader { - oneof auth_scheme { - Basic basic = 1; - Token token = 2; - } -} - -message Basic { - string username = 1; - string password = 2; -} - -message Token { - string token = 1; -} - message GreptimeRequest { RequestHeader header = 1; oneof request { @@ -51,8 +26,6 @@ message GreptimeRequest { } } -message ResponseHeader {} - message GreptimeResponse { ResponseHeader header = 1; oneof response { @@ -68,13 +41,6 @@ message QueryRequest { } } -message PromRangeQuery { - string query = 1; - string start = 2; - string end = 3; - string step = 4; -} - message InsertRequest { string table_name = 1; @@ -89,11 +55,3 @@ message InsertRequest { // The region number of current insert request. uint32 region_number = 5; } - -message AffectedRows { - uint32 value = 1; -} - -message FlightMetadata { - AffectedRows affected_rows = 1; -} diff --git a/proto/greptime/v1/prom.proto b/proto/greptime/v1/prom.proto new file mode 100644 index 0000000..8d10764 --- /dev/null +++ b/proto/greptime/v1/prom.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +package greptime.v1; + +option java_package = "io.greptime.v1"; +option java_outer_classname = "Prometheus"; +option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1"; + +import "greptime/v1/common.proto"; + +// PrometheusGateway behaves absolutely the same as Prometheus HTTP API +service PrometheusGateway { + rpc Handle(PromqlRequest) returns (PromqlResponse); +} + +message PromqlRequest { + RequestHeader header = 1; + oneof promql { + string query = 2; + PromRangeQuery range_query = 3; + } +} + +message PromqlResponse { + ResponseHeader header = 1; + bytes body = 2; // absolutely same format as Prometheus in JSON +} + +message PromRangeQuery { + string query = 1; + string start = 2; + string end = 3; + string step = 4; +}