Skip to content

Commit

Permalink
chore: rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneutt committed Dec 5, 2023
1 parent 649f8fc commit 940f6aa
Showing 1 changed file with 89 additions and 47 deletions.
136 changes: 89 additions & 47 deletions dataplane/api-server/src/backends.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ pub struct InterfaceIndexConfirmation {
/// Generated client implementations.
pub mod backends_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct BackendsClient<T> {
inner: tonic::client::Grpc<T>,
Expand Down Expand Up @@ -90,8 +90,9 @@ pub mod backends_client {
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
BackendsClient::new(InterceptedService::new(inner, interceptor))
}
Expand Down Expand Up @@ -129,16 +130,23 @@ pub mod backends_client {
pub async fn get_interface_index(
&mut self,
request: impl tonic::IntoRequest<super::PodIp>,
) -> std::result::Result<tonic::Response<super::InterfaceIndexConfirmation>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
) -> std::result::Result<
tonic::Response<super::InterfaceIndexConfirmation>,
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("/backends.backends/GetInterfaceIndex");
let path = http::uri::PathAndQuery::from_static(
"/backends.backends/GetInterfaceIndex",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("backends.backends", "GetInterfaceIndex"));
Expand All @@ -148,34 +156,38 @@ pub mod backends_client {
&mut self,
request: impl tonic::IntoRequest<super::Targets>,
) -> std::result::Result<tonic::Response<super::Confirmation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
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("/backends.backends/Update");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("backends.backends", "Update"));
req.extensions_mut().insert(GrpcMethod::new("backends.backends", "Update"));
self.inner.unary(req, path, codec).await
}
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::Vip>,
) -> std::result::Result<tonic::Response<super::Confirmation>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
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("/backends.backends/Delete");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("backends.backends", "Delete"));
req.extensions_mut().insert(GrpcMethod::new("backends.backends", "Delete"));
self.inner.unary(req, path, codec).await
}
}
Expand All @@ -190,7 +202,10 @@ pub mod backends_server {
async fn get_interface_index(
&self,
request: tonic::Request<super::PodIp>,
) -> std::result::Result<tonic::Response<super::InterfaceIndexConfirmation>, tonic::Status>;
) -> std::result::Result<
tonic::Response<super::InterfaceIndexConfirmation>,
tonic::Status,
>;
async fn update(
&self,
request: tonic::Request<super::Targets>,
Expand Down Expand Up @@ -223,7 +238,10 @@ pub mod backends_server {
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
Expand Down Expand Up @@ -279,12 +297,21 @@ pub mod backends_server {
"/backends.backends/GetInterfaceIndex" => {
#[allow(non_camel_case_types)]
struct GetInterfaceIndexSvc<T: Backends>(pub Arc<T>);
impl<T: Backends> tonic::server::UnaryService<super::PodIp> for GetInterfaceIndexSvc<T> {
impl<T: Backends> tonic::server::UnaryService<super::PodIp>
for GetInterfaceIndexSvc<T> {
type Response = super::InterfaceIndexConfirmation;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(&mut self, request: tonic::Request<super::PodIp>) -> Self::Future {
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PodIp>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { (*inner).get_interface_index(request).await };
let fut = async move {
(*inner).get_interface_index(request).await
};
Box::pin(fut)
}
}
Expand Down Expand Up @@ -314,9 +341,13 @@ pub mod backends_server {
"/backends.backends/Update" => {
#[allow(non_camel_case_types)]
struct UpdateSvc<T: Backends>(pub Arc<T>);
impl<T: Backends> tonic::server::UnaryService<super::Targets> for UpdateSvc<T> {
impl<T: Backends> tonic::server::UnaryService<super::Targets>
for UpdateSvc<T> {
type Response = super::Confirmation;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Targets>,
Expand Down Expand Up @@ -352,10 +383,17 @@ pub mod backends_server {
"/backends.backends/Delete" => {
#[allow(non_camel_case_types)]
struct DeleteSvc<T: Backends>(pub Arc<T>);
impl<T: Backends> tonic::server::UnaryService<super::Vip> for DeleteSvc<T> {
impl<T: Backends> tonic::server::UnaryService<super::Vip>
for DeleteSvc<T> {
type Response = super::Confirmation;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(&mut self, request: tonic::Request<super::Vip>) -> Self::Future {
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Vip>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move { (*inner).delete(request).await };
Box::pin(fut)
Expand Down Expand Up @@ -384,14 +422,18 @@ pub mod backends_server {
};
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())
}),
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
Expand Down

0 comments on commit 940f6aa

Please sign in to comment.