From 32d60146e544d8fb2db2cd680955b1adab41d5cd Mon Sep 17 00:00:00 2001 From: jeremyhi Date: Tue, 7 Apr 2026 20:12:39 -0700 Subject: [PATCH] feat: prepare for crates.io publishing (#312) * feat: prepare for crates.io publishing Signed-off-by: jeremyhi * fix: exclude typos check Signed-off-by: jeremyhi * fix: add header for each file Signed-off-by: jeremyhi --------- Signed-off-by: jeremyhi --- .github/workflows/ci.yml | 17 +- .typos.toml | 1 + Cargo.toml | 19 +- Makefile | 2 +- README.md | 20 +- build.rs | 82 - src/generated/greptime.v1.flow.rs | 572 ++++ src/generated/greptime.v1.frontend.rs | 446 +++ src/generated/greptime.v1.index.rs | 246 ++ src/generated/greptime.v1.meta.rs | 4195 +++++++++++++++++++++++++ src/generated/greptime.v1.region.rs | 737 +++++ src/generated/greptime.v1.rs | 2792 ++++++++++++++++ src/generated/greptime_grpc_desc.bin | Bin 0 -> 183792 bytes src/generated/prometheus.rs | 532 ++++ src/generated/substrait_extension.rs | 240 ++ src/lib.rs | 4 +- src/v1.rs | 4 +- src/v1/flow.rs | 2 +- src/v1/frontend.rs | 2 +- src/v1/index.rs | 2 +- src/v1/meta.rs | 2 +- src/v1/region.rs | 2 +- xtask/Cargo.toml | 8 + xtask/src/main.rs | 158 + 24 files changed, 9971 insertions(+), 114 deletions(-) delete mode 100644 build.rs create mode 100644 src/generated/greptime.v1.flow.rs create mode 100644 src/generated/greptime.v1.frontend.rs create mode 100644 src/generated/greptime.v1.index.rs create mode 100644 src/generated/greptime.v1.meta.rs create mode 100644 src/generated/greptime.v1.region.rs create mode 100644 src/generated/greptime.v1.rs create mode 100644 src/generated/greptime_grpc_desc.bin create mode 100644 src/generated/prometheus.rs create mode 100644 src/generated/substrait_extension.rs create mode 100644 xtask/Cargo.toml create mode 100644 xtask/src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3928830..7810ecb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,9 +30,6 @@ jobs: uses: actions/setup-go@v5 with: go-version: "1.24.3" - - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.RUST_TOOLCHAIN }} @@ -40,9 +37,12 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Run cargo check run: cargo check --workspace --all-targets - - name: Generate protbuf + - uses: arduino/setup-protoc@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Generate protobuf run: | - make all + make all - name: Check protobuf generation run: | git diff --quiet || (echo "Fail: generated go protobuf in github action is different from pushed ones, please run 'make all'"; exit 1) @@ -68,9 +68,6 @@ jobs: timeout-minutes: 60 steps: - uses: actions/checkout@v4 - - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.RUST_TOOLCHAIN }} @@ -87,9 +84,6 @@ jobs: timeout-minutes: 60 steps: - uses: actions/checkout@v4 - - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.RUST_TOOLCHAIN }} @@ -98,4 +92,3 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Run cargo clippy run: cargo clippy --workspace --all-targets -- -D warnings -D clippy::print_stdout -D clippy::print_stderr - diff --git a/.typos.toml b/.typos.toml index e6af6d2..ba7d7ba 100644 --- a/.typos.toml +++ b/.typos.toml @@ -1,6 +1,7 @@ [files] extend-exclude = [ # Exclude all generated files + "src/generated/**", "**/greptime/v1/**", "java/**", "go/**", diff --git a/Cargo.toml b/Cargo.toml index b9547df..36545c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,23 @@ name = "greptime-proto" version = "0.1.0" edition = "2021" +description = "Rust protobuf bindings for GreptimeDB APIs." license = "Apache-2.0" +readme = "README.md" +repository = "https://github.com/GreptimeTeam/greptime-proto" +documentation = "https://docs.rs/greptime-proto" +keywords = ["greptime", "greptimedb", "grpc", "protobuf", "proto"] +categories = ["api-bindings"] +include = [ + "/Cargo.toml", + "/LICENSE", + "/README.md", + "/proto/**", + "/src/**", +] + +[workspace] +members = ["xtask"] [dependencies] prost = "0.14" @@ -13,6 +29,3 @@ strum = "0.25" strum_macros = "0.25" tonic = "0.14" tonic-prost = "0.14" - -[build-dependencies] -tonic-prost-build = "0.14" diff --git a/Makefile b/Makefile index 681470a..40be358 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ BUILDER_CONTAINER=namely/protoc-all:1.51_2 all: rust go java cpp rust: - cargo build + cargo run --manifest-path xtask/Cargo.toml -- generate-rust go: go-deps docker run --rm -t -w /greptime-proto \ diff --git a/README.md b/README.md index efd1085..cfacbdf 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,17 @@ # greptime-proto -GreptimeDB protobuf files. +GreptimeDB protobuf definitions and pre-generated Rust bindings. ## Build ### Requirement -- [google/protobuf][protobuf] v3 +- Rust consumers do not need `protoc`. +- Maintainers need [google/protobuf][protobuf] v3 to regenerate Rust bindings after `.proto` changes. ### Command -- **Compile for Rust** +- **Generate Rust bindings** ```console make rust @@ -34,12 +35,11 @@ GreptimeDB protobuf files. ### Rust -```Toml -# Add this repository as dependency to your Cargo.toml file: -greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git" } +```toml +greptime-proto = "0.1" ``` -```Rust +```rust // To use the GreptimeDB's gRPC service: use greptime_proto::v1::*; @@ -50,6 +50,12 @@ use greptime_proto::v1::meta::*; use greptime_proto::prometheus::remote::*; ``` +When working in this repository, regenerate the checked-in Rust bindings after `.proto` changes with: + +```console +cargo run --manifest-path xtask/Cargo.toml -- generate-rust +``` + ### Go Download the go module: diff --git a/build.rs b/build.rs deleted file mode 100644 index 5fde545..0000000 --- a/build.rs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2023 Greptime Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use std::path::PathBuf; - -fn main() { - let out_dir = PathBuf::from( - std::env::var("OUT_DIR") - .expect("cargo built-in env value 'OUT_DIR' must be set during compilation"), - ); - - tonic_prost_build::configure() - .file_descriptor_set_path(out_dir.join("greptime_grpc_desc.bin")) - .type_attribute( - ".greptime.v1.SemanticType", - "#[derive(::serde::Serialize, ::serde::Deserialize)]", - ) - .type_attribute( - ".greptime.v1.meta.Peer", - "#[derive(::serde::Serialize, ::serde::Deserialize)]", - ) - .type_attribute( - ".greptime.v1.meta.HeartbeatRequest.node_workloads", - "#[derive(::serde::Serialize, ::serde::Deserialize)]", - ) - .type_attribute( - ".greptime.v1.meta.DatanodeWorkloads", - "#[derive(::serde::Serialize, ::serde::Deserialize)]", - ) - .type_attribute( - ".greptime.v1.meta.FrontendWorkloads", - "#[derive(::serde::Serialize, ::serde::Deserialize)]", - ) - .type_attribute( - ".greptime.v1.meta.FlownodeWorkloads", - "#[derive(::serde::Serialize, ::serde::Deserialize)]", - ) - .enum_attribute( - "region.RegionRequest.body", - "#[derive(strum_macros::AsRefStr)]", - ) - .bytes(".greptime.v1.ArrowIpc") - .compile_protos( - &[ - "proto/greptime/v1/database.proto", - "proto/greptime/v1/health.proto", - "proto/greptime/v1/wal.proto", - "proto/greptime/v1/meta/common.proto", - "proto/greptime/v1/meta/heartbeat.proto", - "proto/greptime/v1/meta/config.proto", - "proto/greptime/v1/meta/route.proto", - "proto/greptime/v1/meta/ddl.proto", - "proto/greptime/v1/meta/region.proto", - "proto/greptime/v1/meta/store.proto", - "proto/greptime/v1/meta/lock.proto", - "proto/greptime/v1/meta/cluster.proto", - "proto/greptime/v1/meta/procedure.proto", - "proto/greptime/v1/region/server.proto", - "proto/greptime/v1/flow/server.proto", - "proto/greptime/v1/frontend/server.proto", - "proto/greptime/v1/index/bloom_filter.proto", - "proto/greptime/v1/index/inverted_index.proto", - "proto/greptime/v1/index/vector_index.proto", - "proto/prometheus/remote/remote.proto", - "proto/substrait_extension/promql_plan.proto", - "proto/substrait_extension/dist_plan.proto", - ], - &["proto"], - ) - .expect("compile proto"); -} diff --git a/src/generated/greptime.v1.flow.rs b/src/generated/greptime.v1.flow.rs new file mode 100644 index 0000000..00195c7 --- /dev/null +++ b/src/generated/greptime.v1.flow.rs @@ -0,0 +1,572 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DirtyWindowRequests { + /// The dirty time window requests. + /// Each request contains a table_id and a list of dirty timestamps. + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DirtyWindowRequest { + #[prost(uint32, tag = "1")] + pub table_id: u32, + /// Dirty timestamps. Used to mark this point in time as dirty, + /// so that the flow can be triggered to process the data. + #[prost(int64, repeated, tag = "2")] + pub timestamps: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FlowRequestHeader { + /// Encoded trace_id & span_id, follow the w3c Trace Context + /// + #[prost(map = "string, string", tag = "1")] + pub tracing_context: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + /// The contextual information of the query + #[prost(message, optional, tag = "2")] + pub query_context: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InsertRequests { + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InsertRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(message, optional, tag = "2")] + pub rows: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub partition_expr_version: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FlowRequest { + #[prost(message, optional, tag = "64")] + pub header: ::core::option::Option, + #[prost(oneof = "flow_request::Body", tags = "1, 2, 3")] + pub body: ::core::option::Option, +} +/// Nested message and enum types in `FlowRequest`. +pub mod flow_request { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Body { + #[prost(message, tag = "1")] + Create(super::CreateRequest), + #[prost(message, tag = "2")] + Drop(super::DropRequest), + #[prost(message, tag = "3")] + Flush(super::FlushFlow), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FlowResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub affected_rows: u64, + /// affected flow ids + #[prost(message, repeated, tag = "3")] + pub affected_flows: ::prost::alloc::vec::Vec, + #[prost(map = "string, bytes", tag = "4")] + pub extensions: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::vec::Vec, + >, +} +/// Create a flow +/// +/// Very similar to `ddl.CreateTaskExpr`, +/// replace `source_table_names` with `source_table_ids` +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateRequest { + #[prost(message, optional, tag = "1")] + pub flow_id: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub source_table_ids: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub sink_table_name: ::core::option::Option, + #[prost(bool, tag = "4")] + pub create_if_not_exists: bool, + /// Expire data older than the given duration seconds. + #[prost(message, optional, tag = "5")] + pub expire_after: ::core::option::Option, + #[prost(message, optional, tag = "10")] + pub eval_interval: ::core::option::Option, + #[prost(string, tag = "6")] + pub comment: ::prost::alloc::string::String, + #[prost(string, tag = "7")] + pub sql: ::prost::alloc::string::String, + #[prost(map = "string, string", tag = "8")] + pub flow_options: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + /// Set to true if the flow should be created or replaced. + #[prost(bool, tag = "9")] + pub or_replace: bool, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropRequest { + #[prost(message, optional, tag = "1")] + pub flow_id: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct FlushFlow { + #[prost(message, optional, tag = "1")] + pub flow_id: ::core::option::Option, +} +/// Generated client implementations. +pub mod flow_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct FlowClient { + inner: tonic::client::Grpc, + } + impl FlowClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl FlowClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> FlowClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + FlowClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Handle the control plane request for creating or removing a flow. + pub async fn handle_create_remove( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.flow.Flow/HandleCreateRemove", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.flow.Flow", "HandleCreateRemove")); + self.inner.unary(req, path, codec).await + } + /// Handle the data plane request for inserting or deleting rows + /// only expect `RegionRequest` to be one of `InsertRequests` or + /// `DeleteRequests` other types of `RegionRequest` will be ignored + pub async fn handle_mirror_request( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.flow.Flow/HandleMirrorRequest", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.flow.Flow", "HandleMirrorRequest")); + self.inner.unary(req, path, codec).await + } + pub async fn handle_mark_dirty_time_window( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.flow.Flow/HandleMarkDirtyTimeWindow", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("greptime.v1.flow.Flow", "HandleMarkDirtyTimeWindow"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod flow_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with FlowServer. + #[async_trait] + pub trait Flow: std::marker::Send + std::marker::Sync + 'static { + /// Handle the control plane request for creating or removing a flow. + async fn handle_create_remove( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Handle the data plane request for inserting or deleting rows + /// only expect `RegionRequest` to be one of `InsertRequests` or + /// `DeleteRequests` other types of `RegionRequest` will be ignored + async fn handle_mirror_request( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + async fn handle_mark_dirty_time_window( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + } + #[derive(Debug)] + pub struct FlowServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl FlowServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for FlowServer + where + T: Flow, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/greptime.v1.flow.Flow/HandleCreateRemove" => { + #[allow(non_camel_case_types)] + struct HandleCreateRemoveSvc(pub Arc); + impl tonic::server::UnaryService + for HandleCreateRemoveSvc { + type Response = super::FlowResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::handle_create_remove(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = HandleCreateRemoveSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.flow.Flow/HandleMirrorRequest" => { + #[allow(non_camel_case_types)] + struct HandleMirrorRequestSvc(pub Arc); + impl tonic::server::UnaryService + for HandleMirrorRequestSvc { + type Response = super::FlowResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::handle_mirror_request(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = HandleMirrorRequestSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.flow.Flow/HandleMarkDirtyTimeWindow" => { + #[allow(non_camel_case_types)] + struct HandleMarkDirtyTimeWindowSvc(pub Arc); + impl tonic::server::UnaryService + for HandleMarkDirtyTimeWindowSvc { + type Response = super::FlowResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::handle_mark_dirty_time_window(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = HandleMarkDirtyTimeWindowSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for FlowServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "greptime.v1.flow.Flow"; + impl tonic::server::NamedService for FlowServer { + const NAME: &'static str = SERVICE_NAME; + } +} diff --git a/src/generated/greptime.v1.frontend.rs b/src/generated/greptime.v1.frontend.rs new file mode 100644 index 0000000..f1adca4 --- /dev/null +++ b/src/generated/greptime.v1.frontend.rs @@ -0,0 +1,446 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ListProcessRequest { + #[prost(string, tag = "1")] + pub catalog: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListProcessResponse { + #[prost(message, repeated, tag = "1")] + pub processes: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct KillProcessRequest { + /// Frontend server address of process. + #[prost(string, tag = "1")] + pub server_addr: ::prost::alloc::string::String, + /// Catalog of process to kill. + #[prost(string, tag = "2")] + pub catalog: ::prost::alloc::string::String, + /// ID of process to kill. + #[prost(uint32, tag = "3")] + pub process_id: u32, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct KillProcessResponse { + /// Whether targeting process is successfully killed + #[prost(bool, tag = "1")] + pub success: bool, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ProcessInfo { + /// ID. + #[prost(uint32, tag = "1")] + pub id: u32, + /// Catalog of process. + #[prost(string, tag = "2")] + pub catalog: ::prost::alloc::string::String, + /// Involved schemas. + #[prost(string, repeated, tag = "3")] + pub schemas: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Query string. + #[prost(string, tag = "4")] + pub query: ::prost::alloc::string::String, + /// Start time. + #[prost(int64, tag = "5")] + pub start_timestamp: i64, + /// Client info. + #[prost(string, tag = "6")] + pub client: ::prost::alloc::string::String, + /// Frontend info of process. + #[prost(string, tag = "7")] + pub frontend: ::prost::alloc::string::String, +} +/// Generated client implementations. +pub mod frontend_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct FrontendClient { + inner: tonic::client::Grpc, + } + impl FrontendClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl FrontendClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> FrontendClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + FrontendClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// List all running processes on frontend. + pub async fn list_process( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.frontend.Frontend/ListProcess", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.frontend.Frontend", "ListProcess")); + self.inner.unary(req, path, codec).await + } + /// Kill a running process on frontend. + pub async fn kill_process( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.frontend.Frontend/KillProcess", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.frontend.Frontend", "KillProcess")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod frontend_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with FrontendServer. + #[async_trait] + pub trait Frontend: std::marker::Send + std::marker::Sync + 'static { + /// List all running processes on frontend. + async fn list_process( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Kill a running process on frontend. + async fn kill_process( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + #[derive(Debug)] + pub struct FrontendServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl FrontendServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for FrontendServer + where + T: Frontend, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/greptime.v1.frontend.Frontend/ListProcess" => { + #[allow(non_camel_case_types)] + struct ListProcessSvc(pub Arc); + impl< + T: Frontend, + > tonic::server::UnaryService + for ListProcessSvc { + type Response = super::ListProcessResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::list_process(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = ListProcessSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.frontend.Frontend/KillProcess" => { + #[allow(non_camel_case_types)] + struct KillProcessSvc(pub Arc); + impl< + T: Frontend, + > tonic::server::UnaryService + for KillProcessSvc { + type Response = super::KillProcessResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::kill_process(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = KillProcessSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for FrontendServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "greptime.v1.frontend.Frontend"; + impl tonic::server::NamedService for FrontendServer { + const NAME: &'static str = SERVICE_NAME; + } +} diff --git a/src/generated/greptime.v1.index.rs b/src/generated/greptime.v1.index.rs new file mode 100644 index 0000000..601bd52 --- /dev/null +++ b/src/generated/greptime.v1.index.rs @@ -0,0 +1,246 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file is @generated by prost-build. +/// BloomFilterMeta defines the metadata for a bloom filter. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BloomFilterMeta { + /// The number of rows per segment. + #[prost(uint64, tag = "1")] + pub rows_per_segment: u64, + /// The number of segments. + #[prost(uint64, tag = "2")] + pub segment_count: u64, + /// The number of total rows. + #[prost(uint64, tag = "3")] + pub row_count: u64, + /// The size of the bloom filter in bytes excluding the metadata. + #[prost(uint64, tag = "4")] + pub bloom_filter_size: u64, + /// The indices to the bloom filter location of each segment. + #[prost(uint64, repeated, tag = "5")] + pub segment_loc_indices: ::prost::alloc::vec::Vec, + /// The bloom filter locations. + #[prost(message, repeated, tag = "6")] + pub bloom_filter_locs: ::prost::alloc::vec::Vec, +} +/// BloomFilterLoc defines the location of a bloom filter. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct BloomFilterLoc { + /// The byte offset of the bloom filter data. + #[prost(uint64, tag = "1")] + pub offset: u64, + /// The size of the bloom filter data. + #[prost(uint64, tag = "2")] + pub size: u64, + /// The number of elements in the bloom filter. + #[prost(uint64, tag = "3")] + pub element_count: u64, +} +/// InvertedIndexMetas defines the metadata for an inverted index +/// within an inverted index blob. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InvertedIndexMetas { + /// A map of tag names to their respective metadata corresponding to an individual + /// inverted index within the inverted index blob. + #[prost(map = "string, message", tag = "1")] + pub metas: ::std::collections::HashMap< + ::prost::alloc::string::String, + InvertedIndexMeta, + >, + /// The total count of rows within the inverted index blob. + /// This is used to determine the number of segments within the bitmap. + #[prost(uint64, tag = "2")] + pub total_row_count: u64, + /// The number of rows per group for bitmap indexing which determines how rows are + /// batched for indexing. Each batch corresponds to a segment in the bitmap and allows + /// for efficient retrieval during queries by reducing the search space. + #[prost(uint64, tag = "3")] + pub segment_row_count: u64, +} +/// InvertedIndexMeta contains the metadata for a specific tag's inverted index. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct InvertedIndexMeta { + /// Name of the tag associated with the inverted index. + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + /// The base byte offset for this tag's inverted index data within the blob. + /// Other offsets in this message are relative to this base offset. + #[prost(uint64, tag = "2")] + pub base_offset: u64, + /// The total size in bytes of this tag's inverted index data, including bitmaps, + /// FST data. + #[prost(uint64, tag = "3")] + pub inverted_index_size: u64, + /// The byte offset of the Finite State Transducer (FST) data relative to the `base_offset`. + #[prost(uint32, tag = "4")] + pub relative_fst_offset: u32, + /// The size in bytes of the FST data. + #[prost(uint32, tag = "5")] + pub fst_size: u32, + /// The byte offset relative to the `base_offset` where the null bitmap for this tag + /// starts. + #[prost(uint32, tag = "6")] + pub relative_null_bitmap_offset: u32, + /// The size in bytes of the null bitmap. + #[prost(uint32, tag = "7")] + pub null_bitmap_size: u32, + /// Statistical information about the tag's inverted index. + #[prost(message, optional, tag = "8")] + pub stats: ::core::option::Option, + /// The type of bitmap used for indexing. + #[prost(enumeration = "BitmapType", tag = "9")] + pub bitmap_type: i32, +} +/// InvertedIndexStats provides statistical data on a tag's inverted index. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct InvertedIndexStats { + /// The count of null entries within the tag's column. + #[prost(uint64, tag = "1")] + pub null_count: u64, + /// The number of distinct values within the tag's column. + #[prost(uint64, tag = "2")] + pub distinct_count: u64, + /// The minimum value found within the tag's column, encoded as bytes. + #[prost(bytes = "vec", tag = "3")] + pub min_value: ::prost::alloc::vec::Vec, + /// The maximum value found within the tag's column, encoded as bytes. + #[prost(bytes = "vec", tag = "4")] + pub max_value: ::prost::alloc::vec::Vec, +} +/// BitmapType defines the type of bitmap used for indexing. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum BitmapType { + BitVec = 0, + Roaring = 1, +} +impl BitmapType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::BitVec => "BitVec", + Self::Roaring => "Roaring", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "BitVec" => Some(Self::BitVec), + "Roaring" => Some(Self::Roaring), + _ => None, + } + } +} +/// Metadata for a vector index blob (stored as footer). +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct VectorIndexMeta { + /// Index engine type. + #[prost(enumeration = "VectorIndexEngine", tag = "1")] + pub engine: i32, + /// Vector dimension. + #[prost(uint32, tag = "2")] + pub dim: u32, + /// Distance metric. + #[prost(enumeration = "VectorDistanceMetric", tag = "3")] + pub metric: i32, + /// HNSW connectivity parameter. + #[prost(uint32, tag = "4")] + pub connectivity: u32, + /// HNSW expansion factor during index construction. + #[prost(uint32, tag = "5")] + pub expansion_add: u32, + /// HNSW expansion factor during search. + #[prost(uint32, tag = "6")] + pub expansion_search: u32, + /// Byte length of the null bitmap (RoaringBitmap serialized). + #[prost(uint32, tag = "7")] + pub null_bitmap_size: u32, + /// Byte length of the vector index data (engine-specific serialized format). + #[prost(uint64, tag = "8")] + pub index_size: u64, + /// Statistics about the vector index. + #[prost(message, optional, tag = "9")] + pub stats: ::core::option::Option, +} +/// Statistics for a vector index. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct VectorIndexStats { + /// Total number of rows in the SST. + #[prost(uint64, tag = "1")] + pub total_row_count: u64, + /// Number of rows with valid vectors (indexed). + #[prost(uint64, tag = "2")] + pub indexed_row_count: u64, + /// Number of null vectors. + #[prost(uint64, tag = "3")] + pub null_count: u64, +} +/// Vector index engine types. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum VectorIndexEngine { + Usearch = 0, +} +impl VectorIndexEngine { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Usearch => "VECTOR_INDEX_ENGINE_USEARCH", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VECTOR_INDEX_ENGINE_USEARCH" => Some(Self::Usearch), + _ => None, + } + } +} +/// Vector distance metrics. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum VectorDistanceMetric { + L2sq = 0, + Cosine = 1, + InnerProduct = 2, +} +impl VectorDistanceMetric { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::L2sq => "VECTOR_DISTANCE_METRIC_L2SQ", + Self::Cosine => "VECTOR_DISTANCE_METRIC_COSINE", + Self::InnerProduct => "VECTOR_DISTANCE_METRIC_INNER_PRODUCT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VECTOR_DISTANCE_METRIC_L2SQ" => Some(Self::L2sq), + "VECTOR_DISTANCE_METRIC_COSINE" => Some(Self::Cosine), + "VECTOR_DISTANCE_METRIC_INNER_PRODUCT" => Some(Self::InnerProduct), + _ => None, + } + } +} diff --git a/src/generated/greptime.v1.meta.rs b/src/generated/greptime.v1.meta.rs new file mode 100644 index 0000000..004aaad --- /dev/null +++ b/src/generated/greptime.v1.meta.rs @@ -0,0 +1,4195 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestHeader { + #[prost(uint64, tag = "1")] + pub protocol_version: u64, + /// member_id is the ID of the sender server. + #[prost(uint64, tag = "3")] + pub member_id: u64, + /// The role of the sender server. + #[prost(enumeration = "Role", tag = "4")] + pub role: i32, + /// Encoded trace_id & span_id, follow the w3c Trace Context + /// + #[prost(map = "string, string", tag = "5")] + pub tracing_context: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ResponseHeader { + #[prost(uint64, tag = "1")] + pub protocol_version: u64, + #[prost(message, optional, tag = "3")] + pub error: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Error { + #[prost(int32, tag = "1")] + pub code: i32, + #[prost(string, tag = "2")] + pub err_msg: ::prost::alloc::string::String, +} +#[derive(::serde::Serialize, ::serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Peer { + #[prost(uint64, tag = "1")] + pub id: u64, + #[prost(string, tag = "2")] + pub addr: ::prost::alloc::string::String, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct TimeInterval { + /// The unix timestamp in millis of the start of this period. + #[prost(int64, tag = "1")] + pub start_timestamp_millis: i64, + /// The unix timestamp in millis of the end of this period. + #[prost(int64, tag = "2")] + pub end_timestamp_millis: i64, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct KeyValue { + /// key is the key in bytes. An empty key is not allowed. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// value is the value held by the key, in bytes. + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, +} +/// Procedure identifier +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ProcedureId { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Role { + Datanode = 0, + Frontend = 1, + Flownode = 2, +} +impl Role { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Datanode => "DATANODE", + Self::Frontend => "FRONTEND", + Self::Flownode => "FLOWNODE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "DATANODE" => Some(Self::Datanode), + "FRONTEND" => Some(Self::Frontend), + "FLOWNODE" => Some(Self::Flownode), + _ => None, + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HeartbeatRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// Self peer + #[prost(message, optional, tag = "2")] + pub peer: ::core::option::Option, + /// Actually reported time interval + #[prost(message, optional, tag = "3")] + pub report_interval: ::core::option::Option, + /// Region stats on this node + #[prost(message, repeated, tag = "4")] + pub region_stats: ::prost::alloc::vec::Vec, + /// Mailbox send message to Metasrv + #[prost(message, optional, tag = "5")] + pub mailbox_message: ::core::option::Option, + /// The duration since the heartbeat task's epoch in milliseconds. + #[prost(uint64, tag = "6")] + pub duration_since_epoch: u64, + /// The node's epoch + #[prost(uint64, tag = "7")] + pub node_epoch: u64, + #[prost(message, optional, tag = "8")] + pub info: ::core::option::Option, + #[prost(message, optional, tag = "9")] + pub flow_stat: ::core::option::Option, + /// The topic stats of the datanode. + #[prost(message, repeated, tag = "13")] + pub topic_stats: ::prost::alloc::vec::Vec, + #[prost(map = "string, bytes", tag = "99")] + pub extensions: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::vec::Vec, + >, + /// / The workloads of the node. + #[prost(oneof = "heartbeat_request::NodeWorkloads", tags = "10, 11, 12")] + pub node_workloads: ::core::option::Option, +} +/// Nested message and enum types in `HeartbeatRequest`. +pub mod heartbeat_request { + /// / The workloads of the node. + #[derive(::serde::Serialize, ::serde::Deserialize)] + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum NodeWorkloads { + #[prost(message, tag = "10")] + Datanode(super::DatanodeWorkloads), + #[prost(message, tag = "11")] + Frontend(super::FrontendWorkloads), + #[prost(message, tag = "12")] + Flownode(super::FlownodeWorkloads), + } +} +/// / The workload types of the datanode. +#[derive(::serde::Serialize, ::serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DatanodeWorkloads { + #[prost(int32, repeated, tag = "1")] + pub types: ::prost::alloc::vec::Vec, +} +/// / The workload types of the frontend. +#[derive(::serde::Serialize, ::serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct FrontendWorkloads { + #[prost(int32, repeated, tag = "1")] + pub types: ::prost::alloc::vec::Vec, +} +/// / The workload types of the flownode. +#[derive(::serde::Serialize, ::serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct FlownodeWorkloads { + #[prost(int32, repeated, tag = "1")] + pub types: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct NodeInfo { + /// The node build version + #[prost(string, tag = "1")] + pub version: ::prost::alloc::string::String, + /// The node build git commit hash + #[prost(string, tag = "2")] + pub git_commit: ::prost::alloc::string::String, + /// The node start timestamp + #[prost(uint64, tag = "3")] + pub start_time_ms: u64, + /// Deprecated: Use total_cpu_millicores instead. The CPU cores number of the node. + #[deprecated] + #[prost(uint32, tag = "4")] + pub cpus: u32, + /// Deprecated: Use total_memory_bytes instead. The memory bytes of the node. + #[deprecated] + #[prost(uint64, tag = "5")] + pub memory_bytes: u64, + /// The hostname of the node. + #[prost(string, tag = "6")] + pub hostname: ::prost::alloc::string::String, + /// The total CPU millicores of the node. + #[prost(int64, tag = "7")] + pub total_cpu_millicores: i64, + /// The total memory bytes of the node. + #[prost(int64, tag = "8")] + pub total_memory_bytes: i64, + /// The CPU usage millicores of the node. + #[prost(int64, tag = "9")] + pub cpu_usage_millicores: i64, + /// The memory usage bytes of the node. + #[prost(int64, tag = "10")] + pub memory_usage_bytes: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionStat { + #[prost(uint64, tag = "1")] + pub region_id: u64, + /// The read capacity units during this period + #[prost(int64, tag = "2")] + pub rcus: i64, + /// The write capacity units during this period + #[prost(int64, tag = "3")] + pub wcus: i64, + /// Approximate bytes of this region + #[prost(int64, tag = "4")] + pub approximate_bytes: i64, + /// Engine name + #[prost(string, tag = "6")] + pub engine: ::prost::alloc::string::String, + /// Region role + #[prost(enumeration = "RegionRole", tag = "7")] + pub role: i32, + #[prost(map = "string, bytes", tag = "99")] + pub extensions: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::vec::Vec, + >, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct TopicStat { + /// The topic name + #[prost(string, tag = "1")] + pub topic_name: ::prost::alloc::string::String, + /// The total record size appended to topic since the datanode started. + #[prost(uint64, tag = "2")] + pub record_size: u64, + /// The total record number appended to topic since the datanode started. + #[prost(uint64, tag = "3")] + pub record_num: u64, + /// The latest entry id of the topic. + #[prost(uint64, tag = "4")] + pub latest_entry_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FlowStat { + /// Each flow's in mem state's size in bytes + /// due to protobuf's key can't be a message, so we use uint32 as the key which + /// is \[`FlowId`\]'s inner field `id` + #[prost(map = "uint32, uint64", tag = "1")] + pub flow_stat_size: ::std::collections::HashMap, + #[prost(map = "uint32, int64", tag = "2")] + pub flow_last_exec_time_map: ::std::collections::HashMap, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HeartbeatResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub mailbox_message: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub region_lease: ::core::option::Option, + /// Heartbeat configuration issued by Metasrv + /// Populated only in the handshake response + #[prost(message, optional, tag = "4")] + pub heartbeat_config: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct HeartbeatConfig { + #[prost(uint64, tag = "1")] + pub heartbeat_interval_ms: u64, + #[prost(uint64, tag = "2")] + pub retry_interval_ms: u64, +} +/// The granted region is the region that the meta server granted leases. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GrantedRegion { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(enumeration = "RegionRole", tag = "2")] + pub role: i32, + #[prost(map = "string, bytes", tag = "99")] + pub extensions: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::vec::Vec, + >, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionLease { + #[prost(message, repeated, tag = "1")] + pub regions: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "2")] + pub duration_since_epoch: u64, + #[prost(uint64, tag = "3")] + pub lease_seconds: u64, + #[prost(uint64, repeated, tag = "4")] + pub closeable_region_ids: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AskLeaderRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct AskLeaderResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub leader: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MailboxMessageHeader { + /// Encoded trace_id & span_id, follow the w3c Trace Context + /// + #[prost(map = "string, string", tag = "1")] + pub tracing_context: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MailboxMessage { + /// / The header of the mailbox message. + #[prost(message, optional, tag = "64")] + pub header: ::core::option::Option, + /// The id is used to associate request and response. + #[prost(uint64, tag = "1")] + pub id: u64, + /// The following information plays a bigger role in making messages traceable + /// and facilitating debugging. + #[prost(string, tag = "2")] + pub subject: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub from: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub to: ::prost::alloc::string::String, + /// The unix timestamp in milliseconds. + #[prost(int64, tag = "5")] + pub timestamp_millis: i64, + /// The message body. + #[prost(oneof = "mailbox_message::Payload", tags = "6")] + pub payload: ::core::option::Option, +} +/// Nested message and enum types in `MailboxMessage`. +pub mod mailbox_message { + /// The message body. + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Payload { + #[prost(string, tag = "6")] + Json(::prost::alloc::string::String), + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum RegionRole { + /// Writable region(mito2), Readonly region(file). + Leader = 0, + /// Readonly region. + Follower = 1, + /// A downgrading region, which is in the process of downgrading from Leader to + /// Follower. + /// + /// This role is used to prevent the region from being written during the + /// downgrade process. + DowngradingLeader = 2, +} +impl RegionRole { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Leader => "Leader", + Self::Follower => "Follower", + Self::DowngradingLeader => "DowngradingLeader", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Leader" => Some(Self::Leader), + "Follower" => Some(Self::Follower), + "DowngradingLeader" => Some(Self::DowngradingLeader), + _ => None, + } + } +} +/// Generated client implementations. +pub mod heartbeat_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct HeartbeatClient { + inner: tonic::client::Grpc, + } + impl HeartbeatClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl HeartbeatClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> HeartbeatClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + HeartbeatClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Heartbeat, there may be many contents of the heartbeat, such as: + /// + /// 1. Metadata to be registered to meta server and discoverable by other nodes. + /// 1. Some performance metrics, such as Load, CPU usage, etc. + /// 1. The number of computing tasks being executed. + pub async fn heartbeat( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Heartbeat/Heartbeat", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Heartbeat", "Heartbeat")); + self.inner.streaming(req, path, codec).await + } + /// Ask leader's endpoint. + pub async fn ask_leader( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Heartbeat/AskLeader", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Heartbeat", "AskLeader")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod heartbeat_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with HeartbeatServer. + #[async_trait] + pub trait Heartbeat: std::marker::Send + std::marker::Sync + 'static { + /// Server streaming response type for the Heartbeat method. + type HeartbeatStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result, + > + + std::marker::Send + + 'static; + /// Heartbeat, there may be many contents of the heartbeat, such as: + /// + /// 1. Metadata to be registered to meta server and discoverable by other nodes. + /// 1. Some performance metrics, such as Load, CPU usage, etc. + /// 1. The number of computing tasks being executed. + async fn heartbeat( + &self, + request: tonic::Request>, + ) -> std::result::Result, tonic::Status>; + /// Ask leader's endpoint. + async fn ask_leader( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + #[derive(Debug)] + pub struct HeartbeatServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl HeartbeatServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for HeartbeatServer + where + T: Heartbeat, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/greptime.v1.meta.Heartbeat/Heartbeat" => { + #[allow(non_camel_case_types)] + struct HeartbeatSvc(pub Arc); + impl< + T: Heartbeat, + > tonic::server::StreamingService + for HeartbeatSvc { + type Response = super::HeartbeatResponse; + type ResponseStream = T::HeartbeatStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + tonic::Streaming, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::heartbeat(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = HeartbeatSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Heartbeat/AskLeader" => { + #[allow(non_camel_case_types)] + struct AskLeaderSvc(pub Arc); + impl< + T: Heartbeat, + > tonic::server::UnaryService + for AskLeaderSvc { + type Response = super::AskLeaderResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::ask_leader(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = AskLeaderSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for HeartbeatServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "greptime.v1.meta.Heartbeat"; + impl tonic::server::NamedService for HeartbeatServer { + const NAME: &'static str = SERVICE_NAME; + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PullConfigRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct PullConfigResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(string, tag = "2")] + pub payload: ::prost::alloc::string::String, +} +/// Generated client implementations. +pub mod config_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct ConfigClient { + inner: tonic::client::Grpc, + } + impl ConfigClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ConfigClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ConfigClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + ConfigClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Pull configuration from meta server. + pub async fn pull_config( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Config/PullConfig", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Config", "PullConfig")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod config_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with ConfigServer. + #[async_trait] + pub trait Config: std::marker::Send + std::marker::Sync + 'static { + /// Pull configuration from meta server. + async fn pull_config( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + #[derive(Debug)] + pub struct ConfigServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl ConfigServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for ConfigServer + where + T: Config, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/greptime.v1.meta.Config/PullConfig" => { + #[allow(non_camel_case_types)] + struct PullConfigSvc(pub Arc); + impl tonic::server::UnaryService + for PullConfigSvc { + type Response = super::PullConfigResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::pull_config(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = PullConfigSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for ConfigServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "greptime.v1.meta.Config"; + impl tonic::server::NamedService for ConfigServer { + const NAME: &'static str = SERVICE_NAME; + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TableRoute { + #[prost(message, optional, tag = "1")] + pub table: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub region_routes: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionRoute { + #[prost(message, optional, tag = "1")] + pub region: ::core::option::Option, + /// single leader node for write task + #[prost(uint64, tag = "2")] + pub leader_peer_index: u64, + /// multiple follower nodes for read task + #[prost(uint64, repeated, tag = "3")] + pub follower_peer_indexes: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Table { + #[prost(uint64, tag = "1")] + pub id: u64, + #[prost(message, optional, tag = "2")] + pub table_name: ::core::option::Option, + #[prost(bytes = "vec", tag = "3")] + pub table_schema: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Region { + /// TODO(LFC): Maybe use message RegionNumber? + #[prost(uint64, tag = "1")] + pub id: u64, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub partition: ::core::option::Option, + #[prost(map = "string, string", tag = "100")] + pub attrs: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, +} +/// Partition definition. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Partition { + #[deprecated] + #[prost(bytes = "vec", repeated, tag = "1")] + pub column_list: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[deprecated] + #[prost(bytes = "vec", repeated, tag = "2")] + pub value_list: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + /// The partition expression serialized in JSON format. + #[prost(string, tag = "3")] + pub expression: ::prost::alloc::string::String, +} +/// This message is only for saving into store. +/// TODO(weny): Remove it, Now, the upgrade tool is still dependent on it. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TableRouteValue { + #[prost(message, repeated, tag = "1")] + pub peers: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub table_route: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateDatabaseTask { + #[prost(message, optional, tag = "1")] + pub create_database: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateTableTask { + #[prost(message, optional, tag = "1")] + pub create_table: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub partitions: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub table_info: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateTableTasks { + #[prost(message, repeated, tag = "1")] + pub tasks: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropTableTask { + #[prost(message, optional, tag = "1")] + pub drop_table: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DropTableTasks { + #[prost(message, repeated, tag = "1")] + pub tasks: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AlterTableTask { + #[prost(message, optional, tag = "1")] + pub alter_table: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AlterTableTasks { + #[prost(message, repeated, tag = "1")] + pub tasks: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TruncateTableTask { + #[prost(message, optional, tag = "1")] + pub truncate_table: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropDatabaseTask { + #[prost(message, optional, tag = "1")] + pub drop_database: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateFlowTask { + #[prost(message, optional, tag = "1")] + pub create_flow: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropFlowTask { + #[prost(message, optional, tag = "1")] + pub drop_flow: ::core::option::Option, +} +/// Create a view task +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateViewTask { + #[prost(message, optional, tag = "1")] + pub create_view: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub view_info: ::prost::alloc::vec::Vec, +} +/// Drop a view task +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropViewTask { + #[prost(message, optional, tag = "1")] + pub drop_view: ::core::option::Option, +} +/// Alter database tasks +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AlterDatabaseTask { + #[prost(message, optional, tag = "1")] + pub task: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateTriggerTask { + #[prost(message, optional, tag = "1")] + pub create_trigger: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropTriggerTask { + #[prost(message, optional, tag = "1")] + pub drop_trigger: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct CommentOnTask { + #[prost(message, optional, tag = "1")] + pub comment_on: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DdlTaskRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// The query context for the ddl procedures. + #[prost(message, optional, tag = "64")] + pub query_context: ::core::option::Option, + /// The timeout will be passed to the procedure. + /// + /// Note: Each procedure may implement its own timeout handling mechanism. + #[prost(bool, tag = "65")] + pub wait: bool, + /// The flag that controls whether to wait for the procedure to complete. + /// + /// If wait is `true`, the procedure will wait for completion(success or failure) and the result will be returned. + /// Otherwise, the procedure will be submitted and return the [ProcedureId](common_procedure::ProcedureId) immediately. + /// + /// Note: The value of `wait` is independent of the `timeout` option. If a procedure ignores the `timeout` and `wait` is set to true, the operation returns until the procedure completes. + #[prost(uint32, tag = "66")] + pub timeout_secs: u32, + #[prost( + oneof = "ddl_task_request::Task", + tags = "2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18" + )] + pub task: ::core::option::Option, +} +/// Nested message and enum types in `DdlTaskRequest`. +pub mod ddl_task_request { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Task { + #[prost(message, tag = "2")] + CreateTableTask(super::CreateTableTask), + #[prost(message, tag = "3")] + DropTableTask(super::DropTableTask), + #[prost(message, tag = "4")] + AlterTableTask(super::AlterTableTask), + #[prost(message, tag = "5")] + TruncateTableTask(super::TruncateTableTask), + #[prost(message, tag = "6")] + CreateTableTasks(super::CreateTableTasks), + #[prost(message, tag = "7")] + DropTableTasks(super::DropTableTasks), + #[prost(message, tag = "8")] + AlterTableTasks(super::AlterTableTasks), + #[prost(message, tag = "9")] + DropDatabaseTask(super::DropDatabaseTask), + #[prost(message, tag = "10")] + CreateDatabaseTask(super::CreateDatabaseTask), + #[prost(message, tag = "11")] + CreateFlowTask(super::CreateFlowTask), + #[prost(message, tag = "12")] + DropFlowTask(super::DropFlowTask), + #[prost(message, tag = "13")] + CreateViewTask(super::CreateViewTask), + #[prost(message, tag = "14")] + DropViewTask(super::DropViewTask), + #[prost(message, tag = "15")] + AlterDatabaseTask(super::AlterDatabaseTask), + #[prost(message, tag = "16")] + CreateTriggerTask(super::CreateTriggerTask), + #[prost(message, tag = "17")] + DropTriggerTask(super::DropTriggerTask), + #[prost(message, tag = "18")] + CommentOnTask(super::CommentOnTask), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DdlTaskResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pid: ::core::option::Option, + /// Returns if the tables created. + #[prost(message, repeated, tag = "5")] + pub table_ids: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum DdlTaskType { + Create = 0, + Drop = 1, +} +impl DdlTaskType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Create => "Create", + Self::Drop => "Drop", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Create" => Some(Self::Create), + "Drop" => Some(Self::Drop), + _ => None, + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MigrateRegionRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "3")] + pub region_id: u64, + #[prost(uint64, tag = "4")] + pub from_peer: u64, + #[prost(uint64, tag = "5")] + pub to_peer: u64, + #[prost(uint32, tag = "6")] + pub timeout_secs: u32, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct MigrateRegionResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pid: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RangeRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// key is the first key for the range, If range_end is not given, the + /// request only looks up key. + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + /// range_end is the upper bound on the requested range \[key, range_end). + /// If range_end is '\0', the range is all keys >= key. + /// If range_end is key plus one (e.g., "aa"+1 == "ab", "a\xff"+1 == "b"), + /// then the range request gets all keys prefixed with key. + /// If both key and range_end are '\0', then the range request returns all + /// keys. + #[prost(bytes = "vec", tag = "3")] + pub range_end: ::prost::alloc::vec::Vec, + /// limit is a limit on the number of keys returned for the request. When + /// limit is set to 0, it is treated as no limit. + #[prost(int64, tag = "4")] + pub limit: i64, + /// keys_only when set returns only the keys and not the values. + #[prost(bool, tag = "5")] + pub keys_only: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RangeResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// kvs is the list of key-value pairs matched by the range request. + #[prost(message, repeated, tag = "2")] + pub kvs: ::prost::alloc::vec::Vec, + /// more indicates if there are more keys to return in the requested range. + #[prost(bool, tag = "3")] + pub more: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PutRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// key is the key, in bytes, to put into the key-value store. + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + /// value is the value, in bytes, to associate with the key in the + /// key-value store. + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, + /// If prev_kv is set, gets the previous key-value pair before changing it. + /// The previous key-value pair will be returned in the put response. + #[prost(bool, tag = "4")] + pub prev_kv: bool, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct PutResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// If prev_kv is set in the request, the previous key-value pair will be + /// returned. + #[prost(message, optional, tag = "2")] + pub prev_kv: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchGetRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bytes = "vec", repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchGetResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub kvs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchPutRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub kvs: ::prost::alloc::vec::Vec, + /// If prev_kv is set, gets the previous key-value pairs before changing it. + /// The previous key-value pairs will be returned in the batch put response. + #[prost(bool, tag = "3")] + pub prev_kv: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchPutResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// If prev_kv is set in the request, the previous key-value pairs will be + /// returned. + #[prost(message, repeated, tag = "2")] + pub prev_kvs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchDeleteRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bytes = "vec", repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + /// If prev_kv is set, gets the previous key-value pairs before deleting it. + /// The previous key-value pairs will be returned in the batch delete response. + #[prost(bool, tag = "3")] + pub prev_kv: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchDeleteResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// If prev_kv is set in the request, the previous key-value pairs will be + /// returned. + #[prost(message, repeated, tag = "2")] + pub prev_kvs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompareAndPutRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// key is the key, in bytes, to put into the key-value store. + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + /// expect is the previous value, in bytes + #[prost(bytes = "vec", tag = "3")] + pub expect: ::prost::alloc::vec::Vec, + /// value is the value, in bytes, to associate with the key in the + /// key-value store. + #[prost(bytes = "vec", tag = "4")] + pub value: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct CompareAndPutResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bool, tag = "2")] + pub success: bool, + #[prost(message, optional, tag = "3")] + pub prev_kv: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRangeRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// key is the first key to delete in the range. + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + /// range_end is the key following the last key to delete for the range + /// \[key, range_end). + /// If range_end is not given, the range is defined to contain only the key + /// argument. + /// If range_end is one bit larger than the given key, then the range is all + /// the keys with the prefix (the given key). + /// If range_end is '\0', the range is all keys greater than or equal to the + /// key argument. + #[prost(bytes = "vec", tag = "3")] + pub range_end: ::prost::alloc::vec::Vec, + /// If prev_kv is set, gets the previous key-value pairs before deleting it. + /// The previous key-value pairs will be returned in the delete response. + #[prost(bool, tag = "4")] + pub prev_kv: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRangeResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// deleted is the number of keys deleted by the delete range request. + #[prost(int64, tag = "2")] + pub deleted: i64, + /// If prev_kv is set in the request, the previous key-value pairs will be + /// returned. + #[prost(message, repeated, tag = "3")] + pub prev_kvs: ::prost::alloc::vec::Vec, +} +/// Generated client implementations. +pub mod store_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct StoreClient { + inner: tonic::client::Grpc, + } + impl StoreClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl StoreClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> StoreClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + StoreClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Range gets the keys in the range from the key-value store. + pub async fn range( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Store/Range", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Store", "Range")); + self.inner.unary(req, path, codec).await + } + /// Put puts the given key into the key-value store. + pub async fn put( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Store/Put", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Store", "Put")); + self.inner.unary(req, path, codec).await + } + /// BatchGet atomically get values by the given keys from the key-value store. + pub async fn batch_get( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Store/BatchGet", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Store", "BatchGet")); + self.inner.unary(req, path, codec).await + } + /// BatchPut atomically puts the given keys into the key-value store. + pub async fn batch_put( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Store/BatchPut", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Store", "BatchPut")); + self.inner.unary(req, path, codec).await + } + /// BatchDelete atomically deletes the given keys and its associating values + /// from the key-value store. + pub async fn batch_delete( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Store/BatchDelete", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Store", "BatchDelete")); + self.inner.unary(req, path, codec).await + } + /// CompareAndPut atomically puts the value to the given updated + /// value if the current value == the expected value. + pub async fn compare_and_put( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Store/CompareAndPut", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Store", "CompareAndPut")); + self.inner.unary(req, path, codec).await + } + /// DeleteRange deletes the given range from the key-value store. + pub async fn delete_range( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Store/DeleteRange", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Store", "DeleteRange")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod store_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with StoreServer. + #[async_trait] + pub trait Store: std::marker::Send + std::marker::Sync + 'static { + /// Range gets the keys in the range from the key-value store. + async fn range( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Put puts the given key into the key-value store. + async fn put( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// BatchGet atomically get values by the given keys from the key-value store. + async fn batch_get( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// BatchPut atomically puts the given keys into the key-value store. + async fn batch_put( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// BatchDelete atomically deletes the given keys and its associating values + /// from the key-value store. + async fn batch_delete( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// CompareAndPut atomically puts the value to the given updated + /// value if the current value == the expected value. + async fn compare_and_put( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// DeleteRange deletes the given range from the key-value store. + async fn delete_range( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + #[derive(Debug)] + pub struct StoreServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl StoreServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for StoreServer + where + T: Store, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/greptime.v1.meta.Store/Range" => { + #[allow(non_camel_case_types)] + struct RangeSvc(pub Arc); + impl tonic::server::UnaryService + for RangeSvc { + type Response = super::RangeResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::range(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = RangeSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Store/Put" => { + #[allow(non_camel_case_types)] + struct PutSvc(pub Arc); + impl tonic::server::UnaryService + for PutSvc { + type Response = super::PutResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::put(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = PutSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Store/BatchGet" => { + #[allow(non_camel_case_types)] + struct BatchGetSvc(pub Arc); + impl tonic::server::UnaryService + for BatchGetSvc { + type Response = super::BatchGetResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::batch_get(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = BatchGetSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Store/BatchPut" => { + #[allow(non_camel_case_types)] + struct BatchPutSvc(pub Arc); + impl tonic::server::UnaryService + for BatchPutSvc { + type Response = super::BatchPutResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::batch_put(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = BatchPutSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Store/BatchDelete" => { + #[allow(non_camel_case_types)] + struct BatchDeleteSvc(pub Arc); + impl tonic::server::UnaryService + for BatchDeleteSvc { + type Response = super::BatchDeleteResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::batch_delete(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = BatchDeleteSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Store/CompareAndPut" => { + #[allow(non_camel_case_types)] + struct CompareAndPutSvc(pub Arc); + impl< + T: Store, + > tonic::server::UnaryService + for CompareAndPutSvc { + type Response = super::CompareAndPutResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::compare_and_put(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = CompareAndPutSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Store/DeleteRange" => { + #[allow(non_camel_case_types)] + struct DeleteRangeSvc(pub Arc); + impl tonic::server::UnaryService + for DeleteRangeSvc { + type Response = super::DeleteRangeResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::delete_range(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = DeleteRangeSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for StoreServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "greptime.v1.meta.Store"; + impl tonic::server::NamedService for StoreServer { + const NAME: &'static str = SERVICE_NAME; + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LockRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// Name is the identifier for the distributed shared lock to be acquired. + #[prost(bytes = "vec", tag = "2")] + pub name: ::prost::alloc::vec::Vec, + /// If the expiration time is exceeded and currently holds the lock, the lock + /// is automatically released. + #[prost(int64, tag = "3")] + pub expire_secs: i64, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct LockResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// Key will exist as long as lock is held by the caller. + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnlockRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// key is the lock ownership key granted by Lock. + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct UnlockResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +/// Generated client implementations. +pub mod lock_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct LockClient { + inner: tonic::client::Grpc, + } + impl LockClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl LockClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> LockClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + LockClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Lock acquires a distributed shared lock on a given named lock. On success, + /// it will return a unique key that exists so long as the lock is held by the + /// caller. + pub async fn lock( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Lock/Lock", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Lock", "Lock")); + self.inner.unary(req, path, codec).await + } + /// Unlock takes a key returned by Lock and releases the hold on lock. + pub async fn unlock( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Lock/Unlock", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Lock", "Unlock")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod lock_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with LockServer. + #[async_trait] + pub trait Lock: std::marker::Send + std::marker::Sync + 'static { + /// Lock acquires a distributed shared lock on a given named lock. On success, + /// it will return a unique key that exists so long as the lock is held by the + /// caller. + async fn lock( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Unlock takes a key returned by Lock and releases the hold on lock. + async fn unlock( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + } + #[derive(Debug)] + pub struct LockServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl LockServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for LockServer + where + T: Lock, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/greptime.v1.meta.Lock/Lock" => { + #[allow(non_camel_case_types)] + struct LockSvc(pub Arc); + impl tonic::server::UnaryService + for LockSvc { + type Response = super::LockResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::lock(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = LockSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Lock/Unlock" => { + #[allow(non_camel_case_types)] + struct UnlockSvc(pub Arc); + impl tonic::server::UnaryService + for UnlockSvc { + type Response = super::UnlockResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::unlock(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = UnlockSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for LockServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "greptime.v1.meta.Lock"; + impl tonic::server::NamedService for LockServer { + const NAME: &'static str = SERVICE_NAME; + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetasrvPeersRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetasrvPeersResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub leader: ::core::option::Option, + #[prost(message, repeated, tag = "3")] + pub followers: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct MetasrvNodeInfo { + #[prost(message, optional, tag = "1")] + pub peer: ::core::option::Option, + /// Deprecated: Use NodeInfo instead. The version of the node. + #[deprecated] + #[prost(string, tag = "2")] + pub version: ::prost::alloc::string::String, + /// Deprecated: Use NodeInfo instead. The git commit hash of the node. + #[deprecated] + #[prost(string, tag = "3")] + pub git_commit: ::prost::alloc::string::String, + /// Deprecated: Use NodeInfo instead. The node start timestamp in milliseconds. + #[deprecated] + #[prost(uint64, tag = "4")] + pub start_time_ms: u64, + /// Deprecated: Use NodeInfo instead. The CPU cores number of the node. + #[deprecated] + #[prost(uint32, tag = "5")] + pub cpus: u32, + /// Deprecated: Use NodeInfo instead. The memory bytes of the node. + #[deprecated] + #[prost(uint64, tag = "6")] + pub memory_bytes: u64, + /// The node info. + #[prost(message, optional, tag = "7")] + pub info: ::core::option::Option, +} +/// Generated client implementations. +pub mod cluster_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Cluster service is used for communication between meta nodes. + #[derive(Debug, Clone)] + pub struct ClusterClient { + inner: tonic::client::Grpc, + } + impl ClusterClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ClusterClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ClusterClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + ClusterClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Batch get kvs by input keys from leader's in_memory kv store. + pub async fn batch_get( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Cluster/BatchGet", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Cluster", "BatchGet")); + self.inner.unary(req, path, codec).await + } + /// Range get the kvs from leader's in_memory kv store. + pub async fn range( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Cluster/Range", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Cluster", "Range")); + self.inner.unary(req, path, codec).await + } + /// Returns all the peers of metasrv. + pub async fn metasrv_peers( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.Cluster/MetasrvPeers", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.Cluster", "MetasrvPeers")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod cluster_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with ClusterServer. + #[async_trait] + pub trait Cluster: std::marker::Send + std::marker::Sync + 'static { + /// Batch get kvs by input keys from leader's in_memory kv store. + async fn batch_get( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Range get the kvs from leader's in_memory kv store. + async fn range( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Returns all the peers of metasrv. + async fn metasrv_peers( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Cluster service is used for communication between meta nodes. + #[derive(Debug)] + pub struct ClusterServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl ClusterServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for ClusterServer + where + T: Cluster, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/greptime.v1.meta.Cluster/BatchGet" => { + #[allow(non_camel_case_types)] + struct BatchGetSvc(pub Arc); + impl tonic::server::UnaryService + for BatchGetSvc { + type Response = super::BatchGetResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::batch_get(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = BatchGetSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Cluster/Range" => { + #[allow(non_camel_case_types)] + struct RangeSvc(pub Arc); + impl tonic::server::UnaryService + for RangeSvc { + type Response = super::RangeResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::range(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = RangeSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.Cluster/MetasrvPeers" => { + #[allow(non_camel_case_types)] + struct MetasrvPeersSvc(pub Arc); + impl< + T: Cluster, + > tonic::server::UnaryService + for MetasrvPeersSvc { + type Response = super::MetasrvPeersResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::metasrv_peers(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = MetasrvPeersSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for ClusterServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "greptime.v1.meta.Cluster"; + impl tonic::server::NamedService for ClusterServer { + const NAME: &'static str = SERVICE_NAME; + } +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ProcedureMeta { + #[prost(message, optional, tag = "1")] + pub id: ::core::option::Option, + #[prost(string, tag = "2")] + pub type_name: ::prost::alloc::string::String, + #[prost(enumeration = "ProcedureStatus", tag = "3")] + pub status: i32, + #[prost(int64, tag = "4")] + pub start_time_ms: i64, + #[prost(int64, tag = "5")] + pub end_time_ms: i64, + #[prost(string, repeated, tag = "6")] + pub lock_keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag = "7")] + pub error: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryProcedureRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pid: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ProcedureStateResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(enumeration = "ProcedureStatus", tag = "2")] + pub status: i32, + #[prost(string, tag = "3")] + pub error: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProcedureDetailRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProcedureDetailResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub procedures: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ReconcileTable { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub table_name: ::prost::alloc::string::String, + #[prost(enumeration = "ResolveStrategy", tag = "4")] + pub resolve_strategy: i32, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ReconcileDatabase { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub database_name: ::prost::alloc::string::String, + #[prost(uint32, tag = "3")] + pub parallelism: u32, + #[prost(enumeration = "ResolveStrategy", tag = "4")] + pub resolve_strategy: i32, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ReconcileCatalog { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(uint32, tag = "2")] + pub parallelism: u32, + #[prost(enumeration = "ResolveStrategy", tag = "3")] + pub resolve_strategy: i32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReconcileRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(oneof = "reconcile_request::Target", tags = "2, 3, 4")] + pub target: ::core::option::Option, +} +/// Nested message and enum types in `ReconcileRequest`. +pub mod reconcile_request { + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Target { + #[prost(message, tag = "2")] + ReconcileTable(super::ReconcileTable), + #[prost(message, tag = "3")] + ReconcileDatabase(super::ReconcileDatabase), + #[prost(message, tag = "4")] + ReconcileCatalog(super::ReconcileCatalog), + } +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ReconcileResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub pid: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GcRegionsRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, repeated, tag = "2")] + pub region_ids: ::prost::alloc::vec::Vec, + /// Whether to perform a full file listing on datanodes when GC'ing the regions. + #[prost(bool, tag = "3")] + pub full_file_listing: bool, + /// Timeout in seconds for the entire GC procedure. + #[prost(uint32, tag = "4")] + pub timeout_secs: u32, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct GcStats { + /// Number of regions requested for GC (accepted by the server side). + #[prost(uint64, tag = "1")] + pub processed_regions: u64, + /// Regions that need retry in the next GC round. + #[prost(uint64, repeated, tag = "2")] + pub need_retry_regions: ::prost::alloc::vec::Vec, + /// Number of deleted SST files. + #[prost(uint64, tag = "3")] + pub deleted_files: u64, + /// Number of deleted index files. + #[prost(uint64, tag = "4")] + pub deleted_indexes: u64, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct GcRegionsResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub stats: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GcTableRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(string, tag = "2")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub schema_name: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub table_name: ::prost::alloc::string::String, + /// Whether to perform a full file listing on datanodes when GC'ing the regions. + #[prost(bool, tag = "5")] + pub full_file_listing: bool, + /// Timeout in seconds for the entire GC procedure. + #[prost(uint32, tag = "6")] + pub timeout_secs: u32, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct GcTableResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub stats: ::core::option::Option, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ProcedureStatus { + Running = 0, + Done = 1, + Retrying = 2, + Failed = 3, + PrepareRollback = 4, + RollingBack = 5, + Poisoned = 6, +} +impl ProcedureStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Running => "Running", + Self::Done => "Done", + Self::Retrying => "Retrying", + Self::Failed => "Failed", + Self::PrepareRollback => "PrepareRollback", + Self::RollingBack => "RollingBack", + Self::Poisoned => "Poisoned", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Running" => Some(Self::Running), + "Done" => Some(Self::Done), + "Retrying" => Some(Self::Retrying), + "Failed" => Some(Self::Failed), + "PrepareRollback" => Some(Self::PrepareRollback), + "RollingBack" => Some(Self::RollingBack), + "Poisoned" => Some(Self::Poisoned), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ResolveStrategy { + UseLatest = 0, + UseMetasrv = 1, + AbortOnConflict = 2, +} +impl ResolveStrategy { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UseLatest => "UseLatest", + Self::UseMetasrv => "UseMetasrv", + Self::AbortOnConflict => "AbortOnConflict", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UseLatest" => Some(Self::UseLatest), + "UseMetasrv" => Some(Self::UseMetasrv), + "AbortOnConflict" => Some(Self::AbortOnConflict), + _ => None, + } + } +} +/// Generated client implementations. +pub mod procedure_service_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct ProcedureServiceClient { + inner: tonic::client::Grpc, + } + impl ProcedureServiceClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ProcedureServiceClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ProcedureServiceClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + ProcedureServiceClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Query a submitted procedure state + pub async fn query( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.ProcedureService/query", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.ProcedureService", "query")); + self.inner.unary(req, path, codec).await + } + /// Submits a DDL task + pub async fn ddl( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.ProcedureService/ddl", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.ProcedureService", "ddl")); + self.inner.unary(req, path, codec).await + } + /// Submits a reconcile task + pub async fn reconcile( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.ProcedureService/reconcile", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("greptime.v1.meta.ProcedureService", "reconcile"), + ); + self.inner.unary(req, path, codec).await + } + /// Submits a region migration task + pub async fn migrate( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.ProcedureService/migrate", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.ProcedureService", "migrate")); + self.inner.unary(req, path, codec).await + } + /// Query all submitted procedures details + pub async fn details( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.ProcedureService/details", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.meta.ProcedureService", "details")); + self.inner.unary(req, path, codec).await + } + /// Manually trigger GC for a specific list of regions + pub async fn gc_regions( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.ProcedureService/gc_regions", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("greptime.v1.meta.ProcedureService", "gc_regions"), + ); + self.inner.unary(req, path, codec).await + } + /// Manually trigger GC for a table (all its regions) + pub async fn gc_table( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.meta.ProcedureService/gc_table", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("greptime.v1.meta.ProcedureService", "gc_table"), + ); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod procedure_service_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with ProcedureServiceServer. + #[async_trait] + pub trait ProcedureService: std::marker::Send + std::marker::Sync + 'static { + /// Query a submitted procedure state + async fn query( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Submits a DDL task + async fn ddl( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Submits a reconcile task + async fn reconcile( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Submits a region migration task + async fn migrate( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Query all submitted procedures details + async fn details( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Manually trigger GC for a specific list of regions + async fn gc_regions( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Manually trigger GC for a table (all its regions) + async fn gc_table( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + } + #[derive(Debug)] + pub struct ProcedureServiceServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl ProcedureServiceServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for ProcedureServiceServer + where + T: ProcedureService, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/greptime.v1.meta.ProcedureService/query" => { + #[allow(non_camel_case_types)] + struct querySvc(pub Arc); + impl< + T: ProcedureService, + > tonic::server::UnaryService + for querySvc { + type Response = super::ProcedureStateResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::query(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = querySvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.ProcedureService/ddl" => { + #[allow(non_camel_case_types)] + struct ddlSvc(pub Arc); + impl< + T: ProcedureService, + > tonic::server::UnaryService for ddlSvc { + type Response = super::DdlTaskResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::ddl(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = ddlSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.ProcedureService/reconcile" => { + #[allow(non_camel_case_types)] + struct reconcileSvc(pub Arc); + impl< + T: ProcedureService, + > tonic::server::UnaryService + for reconcileSvc { + type Response = super::ReconcileResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::reconcile(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = reconcileSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.ProcedureService/migrate" => { + #[allow(non_camel_case_types)] + struct migrateSvc(pub Arc); + impl< + T: ProcedureService, + > tonic::server::UnaryService + for migrateSvc { + type Response = super::MigrateRegionResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::migrate(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = migrateSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.ProcedureService/details" => { + #[allow(non_camel_case_types)] + struct detailsSvc(pub Arc); + impl< + T: ProcedureService, + > tonic::server::UnaryService + for detailsSvc { + type Response = super::ProcedureDetailResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::details(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = detailsSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.ProcedureService/gc_regions" => { + #[allow(non_camel_case_types)] + struct gc_regionsSvc(pub Arc); + impl< + T: ProcedureService, + > tonic::server::UnaryService + for gc_regionsSvc { + type Response = super::GcRegionsResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::gc_regions(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = gc_regionsSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/greptime.v1.meta.ProcedureService/gc_table" => { + #[allow(non_camel_case_types)] + struct gc_tableSvc(pub Arc); + impl< + T: ProcedureService, + > tonic::server::UnaryService + for gc_tableSvc { + type Response = super::GcTableResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::gc_table(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = gc_tableSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for ProcedureServiceServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "greptime.v1.meta.ProcedureService"; + impl tonic::server::NamedService for ProcedureServiceServer { + const NAME: &'static str = SERVICE_NAME; + } +} diff --git a/src/generated/greptime.v1.region.rs b/src/generated/greptime.v1.region.rs new file mode 100644 index 0000000..e51e6bd --- /dev/null +++ b/src/generated/greptime.v1.region.rs @@ -0,0 +1,737 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionRequestHeader { + /// Encoded trace_id & span_id, follow the w3c Trace Context + /// + #[prost(map = "string, string", tag = "5")] + pub tracing_context: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + /// DB Name of request, tracking only + #[prost(string, tag = "3")] + pub dbname: ::prost::alloc::string::String, + /// The contextual information of the query + #[prost(message, optional, tag = "6")] + pub query_context: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// query request is handled in flight services. + #[prost( + oneof = "region_request::Body", + tags = "3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20" + )] + pub body: ::core::option::Option, +} +/// Nested message and enum types in `RegionRequest`. +pub mod region_request { + /// query request is handled in flight services. + #[derive(strum_macros::AsRefStr)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Body { + #[prost(message, tag = "3")] + Inserts(super::InsertRequests), + #[prost(message, tag = "4")] + Deletes(super::DeleteRequests), + #[prost(message, tag = "5")] + Create(super::CreateRequest), + #[prost(message, tag = "6")] + Drop(super::DropRequest), + #[prost(message, tag = "7")] + Open(super::OpenRequest), + #[prost(message, tag = "8")] + Close(super::CloseRequest), + #[prost(message, tag = "9")] + Alter(super::AlterRequest), + #[prost(message, tag = "10")] + Flush(super::FlushRequest), + #[prost(message, tag = "11")] + Compact(super::CompactRequest), + #[prost(message, tag = "12")] + Truncate(super::TruncateRequest), + #[prost(message, tag = "13")] + Creates(super::CreateRequests), + #[prost(message, tag = "14")] + Drops(super::DropRequests), + #[prost(message, tag = "15")] + Alters(super::AlterRequests), + #[prost(message, tag = "16")] + BulkInsert(super::BulkInsertRequest), + #[prost(message, tag = "17")] + Sync(super::SyncRequest), + #[prost(message, tag = "18")] + ListMetadata(super::ListMetadataRequest), + #[prost(message, tag = "19")] + BuildIndex(super::BuildIndexRequest), + #[prost(message, tag = "20")] + ApplyStagingManifest(super::ApplyStagingManifestRequest), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub affected_rows: u64, + #[prost(map = "string, bytes", tag = "3")] + pub extensions: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::vec::Vec, + >, + /// Response for ListMetadataRequest. + /// It is a json array of region metadatas. + /// The length of the array is equal to the number of regions in the list request. + /// The element is null if the region is not found. + #[prost(bytes = "vec", tag = "4")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InsertRequests { + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRequests { + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InsertRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(message, optional, tag = "2")] + pub rows: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub partition_expr_version: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(message, optional, tag = "2")] + pub rows: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub partition_expr_version: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub region_id: u64, + /// substrait plan to query + #[prost(bytes = "vec", tag = "3")] + pub plan: ::prost::alloc::vec::Vec, +} +/// Create a batch of regions at once, usually used to create multiple logical +/// regions at once. Different engines can choose whether to support this +/// request. Metric Engine needs it. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateRequests { + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + /// Region engine name + #[prost(string, tag = "2")] + pub engine: ::prost::alloc::string::String, + /// Columns in this region. + #[prost(message, repeated, tag = "3")] + pub column_defs: ::prost::alloc::vec::Vec, + /// Column Id of primary keys. + #[prost(uint32, repeated, tag = "4")] + pub primary_key: ::prost::alloc::vec::Vec, + /// Region storage path + #[prost(string, tag = "5")] + pub path: ::prost::alloc::string::String, + /// Options of the created region. + #[prost(map = "string, string", tag = "6")] + pub options: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + /// Partition of the created region. + #[prost(message, optional, tag = "7")] + pub partition: ::core::option::Option, +} +/// Same as CreateRequests, but for dropping regions. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DropRequests { + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + /// Only used by Metric Engine, for fast path drop. + /// It only works for Metric Engine, and will be ignored by other engines. + /// If true, the Metric Engine will delete logical tables in memory, and drop the physical region eventually. + #[prost(bool, tag = "2")] + pub fast_path: bool, + /// Used only by the Metric Engine, to forcibly drop a physical region and all its associated logical regions. + #[prost(bool, tag = "3")] + pub force: bool, + /// If true, indicates that only a portion of the region is being dropped, and files may still be referenced by other regions. + /// This is used to prevent deletion of files that are still in use by other regions. + #[prost(bool, tag = "4")] + pub partial_drop: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + /// Region engine name + #[prost(string, tag = "2")] + pub engine: ::prost::alloc::string::String, + /// Region storage path + #[prost(string, tag = "3")] + pub path: ::prost::alloc::string::String, + /// Options of the opened region. + #[prost(map = "string, string", tag = "4")] + pub options: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct CloseRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AlterRequests { + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AlterRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + /// The version of the schema before applying the alteration. + #[prost(uint64, tag = "4")] + pub schema_version: u64, + #[prost( + oneof = "alter_request::Kind", + tags = "2, 3, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16" + )] + pub kind: ::core::option::Option, +} +/// Nested message and enum types in `AlterRequest`. +pub mod alter_request { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Kind { + #[prost(message, tag = "2")] + AddColumns(super::AddColumns), + #[prost(message, tag = "3")] + DropColumns(super::DropColumns), + #[prost(message, tag = "5")] + ModifyColumnTypes(super::super::ModifyColumnTypes), + #[prost(message, tag = "6")] + SetTableOptions(super::super::SetTableOptions), + #[prost(message, tag = "9")] + UnsetTableOptions(super::super::UnsetTableOptions), + /// Deprecated: use set_indexes instead. + #[prost(message, tag = "10")] + SetIndex(super::super::SetIndex), + /// Deprecated: use unset_indexes instead. + #[prost(message, tag = "11")] + UnsetIndex(super::super::UnsetIndex), + #[prost(message, tag = "12")] + DropDefaults(super::super::DropDefaults), + #[prost(message, tag = "13")] + SetIndexes(super::super::SetIndexes), + #[prost(message, tag = "14")] + UnsetIndexes(super::super::UnsetIndexes), + #[prost(message, tag = "15")] + SetDefaults(super::super::SetDefaults), + #[prost(message, tag = "16")] + SyncColumns(super::SyncColumns), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SyncColumns { + #[prost(message, repeated, tag = "1")] + pub column_defs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AddColumns { + #[prost(message, repeated, tag = "1")] + pub add_columns: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DropColumns { + #[prost(message, repeated, tag = "1")] + pub drop_columns: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AddColumn { + #[prost(message, optional, tag = "1")] + pub column_def: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub location: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropColumn { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct FlushRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +/// / Regular compaction +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Regular {} +/// / Strictly-windowed compaction. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct StrictWindow { + #[prost(int64, tag = "1")] + pub window_seconds: i64, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct CompactRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(uint32, tag = "4")] + pub parallelism: u32, + #[prost(oneof = "compact_request::Options", tags = "2, 3")] + pub options: ::core::option::Option, +} +/// Nested message and enum types in `CompactRequest`. +pub mod compact_request { + #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Options { + #[prost(message, tag = "2")] + Regular(super::Regular), + #[prost(message, tag = "3")] + StrictWindow(super::StrictWindow), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TruncateRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(oneof = "truncate_request::Kind", tags = "2, 3")] + pub kind: ::core::option::Option, +} +/// Nested message and enum types in `TruncateRequest`. +pub mod truncate_request { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Kind { + #[prost(message, tag = "2")] + All(super::All), + #[prost(message, tag = "3")] + TimeRanges(super::super::TimeRanges), + } +} +/// Truncate all data in region +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct All {} +/// The column definition of a region. Unlike the message `ColumnDef` in +/// `ddl.proto` which is for clients outside GreptimeDB, this `RegionColumnDef` +/// is for region requests use only. So it carries an extra field `column_id` +/// that is known internally. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionColumnDef { + #[prost(message, optional, tag = "1")] + pub column_def: ::core::option::Option, + #[prost(uint32, tag = "2")] + pub column_id: u32, +} +/// Request of bulk ingestion API. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct BulkInsertRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(message, optional, tag = "3")] + pub partition_expr_version: ::core::option::Option, + #[prost(oneof = "bulk_insert_request::Body", tags = "2")] + pub body: ::core::option::Option, +} +/// Nested message and enum types in `BulkInsertRequest`. +pub mod bulk_insert_request { + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Body { + #[prost(message, tag = "2")] + ArrowIpc(super::super::ArrowIpc), + } +} +/// Manifest info for mito engine. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct MitoManifestInfo { + #[prost(uint64, tag = "1")] + pub data_manifest_version: u64, +} +/// Manifest info for metric engine. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct MetricManifestInfo { + #[prost(uint64, tag = "1")] + pub data_manifest_version: u64, + #[prost(uint64, tag = "2")] + pub metadata_manifest_version: u64, +} +/// Sync request for region. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct SyncRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(oneof = "sync_request::ManifestInfo", tags = "2, 3")] + pub manifest_info: ::core::option::Option, +} +/// Nested message and enum types in `SyncRequest`. +pub mod sync_request { + #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum ManifestInfo { + #[prost(message, tag = "2")] + MitoManifestInfo(super::MitoManifestInfo), + #[prost(message, tag = "3")] + MetricManifestInfo(super::MetricManifestInfo), + } +} +/// Get region metadatas of a list of regions. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ListMetadataRequest { + #[prost(uint64, repeated, tag = "1")] + pub region_ids: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct BuildIndexRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +/// The file metas of a staging manifest. +/// It is a json array of file metadatas. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct FileMetas { + #[prost(bytes = "vec", tag = "1")] + pub data: ::prost::alloc::vec::Vec, +} +/// / Apply staging manifest request. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ApplyStagingManifestRequest { + /// The target region id. + #[prost(uint64, tag = "1")] + pub region_id: u64, + /// The partition expression of the staging manifest. + #[prost(string, tag = "2")] + pub partition_expr: ::prost::alloc::string::String, + /// The region stores the staging manifest. + #[prost(uint64, tag = "3")] + pub central_region_id: u64, + /// Path to the staging manifest file. + #[prost(string, tag = "4")] + pub manifest_path: ::prost::alloc::string::String, +} +/// Generated client implementations. +pub mod region_client { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct RegionClient { + inner: tonic::client::Grpc, + } + impl RegionClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl RegionClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> RegionClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + std::marker::Send + std::marker::Sync, + { + RegionClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + pub async fn handle( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/greptime.v1.region.Region/Handle", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("greptime.v1.region.Region", "Handle")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod region_server { + #![allow( + unused_variables, + dead_code, + missing_docs, + clippy::wildcard_imports, + clippy::let_unit_value, + )] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with RegionServer. + #[async_trait] + pub trait Region: std::marker::Send + std::marker::Sync + 'static { + async fn handle( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + } + #[derive(Debug)] + pub struct RegionServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl RegionServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for RegionServer + where + T: Region, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/greptime.v1.region.Region/Handle" => { + #[allow(non_camel_case_types)] + struct HandleSvc(pub Arc); + impl tonic::server::UnaryService + for HandleSvc { + type Response = super::RegionResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::handle(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = HandleSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + let mut response = http::Response::new( + tonic::body::Body::default(), + ); + let headers = response.headers_mut(); + headers + .insert( + tonic::Status::GRPC_STATUS, + (tonic::Code::Unimplemented as i32).into(), + ); + headers + .insert( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ); + Ok(response) + }) + } + } + } + } + impl Clone for RegionServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "greptime.v1.region.Region"; + impl tonic::server::NamedService for RegionServer { + const NAME: &'static str = SERVICE_NAME; + } +} diff --git a/src/generated/greptime.v1.rs b/src/generated/greptime.v1.rs new file mode 100644 index 0000000..e050d48 --- /dev/null +++ b/src/generated/greptime.v1.rs @@ -0,0 +1,2792 @@ +// Copyright 2023 Greptime Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file is @generated by prost-build. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryContext { + #[prost(string, tag = "1")] + pub current_catalog: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub current_schema: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub timezone: ::prost::alloc::string::String, + #[prost(map = "string, string", tag = "5")] + pub extensions: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + #[prost(uint32, tag = "6")] + pub channel: u32, + #[prost(message, optional, tag = "7")] + pub snapshot_seqs: ::core::option::Option, + /// Explain options for the query. + #[prost(message, optional, tag = "8")] + pub explain: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotSequences { + /// Mappings of the RegionId to the minimal sequence of SST file to scan. + #[prost(map = "uint64, uint64", tag = "1")] + pub sst_min_sequences: ::std::collections::HashMap, + /// mapping of RegionId to SequenceNumber, for snapshot read, meaning that the + /// read should only container data that was committed before (and include) the + /// given sequence number + #[prost(map = "uint64, uint64", tag = "7")] + pub snapshot_seqs: ::std::collections::HashMap, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ExplainOptions { + /// Whether to enable verbose explain output. + #[prost(bool, tag = "1")] + pub verbose: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestHeader { + /// The `catalog` that is selected to be used in this request. + #[prost(string, tag = "1")] + pub catalog: ::prost::alloc::string::String, + /// The `schema` that is selected to be used in this request. + #[prost(string, tag = "2")] + pub schema: ::prost::alloc::string::String, + /// The `authorization` header, much like http's authorization header. + #[prost(message, optional, tag = "3")] + pub authorization: ::core::option::Option, + /// The `dbname` for the request + #[prost(string, tag = "4")] + pub dbname: ::prost::alloc::string::String, + /// Encoded trace_id & span_id, follow the w3c Trace Context + /// + #[prost(map = "string, string", tag = "5")] + pub tracing_context: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + /// The `timezone` for the request + #[prost(string, tag = "6")] + pub timezone: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ResponseHeader { + #[prost(message, optional, tag = "1")] + pub status: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Status { + /// Corresponding to the `StatusCode` definition of GreptimeDB + #[prost(uint32, tag = "1")] + pub status_code: u32, + #[prost(string, tag = "2")] + pub err_msg: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct AuthHeader { + #[prost(oneof = "auth_header::AuthScheme", tags = "1, 2")] + pub auth_scheme: ::core::option::Option, +} +/// Nested message and enum types in `AuthHeader`. +pub mod auth_header { + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum AuthScheme { + #[prost(message, tag = "1")] + Basic(super::Basic), + #[prost(message, tag = "2")] + Token(super::Token), + } +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Basic { + #[prost(string, tag = "1")] + pub username: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub password: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Token { + #[prost(string, tag = "1")] + pub token: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct TableName { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub table_name: ::prost::alloc::string::String, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct AffectedRows { + #[prost(uint32, tag = "1")] + pub value: u32, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Metrics { + #[prost(bytes = "vec", tag = "1")] + pub metrics: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ExpireAfter { + #[prost(int64, tag = "1")] + pub value: i64, +} +/// Eval Interval in seconds +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct EvalInterval { + #[prost(int64, tag = "1")] + pub seconds: i64, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct FlightMetadata { + #[prost(message, optional, tag = "1")] + pub affected_rows: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub metrics: ::core::option::Option, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct IntervalMonthDayNano { + #[prost(int32, tag = "1")] + pub months: i32, + #[prost(int32, tag = "2")] + pub days: i32, + #[prost(int64, tag = "3")] + pub nanoseconds: i64, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct TimeRange { + #[prost(int64, tag = "1")] + pub start: i64, + #[prost(int64, tag = "2")] + pub end: i64, +} +/// / Truncate partially by time ranges +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TimeRanges { + #[prost(enumeration = "TimeUnit", tag = "1")] + pub time_unit: i32, + #[prost(message, repeated, tag = "2")] + pub time_ranges: ::prost::alloc::vec::Vec, +} +/// (hi: high 64 bits, lo: low 64 bits) are used to keep the decimal128 value. +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Decimal128 { + #[prost(int64, tag = "1")] + pub hi: i64, + #[prost(int64, tag = "2")] + pub lo: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StructField { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(enumeration = "ColumnDataType", tag = "2")] + pub datatype: i32, + #[prost(message, optional, tag = "3")] + pub datatype_extension: ::core::option::Option, +} +/// Type extension for some complex types +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ColumnDataTypeExtension { + #[prost(oneof = "column_data_type_extension::TypeExt", tags = "1, 2, 3, 4, 5, 6, 7")] + pub type_ext: ::core::option::Option, +} +/// Nested message and enum types in `ColumnDataTypeExtension`. +pub mod column_data_type_extension { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum TypeExt { + #[prost(message, tag = "1")] + DecimalType(super::DecimalTypeExtension), + /// Marks the binary column in proto is actually a JSON column. + /// Deprecated + #[prost(enumeration = "super::JsonTypeExtension", tag = "2")] + JsonType(i32), + #[prost(message, tag = "3")] + VectorType(super::VectorTypeExtension), + #[prost(message, tag = "4")] + ListType(::prost::alloc::boxed::Box), + #[prost(message, tag = "5")] + StructType(super::StructTypeExtension), + /// Marks the data type is a logical json data + #[prost(message, tag = "6")] + JsonNativeType(::prost::alloc::boxed::Box), + #[prost(message, tag = "7")] + DictionaryType(::prost::alloc::boxed::Box), + } +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DecimalTypeExtension { + #[prost(int32, tag = "1")] + pub precision: i32, + #[prost(int32, tag = "2")] + pub scale: i32, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct VectorTypeExtension { + #[prost(uint32, tag = "1")] + pub dim: u32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListTypeExtension { + #[prost(enumeration = "ColumnDataType", tag = "1")] + pub datatype: i32, + #[prost(message, optional, boxed, tag = "2")] + pub datatype_extension: ::core::option::Option< + ::prost::alloc::boxed::Box, + >, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StructTypeExtension { + #[prost(message, repeated, tag = "1")] + pub fields: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct JsonNativeTypeExtension { + #[prost(enumeration = "ColumnDataType", tag = "1")] + pub datatype: i32, + #[prost(message, optional, boxed, tag = "2")] + pub datatype_extension: ::core::option::Option< + ::prost::alloc::boxed::Box, + >, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DictionaryTypeExtension { + #[prost(enumeration = "ColumnDataType", tag = "1")] + pub key_datatype: i32, + #[prost(message, optional, boxed, tag = "2")] + pub key_datatype_extension: ::core::option::Option< + ::prost::alloc::boxed::Box, + >, + #[prost(enumeration = "ColumnDataType", tag = "3")] + pub value_datatype: i32, + #[prost(message, optional, boxed, tag = "4")] + pub value_datatype_extension: ::core::option::Option< + ::prost::alloc::boxed::Box, + >, +} +/// Additional options for the column. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ColumnOptions { + /// Supported keys: + /// "fulltext": + /// A JSON encoded string containing full-text search options for the column. + /// + /// ```text + /// The fulltext options JSON structure: + /// { + /// "enable": bool, // Indicates whether full-text search is + /// // enabled for the column. + /// + /// "analyzer": string, // The language-specific text analyzer to + /// // use for indexing and searching text. + /// // Supported values: \["English" (Default), "Chinese"\]. + /// + /// "case-sensitive": bool // Indicates whether the text should be treated + /// // as case-sensitive during full-text search. + /// } + /// + /// Example: + /// "fulltext": "{\"enable\": true, \"analyzer\": \"English\", \"case-sensitive\": false}" + /// ``` + #[prost(map = "string, string", tag = "1")] + pub options: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ArrowIpc { + #[prost(bytes = "bytes", tag = "1")] + pub schema: ::prost::bytes::Bytes, + #[prost(bytes = "bytes", tag = "2")] + pub data_header: ::prost::bytes::Bytes, + #[prost(bytes = "bytes", tag = "3")] + pub payload: ::prost::bytes::Bytes, +} +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct PartitionExprVersion { + #[prost(uint64, tag = "1")] + pub value: u64, +} +#[derive(::serde::Serialize, ::serde::Deserialize)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SemanticType { + Tag = 0, + Field = 1, + Timestamp = 2, +} +impl SemanticType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Tag => "TAG", + Self::Field => "FIELD", + Self::Timestamp => "TIMESTAMP", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "TAG" => Some(Self::Tag), + "FIELD" => Some(Self::Field), + "TIMESTAMP" => Some(Self::Timestamp), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ColumnDataType { + Boolean = 0, + Int8 = 1, + Int16 = 2, + Int32 = 3, + Int64 = 4, + Uint8 = 5, + Uint16 = 6, + Uint32 = 7, + Uint64 = 8, + Float32 = 9, + Float64 = 10, + Binary = 11, + String = 12, + Date = 13, + Datetime = 14, + TimestampSecond = 15, + TimestampMillisecond = 16, + TimestampMicrosecond = 17, + TimestampNanosecond = 18, + TimeSecond = 19, + TimeMillisecond = 20, + TimeMicrosecond = 21, + TimeNanosecond = 22, + IntervalYearMonth = 23, + IntervalDayTime = 24, + IntervalMonthDayNano = 25, + Decimal128 = 30, + Json = 31, + Vector = 32, + List = 40, + Struct = 41, + Dictionary = 42, +} +impl ColumnDataType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Boolean => "BOOLEAN", + Self::Int8 => "INT8", + Self::Int16 => "INT16", + Self::Int32 => "INT32", + Self::Int64 => "INT64", + Self::Uint8 => "UINT8", + Self::Uint16 => "UINT16", + Self::Uint32 => "UINT32", + Self::Uint64 => "UINT64", + Self::Float32 => "FLOAT32", + Self::Float64 => "FLOAT64", + Self::Binary => "BINARY", + Self::String => "STRING", + Self::Date => "DATE", + Self::Datetime => "DATETIME", + Self::TimestampSecond => "TIMESTAMP_SECOND", + Self::TimestampMillisecond => "TIMESTAMP_MILLISECOND", + Self::TimestampMicrosecond => "TIMESTAMP_MICROSECOND", + Self::TimestampNanosecond => "TIMESTAMP_NANOSECOND", + Self::TimeSecond => "TIME_SECOND", + Self::TimeMillisecond => "TIME_MILLISECOND", + Self::TimeMicrosecond => "TIME_MICROSECOND", + Self::TimeNanosecond => "TIME_NANOSECOND", + Self::IntervalYearMonth => "INTERVAL_YEAR_MONTH", + Self::IntervalDayTime => "INTERVAL_DAY_TIME", + Self::IntervalMonthDayNano => "INTERVAL_MONTH_DAY_NANO", + Self::Decimal128 => "DECIMAL128", + Self::Json => "JSON", + Self::Vector => "VECTOR", + Self::List => "LIST", + Self::Struct => "STRUCT", + Self::Dictionary => "DICTIONARY", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "BOOLEAN" => Some(Self::Boolean), + "INT8" => Some(Self::Int8), + "INT16" => Some(Self::Int16), + "INT32" => Some(Self::Int32), + "INT64" => Some(Self::Int64), + "UINT8" => Some(Self::Uint8), + "UINT16" => Some(Self::Uint16), + "UINT32" => Some(Self::Uint32), + "UINT64" => Some(Self::Uint64), + "FLOAT32" => Some(Self::Float32), + "FLOAT64" => Some(Self::Float64), + "BINARY" => Some(Self::Binary), + "STRING" => Some(Self::String), + "DATE" => Some(Self::Date), + "DATETIME" => Some(Self::Datetime), + "TIMESTAMP_SECOND" => Some(Self::TimestampSecond), + "TIMESTAMP_MILLISECOND" => Some(Self::TimestampMillisecond), + "TIMESTAMP_MICROSECOND" => Some(Self::TimestampMicrosecond), + "TIMESTAMP_NANOSECOND" => Some(Self::TimestampNanosecond), + "TIME_SECOND" => Some(Self::TimeSecond), + "TIME_MILLISECOND" => Some(Self::TimeMillisecond), + "TIME_MICROSECOND" => Some(Self::TimeMicrosecond), + "TIME_NANOSECOND" => Some(Self::TimeNanosecond), + "INTERVAL_YEAR_MONTH" => Some(Self::IntervalYearMonth), + "INTERVAL_DAY_TIME" => Some(Self::IntervalDayTime), + "INTERVAL_MONTH_DAY_NANO" => Some(Self::IntervalMonthDayNano), + "DECIMAL128" => Some(Self::Decimal128), + "JSON" => Some(Self::Json), + "VECTOR" => Some(Self::Vector), + "LIST" => Some(Self::List), + "STRUCT" => Some(Self::Struct), + "DICTIONARY" => Some(Self::Dictionary), + _ => None, + } + } +} +/// / Time Unit for timestamp +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum TimeUnit { + /// The default time unit is MILLISECOND + Millisecond = 0, + Second = 1, + Microsecond = 2, + Nanosecond = 3, +} +impl TimeUnit { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Millisecond => "MILLISECOND", + Self::Second => "SECOND", + Self::Microsecond => "MICROSECOND", + Self::Nanosecond => "NANOSECOND", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "MILLISECOND" => Some(Self::Millisecond), + "SECOND" => Some(Self::Second), + "MICROSECOND" => Some(Self::Microsecond), + "NANOSECOND" => Some(Self::Nanosecond), + _ => None, + } + } +} +/// Deprecated +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum JsonTypeExtension { + JsonBinary = 0, +} +impl JsonTypeExtension { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::JsonBinary => "JSON_BINARY", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "JSON_BINARY" => Some(Self::JsonBinary), + _ => None, + } + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Rows { + #[prost(message, repeated, tag = "1")] + pub schema: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "2")] + pub rows: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ColumnSchema { + #[prost(string, tag = "1")] + pub column_name: ::prost::alloc::string::String, + #[prost(enumeration = "ColumnDataType", tag = "2")] + pub datatype: i32, + #[prost(enumeration = "SemanticType", tag = "3")] + pub semantic_type: i32, + /// Extension for ColumnDataType. + #[prost(message, optional, tag = "4")] + pub datatype_extension: ::core::option::Option, + /// Additional column options. + #[prost(message, optional, tag = "5")] + pub options: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Row { + #[prost(message, repeated, tag = "1")] + pub values: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Value { + #[prost( + oneof = "value::ValueData", + tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 31, 40, 41, 42" + )] + pub value_data: ::core::option::Option, +} +/// Nested message and enum types in `Value`. +pub mod value { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum ValueData { + #[prost(int32, tag = "1")] + I8Value(i32), + #[prost(int32, tag = "2")] + I16Value(i32), + #[prost(int32, tag = "3")] + I32Value(i32), + #[prost(int64, tag = "4")] + I64Value(i64), + #[prost(uint32, tag = "5")] + U8Value(u32), + #[prost(uint32, tag = "6")] + U16Value(u32), + #[prost(uint32, tag = "7")] + U32Value(u32), + #[prost(uint64, tag = "8")] + U64Value(u64), + #[prost(float, tag = "9")] + F32Value(f32), + #[prost(double, tag = "10")] + F64Value(f64), + #[prost(bool, tag = "11")] + BoolValue(bool), + #[prost(bytes, tag = "12")] + BinaryValue(::prost::alloc::vec::Vec), + #[prost(string, tag = "13")] + StringValue(::prost::alloc::string::String), + #[prost(int32, tag = "14")] + DateValue(i32), + #[prost(int64, tag = "15")] + DatetimeValue(i64), + #[prost(int64, tag = "16")] + TimestampSecondValue(i64), + #[prost(int64, tag = "17")] + TimestampMillisecondValue(i64), + #[prost(int64, tag = "18")] + TimestampMicrosecondValue(i64), + #[prost(int64, tag = "19")] + TimestampNanosecondValue(i64), + #[prost(int64, tag = "20")] + TimeSecondValue(i64), + #[prost(int64, tag = "21")] + TimeMillisecondValue(i64), + #[prost(int64, tag = "22")] + TimeMicrosecondValue(i64), + #[prost(int64, tag = "23")] + TimeNanosecondValue(i64), + #[prost(int32, tag = "24")] + IntervalYearMonthValue(i32), + #[prost(int64, tag = "25")] + IntervalDayTimeValue(i64), + #[prost(message, tag = "26")] + IntervalMonthDayNanoValue(super::IntervalMonthDayNano), + #[prost(message, tag = "31")] + Decimal128Value(super::Decimal128), + #[prost(message, tag = "40")] + ListValue(super::ListValue), + #[prost(message, tag = "41")] + StructValue(super::StructValue), + #[prost(message, tag = "42")] + JsonValue(super::JsonValue), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListValue { + #[prost(message, repeated, tag = "1")] + pub items: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StructValue { + #[prost(message, repeated, tag = "2")] + pub items: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct JsonValue { + #[prost(oneof = "json_value::Value", tags = "1, 2, 3, 4, 5, 6, 7")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `JsonValue`. +pub mod json_value { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(bool, tag = "1")] + Boolean(bool), + #[prost(int64, tag = "2")] + Int(i64), + #[prost(uint64, tag = "3")] + Uint(u64), + #[prost(double, tag = "4")] + Float(f64), + #[prost(string, tag = "5")] + Str(::prost::alloc::string::String), + #[prost(message, tag = "6")] + Array(super::JsonList), + #[prost(message, tag = "7")] + Object(super::JsonObject), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct JsonList { + #[prost(message, repeated, tag = "1")] + pub items: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct JsonObject { + #[prost(message, repeated, tag = "1")] + pub entries: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `JsonObject`. +pub mod json_object { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Entry { + #[prost(string, tag = "1")] + pub key: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub value: ::core::option::Option, + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Column { + #[prost(string, tag = "1")] + pub column_name: ::prost::alloc::string::String, + #[prost(enumeration = "SemanticType", tag = "2")] + pub semantic_type: i32, + /// The array of non-null values in this column. + /// + /// For example: suppose there is a column "foo" that contains some int32 + /// values (1, 2, 3, 4, 5, null, 7, 8, 9, null); + /// column: + /// column_name: foo + /// semantic_type: Tag + /// values: 1, 2, 3, 4, 5, 7, 8, 9 + /// null_masks: 00100000 00000010 + #[prost(message, optional, tag = "3")] + pub values: ::core::option::Option, + /// Mask maps the positions of null values. + /// If a bit in null_mask is 1, it indicates that the column value at that + /// position is null. + #[prost(bytes = "vec", tag = "4")] + pub null_mask: ::prost::alloc::vec::Vec, + /// Helpful in creating vector from column. + #[prost(enumeration = "ColumnDataType", tag = "5")] + pub datatype: i32, + /// Extension for ColumnDataType. + #[prost(message, optional, tag = "6")] + pub datatype_extension: ::core::option::Option, + /// Additional column options. + #[prost(message, optional, tag = "7")] + pub options: ::core::option::Option, +} +/// Nested message and enum types in `Column`. +pub mod column { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Values { + #[prost(int32, repeated, tag = "1")] + pub i8_values: ::prost::alloc::vec::Vec, + #[prost(int32, repeated, tag = "2")] + pub i16_values: ::prost::alloc::vec::Vec, + #[prost(int32, repeated, tag = "3")] + pub i32_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "4")] + pub i64_values: ::prost::alloc::vec::Vec, + #[prost(uint32, repeated, tag = "5")] + pub u8_values: ::prost::alloc::vec::Vec, + #[prost(uint32, repeated, tag = "6")] + pub u16_values: ::prost::alloc::vec::Vec, + #[prost(uint32, repeated, tag = "7")] + pub u32_values: ::prost::alloc::vec::Vec, + #[prost(uint64, repeated, tag = "8")] + pub u64_values: ::prost::alloc::vec::Vec, + #[prost(float, repeated, tag = "9")] + pub f32_values: ::prost::alloc::vec::Vec, + #[prost(double, repeated, tag = "10")] + pub f64_values: ::prost::alloc::vec::Vec, + #[prost(bool, repeated, tag = "11")] + pub bool_values: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", repeated, tag = "12")] + pub binary_values: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(string, repeated, tag = "13")] + pub string_values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(int32, repeated, tag = "14")] + pub date_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "15")] + pub datetime_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "16")] + pub timestamp_second_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "17")] + pub timestamp_millisecond_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "18")] + pub timestamp_microsecond_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "19")] + pub timestamp_nanosecond_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "20")] + pub time_second_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "21")] + pub time_millisecond_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "22")] + pub time_microsecond_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "23")] + pub time_nanosecond_values: ::prost::alloc::vec::Vec, + #[prost(int32, repeated, tag = "24")] + pub interval_year_month_values: ::prost::alloc::vec::Vec, + #[prost(int64, repeated, tag = "25")] + pub interval_day_time_values: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "26")] + pub interval_month_day_nano_values: ::prost::alloc::vec::Vec< + super::IntervalMonthDayNano, + >, + #[prost(message, repeated, tag = "31")] + pub decimal128_values: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "40")] + pub list_values: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "41")] + pub struct_values: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "42")] + pub json_values: ::prost::alloc::vec::Vec, + } +} +/// "Data Definition Language" requests, that create, modify or delete the +/// database structures but not the data. `DdlRequest` could carry more +/// information than plain SQL, for example, the "table_id" in `CreateTableExpr`. +/// So create a new DDL expr if you need it. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DdlRequest { + #[prost(oneof = "ddl_request::Expr", tags = "1, 2, 3, 4, 7, 8, 9, 10, 11, 12, 13")] + pub expr: ::core::option::Option, +} +/// Nested message and enum types in `DdlRequest`. +pub mod ddl_request { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Expr { + #[prost(message, tag = "1")] + CreateDatabase(super::CreateDatabaseExpr), + #[prost(message, tag = "2")] + CreateTable(super::CreateTableExpr), + #[prost(message, tag = "3")] + AlterTable(super::AlterTableExpr), + #[prost(message, tag = "4")] + DropTable(super::DropTableExpr), + #[prost(message, tag = "7")] + TruncateTable(super::TruncateTableExpr), + #[prost(message, tag = "8")] + CreateFlow(super::CreateFlowExpr), + #[prost(message, tag = "9")] + DropFlow(super::DropFlowExpr), + #[prost(message, tag = "10")] + CreateView(super::CreateViewExpr), + #[prost(message, tag = "11")] + DropView(super::DropViewExpr), + #[prost(message, tag = "12")] + AlterDatabase(super::AlterDatabaseExpr), + #[prost(message, tag = "13")] + CommentOn(super::CommentOnExpr), + } +} +/// Create a flow to run the SQL when new data arrives. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateFlowExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub flow_name: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub source_table_names: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "4")] + pub sink_table_name: ::core::option::Option, + #[prost(bool, tag = "5")] + pub or_replace: bool, + #[prost(bool, tag = "6")] + pub create_if_not_exists: bool, + /// Expire data older than the given duration seconds. + #[prost(message, optional, tag = "7")] + pub expire_after: ::core::option::Option, + #[prost(message, optional, tag = "11")] + pub eval_interval: ::core::option::Option, + #[prost(string, tag = "8")] + pub comment: ::prost::alloc::string::String, + #[prost(string, tag = "9")] + pub sql: ::prost::alloc::string::String, + #[prost(map = "string, string", tag = "10")] + pub flow_options: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, +} +/// Drop a flow. +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropFlowExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub flow_name: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub flow_id: ::core::option::Option, + #[prost(bool, tag = "5")] + pub drop_if_exists: bool, +} +/// Create a view +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateViewExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub view_name: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "4")] + pub logical_plan: ::prost::alloc::vec::Vec, + #[prost(bool, tag = "5")] + pub create_if_not_exists: bool, + #[prost(bool, tag = "6")] + pub or_replace: bool, + #[prost(message, repeated, tag = "7")] + pub table_names: ::prost::alloc::vec::Vec, + #[prost(string, repeated, tag = "8")] + pub columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag = "9")] + pub plan_columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, tag = "10")] + pub definition: ::prost::alloc::string::String, +} +/// Drop a view +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropViewExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub view_name: ::prost::alloc::string::String, + #[prost(message, optional, tag = "4")] + pub view_id: ::core::option::Option, + #[prost(bool, tag = "5")] + pub drop_if_exists: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateTableExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub table_name: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub desc: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "5")] + pub column_defs: ::prost::alloc::vec::Vec, + #[prost(string, tag = "6")] + pub time_index: ::prost::alloc::string::String, + #[prost(string, repeated, tag = "7")] + pub primary_keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag = "8")] + pub create_if_not_exists: bool, + #[prost(map = "string, string", tag = "9")] + pub table_options: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + #[prost(message, optional, tag = "10")] + pub table_id: ::core::option::Option, + #[prost(string, tag = "12")] + pub engine: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AlterTableExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub table_name: ::prost::alloc::string::String, + #[prost( + oneof = "alter_table_expr::Kind", + tags = "4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18" + )] + pub kind: ::core::option::Option, +} +/// Nested message and enum types in `AlterTableExpr`. +pub mod alter_table_expr { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Kind { + #[prost(message, tag = "4")] + AddColumns(super::AddColumns), + #[prost(message, tag = "5")] + DropColumns(super::DropColumns), + #[prost(message, tag = "6")] + RenameTable(super::RenameTable), + #[prost(message, tag = "7")] + ModifyColumnTypes(super::ModifyColumnTypes), + #[prost(message, tag = "8")] + SetTableOptions(super::SetTableOptions), + #[prost(message, tag = "11")] + UnsetTableOptions(super::UnsetTableOptions), + /// Deprecated: use set_indexes instead. + #[prost(message, tag = "12")] + SetIndex(super::SetIndex), + /// Deprecated: use unset_indexes instead. + #[prost(message, tag = "13")] + UnsetIndex(super::UnsetIndex), + #[prost(message, tag = "14")] + DropDefaults(super::DropDefaults), + #[prost(message, tag = "15")] + SetIndexes(super::SetIndexes), + #[prost(message, tag = "16")] + UnsetIndexes(super::UnsetIndexes), + #[prost(message, tag = "17")] + SetDefaults(super::SetDefaults), + #[prost(message, tag = "18")] + Repartition(super::Repartition), + } +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropDefault { + #[prost(string, tag = "1")] + pub column_name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetIndexes { + #[prost(message, repeated, tag = "1")] + pub set_indexes: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnsetIndexes { + #[prost(message, repeated, tag = "1")] + pub unset_indexes: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct SetDefault { + #[prost(string, tag = "1")] + pub column_name: ::prost::alloc::string::String, + /// The JSON representation of the default `Expr`. + #[prost(bytes = "vec", tag = "2")] + pub default_constraint: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetIndex { + #[prost(oneof = "set_index::Options", tags = "1, 2, 3")] + pub options: ::core::option::Option, +} +/// Nested message and enum types in `SetIndex`. +pub mod set_index { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Options { + #[prost(message, tag = "1")] + Fulltext(super::SetFulltext), + #[prost(message, tag = "2")] + Inverted(super::SetInverted), + #[prost(message, tag = "3")] + Skipping(super::SetSkipping), + } +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct UnsetIndex { + #[prost(oneof = "unset_index::Options", tags = "1, 2, 3")] + pub options: ::core::option::Option, +} +/// Nested message and enum types in `UnsetIndex`. +pub mod unset_index { + #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] + pub enum Options { + #[prost(message, tag = "1")] + Fulltext(super::UnsetFulltext), + #[prost(message, tag = "2")] + Inverted(super::UnsetInverted), + #[prost(message, tag = "3")] + Skipping(super::UnsetSkipping), + } +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Repartition { + /// The from partition expressions serialized in JSON format. + #[prost(string, repeated, tag = "1")] + pub from_partition_exprs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// The into partition expressions serialized in JSON format. + #[prost(string, repeated, tag = "2")] + pub into_partition_exprs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropTableExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub table_name: ::prost::alloc::string::String, + #[prost(message, optional, tag = "4")] + pub table_id: ::core::option::Option, + #[prost(bool, tag = "5")] + pub drop_if_exists: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateDatabaseExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(bool, tag = "3")] + pub create_if_not_exists: bool, + #[prost(map = "string, string", tag = "4")] + pub options: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TruncateTableExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub table_name: ::prost::alloc::string::String, + #[prost(message, optional, tag = "4")] + pub table_id: ::core::option::Option, + /// if empty, truncate entire table, else only truncate time ranges + #[prost(message, optional, tag = "5")] + pub time_ranges: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct DropDatabaseExpr { + #[prost(string, tag = "1")] + pub catalog_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub schema_name: ::prost::alloc::string::String, + #[prost(bool, tag = "3")] + pub drop_if_exists: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AddColumns { + #[prost(message, repeated, tag = "1")] + pub add_columns: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DropDefaults { + #[prost(message, repeated, tag = "1")] + pub drop_defaults: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetDefaults { + #[prost(message, repeated, tag = "1")] + pub set_defaults: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DropColumns { + #[prost(message, repeated, tag = "1")] + pub drop_columns: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModifyColumnTypes { + #[prost(message, repeated, tag = "1")] + pub modify_column_types: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct RenameTable { + #[prost(string, tag = "1")] + pub new_table_name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AddColumn { + #[prost(message, optional, tag = "1")] + pub column_def: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub location: ::core::option::Option, + #[prost(bool, tag = "4")] + pub add_if_not_exists: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModifyColumnType { + #[prost(string, tag = "1")] + pub column_name: ::prost::alloc::string::String, + #[prost(enumeration = "ColumnDataType", tag = "2")] + pub target_type: i32, + #[prost(message, optional, tag = "3")] + pub target_type_extension: ::core::option::Option, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct Option { + #[prost(string, tag = "1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub value: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetTableOptions { + #[prost(message, repeated, tag = "1")] + pub table_options: ::prost::alloc::vec::Vec