pub mod database_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct DatabaseClient<T> {
inner: tonic::client::Grpc<T>,
}
impl DatabaseClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> DatabaseClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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,
) -> DatabaseClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
DatabaseClient::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
}
pub async fn has(
&mut self,
request: impl tonic::IntoRequest<super::HasRequest>,
) -> Result<tonic::Response<super::HasResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Has");
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::GetRequest>,
) -> Result<tonic::Response<super::GetResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Get");
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn put(
&mut self,
request: impl tonic::IntoRequest<super::PutRequest>,
) -> Result<tonic::Response<super::PutResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Put");
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::DeleteRequest>,
) -> Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Delete");
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn compact(
&mut self,
request: impl tonic::IntoRequest<super::CompactRequest>,
) -> Result<tonic::Response<super::CompactResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Compact");
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn close(
&mut self,
request: impl tonic::IntoRequest<super::CloseRequest>,
) -> Result<tonic::Response<super::CloseResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Close");
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn health_check(
&mut self,
request: impl tonic::IntoRequest<super::super::google::protobuf::Empty>,
) -> Result<tonic::Response<super::HealthCheckResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/rpcdb.Database/HealthCheck",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn write_batch(
&mut self,
request: impl tonic::IntoRequest<super::WriteBatchRequest>,
) -> Result<tonic::Response<super::WriteBatchResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/rpcdb.Database/WriteBatch",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn new_iterator_with_start_and_prefix(
&mut self,
request: impl tonic::IntoRequest<super::NewIteratorWithStartAndPrefixRequest>,
) -> Result<
tonic::Response<super::NewIteratorWithStartAndPrefixResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/rpcdb.Database/NewIteratorWithStartAndPrefix",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn iterator_next(
&mut self,
request: impl tonic::IntoRequest<super::IteratorNextRequest>,
) -> Result<tonic::Response<super::IteratorNextResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/rpcdb.Database/IteratorNext",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn iterator_error(
&mut self,
request: impl tonic::IntoRequest<super::IteratorErrorRequest>,
) -> Result<tonic::Response<super::IteratorErrorResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/rpcdb.Database/IteratorError",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn iterator_release(
&mut self,
request: impl tonic::IntoRequest<super::IteratorReleaseRequest>,
) -> Result<tonic::Response<super::IteratorReleaseResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/rpcdb.Database/IteratorRelease",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
pub mod database_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait Database: Send + Sync + 'static {
async fn has(
&self,
request: tonic::Request<super::HasRequest>,
) -> Result<tonic::Response<super::HasResponse>, tonic::Status>;
async fn get(
&self,
request: tonic::Request<super::GetRequest>,
) -> Result<tonic::Response<super::GetResponse>, tonic::Status>;
async fn put(
&self,
request: tonic::Request<super::PutRequest>,
) -> Result<tonic::Response<super::PutResponse>, tonic::Status>;
async fn delete(
&self,
request: tonic::Request<super::DeleteRequest>,
) -> Result<tonic::Response<super::DeleteResponse>, tonic::Status>;
async fn compact(
&self,
request: tonic::Request<super::CompactRequest>,
) -> Result<tonic::Response<super::CompactResponse>, tonic::Status>;
async fn close(
&self,
request: tonic::Request<super::CloseRequest>,
) -> Result<tonic::Response<super::CloseResponse>, tonic::Status>;
async fn health_check(
&self,
request: tonic::Request<super::super::google::protobuf::Empty>,
) -> Result<tonic::Response<super::HealthCheckResponse>, tonic::Status>;
async fn write_batch(
&self,
request: tonic::Request<super::WriteBatchRequest>,
) -> Result<tonic::Response<super::WriteBatchResponse>, tonic::Status>;
async fn new_iterator_with_start_and_prefix(
&self,
request: tonic::Request<super::NewIteratorWithStartAndPrefixRequest>,
) -> Result<
tonic::Response<super::NewIteratorWithStartAndPrefixResponse>,
tonic::Status,
>;
async fn iterator_next(
&self,
request: tonic::Request<super::IteratorNextRequest>,
) -> Result<tonic::Response<super::IteratorNextResponse>, tonic::Status>;
async fn iterator_error(
&self,
request: tonic::Request<super::IteratorErrorRequest>,
) -> Result<tonic::Response<super::IteratorErrorResponse>, tonic::Status>;
async fn iterator_release(
&self,
request: tonic::Request<super::IteratorReleaseRequest>,
) -> Result<tonic::Response<super::IteratorReleaseResponse>, tonic::Status>;
}
#[derive(Debug)]
pub struct DatabaseServer<T: Database> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: Database> DatabaseServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
}
}
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
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for DatabaseServer<T>
where
T: Database,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/rpcdb.Database/Has" => {
#[allow(non_camel_case_types)]
struct HasSvc<T: Database>(pub Arc<T>);
impl<T: Database> tonic::server::UnaryService<super::HasRequest>
for HasSvc<T> {
type Response = super::HasResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::HasRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).has(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = HasSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/Get" => {
#[allow(non_camel_case_types)]
struct GetSvc<T: Database>(pub Arc<T>);
impl<T: Database> tonic::server::UnaryService<super::GetRequest>
for GetSvc<T> {
type Response = super::GetResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).get(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = GetSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/Put" => {
#[allow(non_camel_case_types)]
struct PutSvc<T: Database>(pub Arc<T>);
impl<T: Database> 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 = self.0.clone();
let fut = async move { (*inner).put(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = PutSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: Database>(pub Arc<T>);
impl<T: Database> tonic::server::UnaryService<super::DeleteRequest>
for DeleteSvc<T> {
type Response = super::DeleteResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DeleteRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).delete(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = DeleteSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/Compact" => {
#[allow(non_camel_case_types)]
struct CompactSvc<T: Database>(pub Arc<T>);
impl<T: Database> tonic::server::UnaryService<super::CompactRequest>
for CompactSvc<T> {
type Response = super::CompactResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CompactRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).compact(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = CompactSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/Close" => {
#[allow(non_camel_case_types)]
struct CloseSvc<T: Database>(pub Arc<T>);
impl<T: Database> tonic::server::UnaryService<super::CloseRequest>
for CloseSvc<T> {
type Response = super::CloseResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CloseRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).close(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = CloseSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/HealthCheck" => {
#[allow(non_camel_case_types)]
struct HealthCheckSvc<T: Database>(pub Arc<T>);
impl<
T: Database,
> tonic::server::UnaryService<super::super::google::protobuf::Empty>
for HealthCheckSvc<T> {
type Response = super::HealthCheckResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::super::google::protobuf::Empty,
>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).health_check(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = HealthCheckSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/WriteBatch" => {
#[allow(non_camel_case_types)]
struct WriteBatchSvc<T: Database>(pub Arc<T>);
impl<
T: Database,
> tonic::server::UnaryService<super::WriteBatchRequest>
for WriteBatchSvc<T> {
type Response = super::WriteBatchResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::WriteBatchRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).write_batch(request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = WriteBatchSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/NewIteratorWithStartAndPrefix" => {
#[allow(non_camel_case_types)]
struct NewIteratorWithStartAndPrefixSvc<T: Database>(pub Arc<T>);
impl<
T: Database,
> tonic::server::UnaryService<
super::NewIteratorWithStartAndPrefixRequest,
> for NewIteratorWithStartAndPrefixSvc<T> {
type Response = super::NewIteratorWithStartAndPrefixResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::NewIteratorWithStartAndPrefixRequest,
>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).new_iterator_with_start_and_prefix(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = NewIteratorWithStartAndPrefixSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/IteratorNext" => {
#[allow(non_camel_case_types)]
struct IteratorNextSvc<T: Database>(pub Arc<T>);
impl<
T: Database,
> tonic::server::UnaryService<super::IteratorNextRequest>
for IteratorNextSvc<T> {
type Response = super::IteratorNextResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IteratorNextRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).iterator_next(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = IteratorNextSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/IteratorError" => {
#[allow(non_camel_case_types)]
struct IteratorErrorSvc<T: Database>(pub Arc<T>);
impl<
T: Database,
> tonic::server::UnaryService<super::IteratorErrorRequest>
for IteratorErrorSvc<T> {
type Response = super::IteratorErrorResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IteratorErrorRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).iterator_error(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = IteratorErrorSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/rpcdb.Database/IteratorRelease" => {
#[allow(non_camel_case_types)]
struct IteratorReleaseSvc<T: Database>(pub Arc<T>);
impl<
T: Database,
> tonic::server::UnaryService<super::IteratorReleaseRequest>
for IteratorReleaseSvc<T> {
type Response = super::IteratorReleaseResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IteratorReleaseRequest>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
(*inner).iterator_release(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = IteratorReleaseSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: Database> Clone for DatabaseServer<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,
}
}
}
impl<T: Database> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Database> tonic::server::NamedService for DatabaseServer<T> {
const NAME: &'static str = "rpcdb.Database";
}
}