// 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
    /// <https://www.w3.org/TR/trace-context/#header-name>
    #[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<Error>,
}
#[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<u8>,
    /// value is the value held by the key, in bytes.
    #[prost(bytes = "vec", tag = "2")]
    pub value: ::prost::alloc::vec::Vec<u8>,
}
/// Procedure identifier
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ProcedureId {
    #[prost(bytes = "vec", tag = "1")]
    pub key: ::prost::alloc::vec::Vec<u8>,
}
#[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<Self> {
        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<RequestHeader>,
    /// Self peer
    #[prost(message, optional, tag = "2")]
    pub peer: ::core::option::Option<Peer>,
    /// Actually reported time interval
    #[prost(message, optional, tag = "3")]
    pub report_interval: ::core::option::Option<TimeInterval>,
    /// Region stats on this node
    #[prost(message, repeated, tag = "4")]
    pub region_stats: ::prost::alloc::vec::Vec<RegionStat>,
    /// Mailbox send message to Metasrv
    #[prost(message, optional, tag = "5")]
    pub mailbox_message: ::core::option::Option<MailboxMessage>,
    /// 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<NodeInfo>,
    #[prost(message, optional, tag = "9")]
    pub flow_stat: ::core::option::Option<FlowStat>,
    /// The topic stats of the datanode.
    #[prost(message, repeated, tag = "13")]
    pub topic_stats: ::prost::alloc::vec::Vec<TopicStat>,
    #[prost(map = "string, bytes", tag = "99")]
    pub extensions: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::vec::Vec<u8>,
    >,
    /// / The workloads of the node.
    #[prost(oneof = "heartbeat_request::NodeWorkloads", tags = "10, 11, 12")]
    pub node_workloads: ::core::option::Option<heartbeat_request::NodeWorkloads>,
}
/// 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<i32>,
}
/// / 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<i32>,
}
/// / 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<i32>,
}
#[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<u8>,
    >,
}
#[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<u32, u64>,
    #[prost(map = "uint32, int64", tag = "2")]
    pub flow_last_exec_time_map: ::std::collections::HashMap<u32, i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HeartbeatResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    #[prost(message, optional, tag = "2")]
    pub mailbox_message: ::core::option::Option<MailboxMessage>,
    #[prost(message, optional, tag = "3")]
    pub region_lease: ::core::option::Option<RegionLease>,
    /// Heartbeat configuration issued by Metasrv
    /// Populated only in the handshake response
    #[prost(message, optional, tag = "4")]
    pub heartbeat_config: ::core::option::Option<HeartbeatConfig>,
}
#[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<u8>,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegionLease {
    #[prost(message, repeated, tag = "1")]
    pub regions: ::prost::alloc::vec::Vec<GrantedRegion>,
    #[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<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AskLeaderRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AskLeaderResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    #[prost(message, optional, tag = "2")]
    pub leader: ::core::option::Option<Peer>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MailboxMessageHeader {
    /// Encoded trace_id & span_id, follow the w3c Trace Context
    /// <https://www.w3.org/TR/trace-context/#header-name>
    #[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<MailboxMessageHeader>,
    /// 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<mailbox_message::Payload>,
}
/// 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,
    /// A leader under staging mode.
    StagingLeader = 3,
}
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",
            Self::StagingLeader => "StagingLeader",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "Leader" => Some(Self::Leader),
            "Follower" => Some(Self::Follower),
            "DowngradingLeader" => Some(Self::DowngradingLeader),
            "StagingLeader" => Some(Self::StagingLeader),
            _ => 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<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl HeartbeatClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> HeartbeatClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
            inner: T,
            interceptor: F,
        ) -> HeartbeatClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + 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<Message = super::HeartbeatRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::HeartbeatResponse>>,
            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<super::AskLeaderRequest>,
        ) -> std::result::Result<
            tonic::Response<super::AskLeaderResponse>,
            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<super::HeartbeatResponse, tonic::Status>,
            >
            + 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<tonic::Streaming<super::HeartbeatRequest>>,
        ) -> std::result::Result<tonic::Response<Self::HeartbeatStream>, tonic::Status>;
        /// Ask leader's endpoint.
        async fn ask_leader(
            &self,
            request: tonic::Request<super::AskLeaderRequest>,
        ) -> std::result::Result<
            tonic::Response<super::AskLeaderResponse>,
            tonic::Status,
        >;
    }
    #[derive(Debug)]
    pub struct HeartbeatServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> HeartbeatServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> 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<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        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<T, B> tonic::codegen::Service<http::Request<B>> for HeartbeatServer<T>
    where
        T: Heartbeat,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/greptime.v1.meta.Heartbeat/Heartbeat" => {
                    #[allow(non_camel_case_types)]
                    struct HeartbeatSvc<T: Heartbeat>(pub Arc<T>);
                    impl<
                        T: Heartbeat,
                    > tonic::server::StreamingService<super::HeartbeatRequest>
                    for HeartbeatSvc<T> {
                        type Response = super::HeartbeatResponse;
                        type ResponseStream = T::HeartbeatStream;
                        type Future = BoxFuture<
                            tonic::Response<Self::ResponseStream>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<
                                tonic::Streaming<super::HeartbeatRequest>,
                            >,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Heartbeat>::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<T: Heartbeat>(pub Arc<T>);
                    impl<
                        T: Heartbeat,
                    > tonic::server::UnaryService<super::AskLeaderRequest>
                    for AskLeaderSvc<T> {
                        type Response = super::AskLeaderResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::AskLeaderRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Heartbeat>::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<T> Clone for HeartbeatServer<T> {
        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<T> tonic::server::NamedService for HeartbeatServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PullConfigRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PullConfigResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    #[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<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl ConfigClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> ConfigClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
            inner: T,
            interceptor: F,
        ) -> ConfigClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + 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<super::PullConfigRequest>,
        ) -> std::result::Result<
            tonic::Response<super::PullConfigResponse>,
            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<super::PullConfigRequest>,
        ) -> std::result::Result<
            tonic::Response<super::PullConfigResponse>,
            tonic::Status,
        >;
    }
    #[derive(Debug)]
    pub struct ConfigServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> ConfigServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> 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<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        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<T, B> tonic::codegen::Service<http::Request<B>> for ConfigServer<T>
    where
        T: Config,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/greptime.v1.meta.Config/PullConfig" => {
                    #[allow(non_camel_case_types)]
                    struct PullConfigSvc<T: Config>(pub Arc<T>);
                    impl<T: Config> tonic::server::UnaryService<super::PullConfigRequest>
                    for PullConfigSvc<T> {
                        type Response = super::PullConfigResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::PullConfigRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Config>::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<T> Clone for ConfigServer<T> {
        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<T> tonic::server::NamedService for ConfigServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableRoute {
    #[prost(message, optional, tag = "1")]
    pub table: ::core::option::Option<Table>,
    #[prost(message, repeated, tag = "2")]
    pub region_routes: ::prost::alloc::vec::Vec<RegionRoute>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegionRoute {
    #[prost(message, optional, tag = "1")]
    pub region: ::core::option::Option<Region>,
    /// 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<u64>,
}
#[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<super::TableName>,
    #[prost(bytes = "vec", tag = "3")]
    pub table_schema: ::prost::alloc::vec::Vec<u8>,
}
#[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<Partition>,
    #[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<u8>>,
    #[deprecated]
    #[prost(bytes = "vec", repeated, tag = "2")]
    pub value_list: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// 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<Peer>,
    #[prost(message, optional, tag = "2")]
    pub table_route: ::core::option::Option<TableRoute>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateDatabaseTask {
    #[prost(message, optional, tag = "1")]
    pub create_database: ::core::option::Option<super::CreateDatabaseExpr>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTableTask {
    #[prost(message, optional, tag = "1")]
    pub create_table: ::core::option::Option<super::CreateTableExpr>,
    #[prost(message, repeated, tag = "2")]
    pub partitions: ::prost::alloc::vec::Vec<Partition>,
    #[prost(bytes = "vec", tag = "3")]
    pub table_info: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTableTasks {
    #[prost(message, repeated, tag = "1")]
    pub tasks: ::prost::alloc::vec::Vec<CreateTableTask>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropTableTask {
    #[prost(message, optional, tag = "1")]
    pub drop_table: ::core::option::Option<super::DropTableExpr>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DropTableTasks {
    #[prost(message, repeated, tag = "1")]
    pub tasks: ::prost::alloc::vec::Vec<DropTableTask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AlterTableTask {
    #[prost(message, optional, tag = "1")]
    pub alter_table: ::core::option::Option<super::AlterTableExpr>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AlterTableTasks {
    #[prost(message, repeated, tag = "1")]
    pub tasks: ::prost::alloc::vec::Vec<AlterTableTask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TruncateTableTask {
    #[prost(message, optional, tag = "1")]
    pub truncate_table: ::core::option::Option<super::TruncateTableExpr>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropDatabaseTask {
    #[prost(message, optional, tag = "1")]
    pub drop_database: ::core::option::Option<super::DropDatabaseExpr>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateFlowTask {
    #[prost(message, optional, tag = "1")]
    pub create_flow: ::core::option::Option<super::CreateFlowExpr>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropFlowTask {
    #[prost(message, optional, tag = "1")]
    pub drop_flow: ::core::option::Option<super::DropFlowExpr>,
}
/// Create a view task
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateViewTask {
    #[prost(message, optional, tag = "1")]
    pub create_view: ::core::option::Option<super::CreateViewExpr>,
    #[prost(bytes = "vec", tag = "2")]
    pub view_info: ::prost::alloc::vec::Vec<u8>,
}
/// 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<super::DropViewExpr>,
}
/// Alter database tasks
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AlterDatabaseTask {
    #[prost(message, optional, tag = "1")]
    pub task: ::core::option::Option<super::AlterDatabaseExpr>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTriggerTask {
    #[prost(message, optional, tag = "1")]
    pub create_trigger: ::core::option::Option<super::CreateTriggerExpr>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropTriggerTask {
    #[prost(message, optional, tag = "1")]
    pub drop_trigger: ::core::option::Option<super::DropTriggerExpr>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CommentOnTask {
    #[prost(message, optional, tag = "1")]
    pub comment_on: ::core::option::Option<super::CommentOnExpr>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DdlTaskRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    /// The query context for the ddl procedures.
    #[prost(message, optional, tag = "64")]
    pub query_context: ::core::option::Option<super::QueryContext>,
    /// 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<ddl_task_request::Task>,
}
/// 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<ResponseHeader>,
    #[prost(message, optional, tag = "2")]
    pub pid: ::core::option::Option<ProcedureId>,
    /// Returns if the tables created.
    #[prost(message, repeated, tag = "5")]
    pub table_ids: ::prost::alloc::vec::Vec<super::TableId>,
}
#[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<Self> {
        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<RequestHeader>,
    #[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<ResponseHeader>,
    #[prost(message, optional, tag = "2")]
    pub pid: ::core::option::Option<ProcedureId>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RangeRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    /// 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<u8>,
    /// 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<u8>,
    /// 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<ResponseHeader>,
    /// kvs is the list of key-value pairs matched by the range request.
    #[prost(message, repeated, tag = "2")]
    pub kvs: ::prost::alloc::vec::Vec<KeyValue>,
    /// 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<RequestHeader>,
    /// key is the key, in bytes, to put into the key-value store.
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    /// 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<u8>,
    /// 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<ResponseHeader>,
    /// 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<KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    #[prost(bytes = "vec", repeated, tag = "2")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    #[prost(message, repeated, tag = "2")]
    pub kvs: ::prost::alloc::vec::Vec<KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchPutRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    #[prost(message, repeated, tag = "2")]
    pub kvs: ::prost::alloc::vec::Vec<KeyValue>,
    /// 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<ResponseHeader>,
    /// 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<KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchDeleteRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    #[prost(bytes = "vec", repeated, tag = "2")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// 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<ResponseHeader>,
    /// 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<KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompareAndPutRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    /// key is the key, in bytes, to put into the key-value store.
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    /// expect is the previous value, in bytes
    #[prost(bytes = "vec", tag = "3")]
    pub expect: ::prost::alloc::vec::Vec<u8>,
    /// 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<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CompareAndPutResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    #[prost(bool, tag = "2")]
    pub success: bool,
    #[prost(message, optional, tag = "3")]
    pub prev_kv: ::core::option::Option<KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteRangeRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    /// key is the first key to delete in the range.
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    /// 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<u8>,
    /// 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<ResponseHeader>,
    /// 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<KeyValue>,
}
/// 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<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl StoreClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> StoreClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
            inner: T,
            interceptor: F,
        ) -> StoreClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + 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<super::RangeRequest>,
        ) -> std::result::Result<tonic::Response<super::RangeResponse>, 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<super::PutRequest>,
        ) -> std::result::Result<tonic::Response<super::PutResponse>, 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<super::BatchGetRequest>,
        ) -> std::result::Result<
            tonic::Response<super::BatchGetResponse>,
            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<super::BatchPutRequest>,
        ) -> std::result::Result<
            tonic::Response<super::BatchPutResponse>,
            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<super::BatchDeleteRequest>,
        ) -> std::result::Result<
            tonic::Response<super::BatchDeleteResponse>,
            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<super::CompareAndPutRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CompareAndPutResponse>,
            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<super::DeleteRangeRequest>,
        ) -> std::result::Result<
            tonic::Response<super::DeleteRangeResponse>,
            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<super::RangeRequest>,
        ) -> std::result::Result<tonic::Response<super::RangeResponse>, tonic::Status>;
        /// Put puts the given key into the key-value store.
        async fn put(
            &self,
            request: tonic::Request<super::PutRequest>,
        ) -> std::result::Result<tonic::Response<super::PutResponse>, tonic::Status>;
        /// BatchGet atomically get values by the given keys from the key-value store.
        async fn batch_get(
            &self,
            request: tonic::Request<super::BatchGetRequest>,
        ) -> std::result::Result<
            tonic::Response<super::BatchGetResponse>,
            tonic::Status,
        >;
        /// BatchPut atomically puts the given keys into the key-value store.
        async fn batch_put(
            &self,
            request: tonic::Request<super::BatchPutRequest>,
        ) -> std::result::Result<
            tonic::Response<super::BatchPutResponse>,
            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<super::BatchDeleteRequest>,
        ) -> std::result::Result<
            tonic::Response<super::BatchDeleteResponse>,
            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<super::CompareAndPutRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CompareAndPutResponse>,
            tonic::Status,
        >;
        /// DeleteRange deletes the given range from the key-value store.
        async fn delete_range(
            &self,
            request: tonic::Request<super::DeleteRangeRequest>,
        ) -> std::result::Result<
            tonic::Response<super::DeleteRangeResponse>,
            tonic::Status,
        >;
    }
    #[derive(Debug)]
    pub struct StoreServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> StoreServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> 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<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        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<T, B> tonic::codegen::Service<http::Request<B>> for StoreServer<T>
    where
        T: Store,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/greptime.v1.meta.Store/Range" => {
                    #[allow(non_camel_case_types)]
                    struct RangeSvc<T: Store>(pub Arc<T>);
                    impl<T: Store> tonic::server::UnaryService<super::RangeRequest>
                    for RangeSvc<T> {
                        type Response = super::RangeResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::RangeRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Store>::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<T: Store>(pub Arc<T>);
                    impl<T: Store> tonic::server::UnaryService<super::PutRequest>
                    for PutSvc<T> {
                        type Response = super::PutResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::PutRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Store>::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<T: Store>(pub Arc<T>);
                    impl<T: Store> tonic::server::UnaryService<super::BatchGetRequest>
                    for BatchGetSvc<T> {
                        type Response = super::BatchGetResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::BatchGetRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Store>::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<T: Store>(pub Arc<T>);
                    impl<T: Store> tonic::server::UnaryService<super::BatchPutRequest>
                    for BatchPutSvc<T> {
                        type Response = super::BatchPutResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::BatchPutRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Store>::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<T: Store>(pub Arc<T>);
                    impl<T: Store> tonic::server::UnaryService<super::BatchDeleteRequest>
                    for BatchDeleteSvc<T> {
                        type Response = super::BatchDeleteResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::BatchDeleteRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Store>::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<T: Store>(pub Arc<T>);
                    impl<
                        T: Store,
                    > tonic::server::UnaryService<super::CompareAndPutRequest>
                    for CompareAndPutSvc<T> {
                        type Response = super::CompareAndPutResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::CompareAndPutRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Store>::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<T: Store>(pub Arc<T>);
                    impl<T: Store> tonic::server::UnaryService<super::DeleteRangeRequest>
                    for DeleteRangeSvc<T> {
                        type Response = super::DeleteRangeResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::DeleteRangeRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Store>::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<T> Clone for StoreServer<T> {
        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<T> tonic::server::NamedService for StoreServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LockRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    /// Name is the identifier for the distributed shared lock to be acquired.
    #[prost(bytes = "vec", tag = "2")]
    pub name: ::prost::alloc::vec::Vec<u8>,
    /// 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<ResponseHeader>,
    /// Key will exist as long as lock is held by the caller.
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnlockRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    /// key is the lock ownership key granted by Lock.
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnlockResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
}
/// 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<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl LockClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> LockClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
            inner: T,
            interceptor: F,
        ) -> LockClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + 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<super::LockRequest>,
        ) -> std::result::Result<tonic::Response<super::LockResponse>, 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<super::UnlockRequest>,
        ) -> std::result::Result<tonic::Response<super::UnlockResponse>, 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<super::LockRequest>,
        ) -> std::result::Result<tonic::Response<super::LockResponse>, tonic::Status>;
        /// Unlock takes a key returned by Lock and releases the hold on lock.
        async fn unlock(
            &self,
            request: tonic::Request<super::UnlockRequest>,
        ) -> std::result::Result<tonic::Response<super::UnlockResponse>, tonic::Status>;
    }
    #[derive(Debug)]
    pub struct LockServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> LockServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> 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<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        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<T, B> tonic::codegen::Service<http::Request<B>> for LockServer<T>
    where
        T: Lock,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/greptime.v1.meta.Lock/Lock" => {
                    #[allow(non_camel_case_types)]
                    struct LockSvc<T: Lock>(pub Arc<T>);
                    impl<T: Lock> tonic::server::UnaryService<super::LockRequest>
                    for LockSvc<T> {
                        type Response = super::LockResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::LockRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Lock>::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<T: Lock>(pub Arc<T>);
                    impl<T: Lock> tonic::server::UnaryService<super::UnlockRequest>
                    for UnlockSvc<T> {
                        type Response = super::UnlockResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::UnlockRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Lock>::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<T> Clone for LockServer<T> {
        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<T> tonic::server::NamedService for LockServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MetasrvPeersRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MetasrvPeersResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    #[prost(message, optional, tag = "2")]
    pub leader: ::core::option::Option<MetasrvNodeInfo>,
    #[prost(message, repeated, tag = "3")]
    pub followers: ::prost::alloc::vec::Vec<MetasrvNodeInfo>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MetasrvNodeInfo {
    #[prost(message, optional, tag = "1")]
    pub peer: ::core::option::Option<Peer>,
    /// 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<NodeInfo>,
}
/// 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<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl ClusterClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> ClusterClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
            inner: T,
            interceptor: F,
        ) -> ClusterClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + 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<super::BatchGetRequest>,
        ) -> std::result::Result<
            tonic::Response<super::BatchGetResponse>,
            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<super::RangeRequest>,
        ) -> std::result::Result<tonic::Response<super::RangeResponse>, 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<super::MetasrvPeersRequest>,
        ) -> std::result::Result<
            tonic::Response<super::MetasrvPeersResponse>,
            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<super::BatchGetRequest>,
        ) -> std::result::Result<
            tonic::Response<super::BatchGetResponse>,
            tonic::Status,
        >;
        /// Range get the kvs from leader's in_memory kv store.
        async fn range(
            &self,
            request: tonic::Request<super::RangeRequest>,
        ) -> std::result::Result<tonic::Response<super::RangeResponse>, tonic::Status>;
        /// Returns all the peers of metasrv.
        async fn metasrv_peers(
            &self,
            request: tonic::Request<super::MetasrvPeersRequest>,
        ) -> std::result::Result<
            tonic::Response<super::MetasrvPeersResponse>,
            tonic::Status,
        >;
    }
    /// Cluster service is used for communication between meta nodes.
    #[derive(Debug)]
    pub struct ClusterServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> ClusterServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> 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<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        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<T, B> tonic::codegen::Service<http::Request<B>> for ClusterServer<T>
    where
        T: Cluster,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/greptime.v1.meta.Cluster/BatchGet" => {
                    #[allow(non_camel_case_types)]
                    struct BatchGetSvc<T: Cluster>(pub Arc<T>);
                    impl<T: Cluster> tonic::server::UnaryService<super::BatchGetRequest>
                    for BatchGetSvc<T> {
                        type Response = super::BatchGetResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::BatchGetRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Cluster>::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<T: Cluster>(pub Arc<T>);
                    impl<T: Cluster> tonic::server::UnaryService<super::RangeRequest>
                    for RangeSvc<T> {
                        type Response = super::RangeResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::RangeRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Cluster>::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<T: Cluster>(pub Arc<T>);
                    impl<
                        T: Cluster,
                    > tonic::server::UnaryService<super::MetasrvPeersRequest>
                    for MetasrvPeersSvc<T> {
                        type Response = super::MetasrvPeersResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::MetasrvPeersRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Cluster>::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<T> Clone for ClusterServer<T> {
        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<T> tonic::server::NamedService for ClusterServer<T> {
        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<ProcedureId>,
    #[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<RequestHeader>,
    #[prost(message, optional, tag = "2")]
    pub pid: ::core::option::Option<ProcedureId>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ProcedureStateResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    #[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<RequestHeader>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProcedureDetailResponse {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<ResponseHeader>,
    #[prost(message, repeated, tag = "2")]
    pub procedures: ::prost::alloc::vec::Vec<ProcedureMeta>,
}
#[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<RequestHeader>,
    #[prost(oneof = "reconcile_request::Target", tags = "2, 3, 4")]
    pub target: ::core::option::Option<reconcile_request::Target>,
}
/// 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<ResponseHeader>,
    #[prost(message, optional, tag = "2")]
    pub pid: ::core::option::Option<ProcedureId>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcRegionsRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    #[prost(uint64, repeated, tag = "2")]
    pub region_ids: ::prost::alloc::vec::Vec<u64>,
    /// 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<u64>,
    /// 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<ResponseHeader>,
    #[prost(message, optional, tag = "2")]
    pub stats: ::core::option::Option<GcStats>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcTableRequest {
    #[prost(message, optional, tag = "1")]
    pub header: ::core::option::Option<RequestHeader>,
    #[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<ResponseHeader>,
    #[prost(message, optional, tag = "2")]
    pub stats: ::core::option::Option<GcStats>,
}
#[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<Self> {
        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<Self> {
        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<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl ProcedureServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> ProcedureServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
            inner: T,
            interceptor: F,
        ) -> ProcedureServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + 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<super::QueryProcedureRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ProcedureStateResponse>,
            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<super::DdlTaskRequest>,
        ) -> std::result::Result<
            tonic::Response<super::DdlTaskResponse>,
            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<super::ReconcileRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ReconcileResponse>,
            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<super::MigrateRegionRequest>,
        ) -> std::result::Result<
            tonic::Response<super::MigrateRegionResponse>,
            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<super::ProcedureDetailRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ProcedureDetailResponse>,
            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<super::GcRegionsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GcRegionsResponse>,
            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<super::GcTableRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GcTableResponse>,
            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<super::QueryProcedureRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ProcedureStateResponse>,
            tonic::Status,
        >;
        /// Submits a DDL task
        async fn ddl(
            &self,
            request: tonic::Request<super::DdlTaskRequest>,
        ) -> std::result::Result<tonic::Response<super::DdlTaskResponse>, tonic::Status>;
        /// Submits a reconcile task
        async fn reconcile(
            &self,
            request: tonic::Request<super::ReconcileRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ReconcileResponse>,
            tonic::Status,
        >;
        /// Submits a region migration task
        async fn migrate(
            &self,
            request: tonic::Request<super::MigrateRegionRequest>,
        ) -> std::result::Result<
            tonic::Response<super::MigrateRegionResponse>,
            tonic::Status,
        >;
        /// Query all submitted procedures details
        async fn details(
            &self,
            request: tonic::Request<super::ProcedureDetailRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ProcedureDetailResponse>,
            tonic::Status,
        >;
        /// Manually trigger GC for a specific list of regions
        async fn gc_regions(
            &self,
            request: tonic::Request<super::GcRegionsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GcRegionsResponse>,
            tonic::Status,
        >;
        /// Manually trigger GC for a table (all its regions)
        async fn gc_table(
            &self,
            request: tonic::Request<super::GcTableRequest>,
        ) -> std::result::Result<tonic::Response<super::GcTableResponse>, tonic::Status>;
    }
    #[derive(Debug)]
    pub struct ProcedureServiceServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> ProcedureServiceServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> 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<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        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<T, B> tonic::codegen::Service<http::Request<B>> for ProcedureServiceServer<T>
    where
        T: ProcedureService,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/greptime.v1.meta.ProcedureService/query" => {
                    #[allow(non_camel_case_types)]
                    struct querySvc<T: ProcedureService>(pub Arc<T>);
                    impl<
                        T: ProcedureService,
                    > tonic::server::UnaryService<super::QueryProcedureRequest>
                    for querySvc<T> {
                        type Response = super::ProcedureStateResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::QueryProcedureRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as ProcedureService>::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<T: ProcedureService>(pub Arc<T>);
                    impl<
                        T: ProcedureService,
                    > tonic::server::UnaryService<super::DdlTaskRequest> for ddlSvc<T> {
                        type Response = super::DdlTaskResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::DdlTaskRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as ProcedureService>::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<T: ProcedureService>(pub Arc<T>);
                    impl<
                        T: ProcedureService,
                    > tonic::server::UnaryService<super::ReconcileRequest>
                    for reconcileSvc<T> {
                        type Response = super::ReconcileResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::ReconcileRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as ProcedureService>::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<T: ProcedureService>(pub Arc<T>);
                    impl<
                        T: ProcedureService,
                    > tonic::server::UnaryService<super::MigrateRegionRequest>
                    for migrateSvc<T> {
                        type Response = super::MigrateRegionResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::MigrateRegionRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as ProcedureService>::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<T: ProcedureService>(pub Arc<T>);
                    impl<
                        T: ProcedureService,
                    > tonic::server::UnaryService<super::ProcedureDetailRequest>
                    for detailsSvc<T> {
                        type Response = super::ProcedureDetailResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::ProcedureDetailRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as ProcedureService>::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<T: ProcedureService>(pub Arc<T>);
                    impl<
                        T: ProcedureService,
                    > tonic::server::UnaryService<super::GcRegionsRequest>
                    for gc_regionsSvc<T> {
                        type Response = super::GcRegionsResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::GcRegionsRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as ProcedureService>::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<T: ProcedureService>(pub Arc<T>);
                    impl<
                        T: ProcedureService,
                    > tonic::server::UnaryService<super::GcTableRequest>
                    for gc_tableSvc<T> {
                        type Response = super::GcTableResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::GcTableRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as ProcedureService>::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<T> Clone for ProcedureServiceServer<T> {
        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<T> tonic::server::NamedService for ProcedureServiceServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}
