#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestHeader {
#[prost(uint64, tag = "1")]
pub protocol_version: u64,
#[prost(uint64, tag = "3")]
pub member_id: u64,
#[prost(enumeration = "Role", tag = "4")]
pub role: i32,
#[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 {
#[prost(int64, tag = "1")]
pub start_timestamp_millis: i64,
#[prost(int64, tag = "2")]
pub end_timestamp_millis: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct KeyValue {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
#[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 {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Datanode => "DATANODE",
Self::Frontend => "FRONTEND",
Self::Flownode => "FLOWNODE",
}
}
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>,
#[prost(message, optional, tag = "2")]
pub peer: ::core::option::Option<Peer>,
#[prost(message, optional, tag = "3")]
pub report_interval: ::core::option::Option<TimeInterval>,
#[prost(message, repeated, tag = "4")]
pub region_stats: ::prost::alloc::vec::Vec<RegionStat>,
#[prost(message, optional, tag = "5")]
pub mailbox_message: ::core::option::Option<MailboxMessage>,
#[prost(uint64, tag = "6")]
pub duration_since_epoch: u64,
#[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>,
#[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>,
>,
#[prost(oneof = "heartbeat_request::NodeWorkloads", tags = "10, 11, 12")]
pub node_workloads: ::core::option::Option<heartbeat_request::NodeWorkloads>,
}
pub mod heartbeat_request {
#[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),
}
}
#[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>,
}
#[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>,
}
#[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 {
#[prost(string, tag = "1")]
pub version: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub git_commit: ::prost::alloc::string::String,
#[prost(uint64, tag = "3")]
pub start_time_ms: u64,
#[deprecated]
#[prost(uint32, tag = "4")]
pub cpus: u32,
#[deprecated]
#[prost(uint64, tag = "5")]
pub memory_bytes: u64,
#[prost(string, tag = "6")]
pub hostname: ::prost::alloc::string::String,
#[prost(int64, tag = "7")]
pub total_cpu_millicores: i64,
#[prost(int64, tag = "8")]
pub total_memory_bytes: i64,
#[prost(int64, tag = "9")]
pub cpu_usage_millicores: i64,
#[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,
#[prost(int64, tag = "2")]
pub rcus: i64,
#[prost(int64, tag = "3")]
pub wcus: i64,
#[prost(int64, tag = "4")]
pub approximate_bytes: i64,
#[prost(string, tag = "6")]
pub engine: ::prost::alloc::string::String,
#[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 {
#[prost(string, tag = "1")]
pub topic_name: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub record_size: u64,
#[prost(uint64, tag = "3")]
pub record_num: u64,
#[prost(uint64, tag = "4")]
pub latest_entry_id: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FlowStat {
#[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>,
#[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,
}
#[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 {
#[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 {
#[prost(message, optional, tag = "64")]
pub header: ::core::option::Option<MailboxMessageHeader>,
#[prost(uint64, tag = "1")]
pub id: u64,
#[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,
#[prost(int64, tag = "5")]
pub timestamp_millis: i64,
#[prost(oneof = "mailbox_message::Payload", tags = "6")]
pub payload: ::core::option::Option<mailbox_message::Payload>,
}
pub mod mailbox_message {
#[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 {
Leader = 0,
Follower = 1,
DowngradingLeader = 2,
}
impl RegionRole {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Leader => "Leader",
Self::Follower => "Follower",
Self::DowngradingLeader => "DowngradingLeader",
}
}
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),
_ => None,
}
}
}
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> {
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))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn 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
}
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
}
}
}
pub mod heartbeat_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Heartbeat: std::marker::Send + std::marker::Sync + 'static {
type HeartbeatStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::HeartbeatResponse, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn heartbeat(
&self,
request: tonic::Request<tonic::Streaming<super::HeartbeatRequest>>,
) -> std::result::Result<tonic::Response<Self::HeartbeatStream>, tonic::Status>;
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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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,
}
}
}
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,
}
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> {
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))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn 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
}
}
}
pub mod config_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Config: std::marker::Send + std::marker::Sync + 'static {
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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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,
}
}
}
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>,
#[prost(uint64, tag = "2")]
pub leader_peer_index: u64,
#[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 {
#[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,
>,
}
#[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>>,
#[prost(string, tag = "3")]
pub expression: ::prost::alloc::string::String,
}
#[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>,
}
#[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>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DropViewTask {
#[prost(message, optional, tag = "1")]
pub drop_view: ::core::option::Option<super::DropViewExpr>,
}
#[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>,
#[prost(message, optional, tag = "64")]
pub query_context: ::core::option::Option<super::QueryContext>,
#[prost(bool, tag = "65")]
pub wait: bool,
#[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>,
}
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>,
#[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 {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Create => "Create",
Self::Drop => "Drop",
}
}
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>,
#[prost(bytes = "vec", tag = "2")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")]
pub range_end: ::prost::alloc::vec::Vec<u8>,
#[prost(int64, tag = "4")]
pub limit: i64,
#[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>,
#[prost(message, repeated, tag = "2")]
pub kvs: ::prost::alloc::vec::Vec<KeyValue>,
#[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>,
#[prost(bytes = "vec", tag = "2")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")]
pub value: ::prost::alloc::vec::Vec<u8>,
#[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>,
#[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>,
#[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>,
#[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>>,
#[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>,
#[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>,
#[prost(bytes = "vec", tag = "2")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")]
pub expect: ::prost::alloc::vec::Vec<u8>,
#[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>,
#[prost(bytes = "vec", tag = "2")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")]
pub range_end: ::prost::alloc::vec::Vec<u8>,
#[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>,
#[prost(int64, tag = "2")]
pub deleted: i64,
#[prost(message, repeated, tag = "3")]
pub prev_kvs: ::prost::alloc::vec::Vec<KeyValue>,
}
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> {
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))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn 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
}
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
}
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
}
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
}
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
}
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
}
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
}
}
}
pub mod store_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Store: std::marker::Send + std::marker::Sync + 'static {
async fn range(
&self,
request: tonic::Request<super::RangeRequest>,
) -> std::result::Result<tonic::Response<super::RangeResponse>, tonic::Status>;
async fn put(
&self,
request: tonic::Request<super::PutRequest>,
) -> std::result::Result<tonic::Response<super::PutResponse>, tonic::Status>;
async fn batch_get(
&self,
request: tonic::Request<super::BatchGetRequest>,
) -> std::result::Result<
tonic::Response<super::BatchGetResponse>,
tonic::Status,
>;
async fn batch_put(
&self,
request: tonic::Request<super::BatchPutRequest>,
) -> std::result::Result<
tonic::Response<super::BatchPutResponse>,
tonic::Status,
>;
async fn batch_delete(
&self,
request: tonic::Request<super::BatchDeleteRequest>,
) -> std::result::Result<
tonic::Response<super::BatchDeleteResponse>,
tonic::Status,
>;
async fn compare_and_put(
&self,
request: tonic::Request<super::CompareAndPutRequest>,
) -> std::result::Result<
tonic::Response<super::CompareAndPutResponse>,
tonic::Status,
>;
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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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,
}
}
}
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>,
#[prost(bytes = "vec", tag = "2")]
pub name: ::prost::alloc::vec::Vec<u8>,
#[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>,
#[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>,
#[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>,
}
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> {
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))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn 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
}
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
}
}
}
pub mod lock_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Lock: std::marker::Send + std::marker::Sync + 'static {
async fn lock(
&self,
request: tonic::Request<super::LockRequest>,
) -> std::result::Result<tonic::Response<super::LockResponse>, tonic::Status>;
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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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,
}
}
}
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]
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
#[deprecated]
#[prost(string, tag = "3")]
pub git_commit: ::prost::alloc::string::String,
#[deprecated]
#[prost(uint64, tag = "4")]
pub start_time_ms: u64,
#[deprecated]
#[prost(uint32, tag = "5")]
pub cpus: u32,
#[deprecated]
#[prost(uint64, tag = "6")]
pub memory_bytes: u64,
#[prost(message, optional, tag = "7")]
pub info: ::core::option::Option<NodeInfo>,
}
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;
#[derive(Debug, Clone)]
pub struct ClusterClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ClusterClient<tonic::transport::Channel> {
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))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn 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
}
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
}
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
}
}
}
pub mod cluster_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Cluster: std::marker::Send + std::marker::Sync + 'static {
async fn batch_get(
&self,
request: tonic::Request<super::BatchGetRequest>,
) -> std::result::Result<
tonic::Response<super::BatchGetResponse>,
tonic::Status,
>;
async fn range(
&self,
request: tonic::Request<super::RangeRequest>,
) -> std::result::Result<tonic::Response<super::RangeResponse>, tonic::Status>;
async fn metasrv_peers(
&self,
request: tonic::Request<super::MetasrvPeersRequest>,
) -> std::result::Result<
tonic::Response<super::MetasrvPeersResponse>,
tonic::Status,
>;
}
#[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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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,
}
}
}
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>,
}
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>,
#[prost(bool, tag = "3")]
pub full_file_listing: bool,
#[prost(uint32, tag = "4")]
pub timeout_secs: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GcStats {
#[prost(uint64, tag = "1")]
pub processed_regions: u64,
#[prost(uint64, repeated, tag = "2")]
pub need_retry_regions: ::prost::alloc::vec::Vec<u64>,
#[prost(uint64, tag = "3")]
pub deleted_files: u64,
#[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,
#[prost(bool, tag = "5")]
pub full_file_listing: bool,
#[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 {
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",
}
}
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 {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::UseLatest => "UseLatest",
Self::UseMetasrv => "UseMetasrv",
Self::AbortOnConflict => "AbortOnConflict",
}
}
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,
}
}
}
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> {
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))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn 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
}
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
}
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
}
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
}
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
}
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
}
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
}
}
}
pub mod procedure_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait ProcedureService: std::marker::Send + std::marker::Sync + 'static {
async fn query(
&self,
request: tonic::Request<super::QueryProcedureRequest>,
) -> std::result::Result<
tonic::Response<super::ProcedureStateResponse>,
tonic::Status,
>;
async fn ddl(
&self,
request: tonic::Request<super::DdlTaskRequest>,
) -> std::result::Result<tonic::Response<super::DdlTaskResponse>, tonic::Status>;
async fn reconcile(
&self,
request: tonic::Request<super::ReconcileRequest>,
) -> std::result::Result<
tonic::Response<super::ReconcileResponse>,
tonic::Status,
>;
async fn migrate(
&self,
request: tonic::Request<super::MigrateRegionRequest>,
) -> std::result::Result<
tonic::Response<super::MigrateRegionResponse>,
tonic::Status,
>;
async fn details(
&self,
request: tonic::Request<super::ProcedureDetailRequest>,
) -> std::result::Result<
tonic::Response<super::ProcedureDetailResponse>,
tonic::Status,
>;
async fn gc_regions(
&self,
request: tonic::Request<super::GcRegionsRequest>,
) -> std::result::Result<
tonic::Response<super::GcRegionsResponse>,
tonic::Status,
>;
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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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,
}
}
}
pub const SERVICE_NAME: &str = "greptime.v1.meta.ProcedureService";
impl<T> tonic::server::NamedService for ProcedureServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}