use super::data::*;
pub mod flight_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct FlightServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl FlightServiceClient<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> FlightServiceClient<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,
) -> FlightServiceClient<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,
{
FlightServiceClient::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 handshake(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::HandshakeRequest>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::HandshakeResponse>>, 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(
"/arrow.flight.protocol.FlightService/Handshake",
);
self.inner
.streaming(request.into_streaming_request(), path, codec)
.await
}
pub async fn list_flights(
&mut self,
request: impl tonic::IntoRequest<super::Criteria>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::FlightInfo>>, 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(
"/arrow.flight.protocol.FlightService/ListFlights",
);
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
pub async fn get_flight_info(
&mut self,
request: impl tonic::IntoRequest<super::FlightDescriptor>,
) -> Result<tonic::Response<super::FlightInfo>, 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(
"/arrow.flight.protocol.FlightService/GetFlightInfo",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_schema(
&mut self,
request: impl tonic::IntoRequest<super::FlightDescriptor>,
) -> Result<tonic::Response<super::SchemaResult>, 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(
"/arrow.flight.protocol.FlightService/GetSchema",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn do_get(
&mut self,
request: impl tonic::IntoRequest<super::Ticket>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::FlightData>>, 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("/arrow.flight.protocol.FlightService/DoGet");
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
pub async fn do_put(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::FlightData>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::PutResult>>, 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("/arrow.flight.protocol.FlightService/DoPut");
self.inner
.streaming(request.into_streaming_request(), path, codec)
.await
}
pub async fn do_exchange(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::FlightData>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::FlightData>>, 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(
"/arrow.flight.protocol.FlightService/DoExchange",
);
self.inner
.streaming(request.into_streaming_request(), path, codec)
.await
}
pub async fn do_action(
&mut self,
request: impl tonic::IntoRequest<super::Action>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::Result>>, 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(
"/arrow.flight.protocol.FlightService/DoAction",
);
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
pub async fn list_actions(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> Result<tonic::Response<tonic::codec::Streaming<super::ActionType>>, 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(
"/arrow.flight.protocol.FlightService/ListActions",
);
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
}
}
pub mod flight_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[async_trait]
pub trait FlightService: Send + Sync + 'static {
type HandshakeStream: futures_core::Stream<Item = Result<super::HandshakeResponse, tonic::Status>>
+ Send
+ 'static;
async fn handshake(
&self,
request: tonic::Request<tonic::Streaming<super::HandshakeRequest>>,
) -> Result<tonic::Response<Self::HandshakeStream>, tonic::Status>;
type ListFlightsStream: futures_core::Stream<Item = Result<super::FlightInfo, tonic::Status>>
+ Send
+ 'static;
async fn list_flights(
&self,
request: tonic::Request<super::Criteria>,
) -> Result<tonic::Response<Self::ListFlightsStream>, tonic::Status>;
async fn get_flight_info(
&self,
request: tonic::Request<super::FlightDescriptor>,
) -> Result<tonic::Response<super::FlightInfo>, tonic::Status>;
async fn get_schema(
&self,
request: tonic::Request<super::FlightDescriptor>,
) -> Result<tonic::Response<super::SchemaResult>, tonic::Status>;
type DoGetStream: futures_core::Stream<Item = Result<super::FlightData, tonic::Status>>
+ Send
+ 'static;
async fn do_get(
&self,
request: tonic::Request<super::Ticket>,
) -> Result<tonic::Response<Self::DoGetStream>, tonic::Status>;
type DoPutStream: futures_core::Stream<Item = Result<super::PutResult, tonic::Status>>
+ Send
+ 'static;
async fn do_put(
&self,
request: tonic::Request<tonic::Streaming<super::FlightData>>,
) -> Result<tonic::Response<Self::DoPutStream>, tonic::Status>;
type DoExchangeStream: futures_core::Stream<Item = Result<super::FlightData, tonic::Status>>
+ Send
+ 'static;
async fn do_exchange(
&self,
request: tonic::Request<tonic::Streaming<super::FlightData>>,
) -> Result<tonic::Response<Self::DoExchangeStream>, tonic::Status>;
type DoActionStream: futures_core::Stream<Item = Result<super::Result, tonic::Status>>
+ Send
+ 'static;
async fn do_action(
&self,
request: tonic::Request<super::Action>,
) -> Result<tonic::Response<Self::DoActionStream>, tonic::Status>;
type ListActionsStream: futures_core::Stream<Item = Result<super::ActionType, tonic::Status>>
+ Send
+ 'static;
async fn list_actions(
&self,
request: tonic::Request<super::Empty>,
) -> Result<tonic::Response<Self::ListActionsStream>, tonic::Status>;
}
#[derive(Debug)]
pub struct FlightServiceServer<T: FlightService> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: FlightService> FlightServiceServer<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 FlightServiceServer<T>
where
T: FlightService,
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() {
"/arrow.flight.protocol.FlightService/Handshake" => {
#[allow(non_camel_case_types)]
struct HandshakeSvc<T: FlightService>(pub Arc<T>);
impl<T: FlightService> tonic::server::StreamingService<super::HandshakeRequest>
for HandshakeSvc<T>
{
type Response = super::HandshakeResponse;
type ResponseStream = T::HandshakeStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<tonic::Streaming<super::HandshakeRequest>>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).handshake(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 = HandshakeSvc(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.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/arrow.flight.protocol.FlightService/ListFlights" => {
#[allow(non_camel_case_types)]
struct ListFlightsSvc<T: FlightService>(pub Arc<T>);
impl<T: FlightService> tonic::server::ServerStreamingService<super::Criteria>
for ListFlightsSvc<T>
{
type Response = super::FlightInfo;
type ResponseStream = T::ListFlightsStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::Criteria>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).list_flights(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 = ListFlightsSvc(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.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/arrow.flight.protocol.FlightService/GetFlightInfo" => {
#[allow(non_camel_case_types)]
struct GetFlightInfoSvc<T: FlightService>(pub Arc<T>);
impl<T: FlightService> tonic::server::UnaryService<super::FlightDescriptor>
for GetFlightInfoSvc<T>
{
type Response = super::FlightInfo;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::FlightDescriptor>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).get_flight_info(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 = GetFlightInfoSvc(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)
}
"/arrow.flight.protocol.FlightService/GetSchema" => {
#[allow(non_camel_case_types)]
struct GetSchemaSvc<T: FlightService>(pub Arc<T>);
impl<T: FlightService> tonic::server::UnaryService<super::FlightDescriptor> for GetSchemaSvc<T> {
type Response = super::SchemaResult;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::FlightDescriptor>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).get_schema(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 = GetSchemaSvc(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)
}
"/arrow.flight.protocol.FlightService/DoGet" => {
#[allow(non_camel_case_types)]
struct DoGetSvc<T: FlightService>(pub Arc<T>);
impl<T: FlightService> tonic::server::ServerStreamingService<super::Ticket> for DoGetSvc<T> {
type Response = super::FlightData;
type ResponseStream = T::DoGetStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(&mut self, request: tonic::Request<super::Ticket>) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).do_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 = DoGetSvc(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.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/arrow.flight.protocol.FlightService/DoPut" => {
#[allow(non_camel_case_types)]
struct DoPutSvc<T: FlightService>(pub Arc<T>);
impl<T: FlightService> tonic::server::StreamingService<super::FlightData> for DoPutSvc<T> {
type Response = super::PutResult;
type ResponseStream = T::DoPutStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<tonic::Streaming<super::FlightData>>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).do_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 = DoPutSvc(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.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/arrow.flight.protocol.FlightService/DoExchange" => {
#[allow(non_camel_case_types)]
struct DoExchangeSvc<T: FlightService>(pub Arc<T>);
impl<T: FlightService> tonic::server::StreamingService<super::FlightData> for DoExchangeSvc<T> {
type Response = super::FlightData;
type ResponseStream = T::DoExchangeStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<tonic::Streaming<super::FlightData>>,
) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).do_exchange(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 = DoExchangeSvc(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.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/arrow.flight.protocol.FlightService/DoAction" => {
#[allow(non_camel_case_types)]
struct DoActionSvc<T: FlightService>(pub Arc<T>);
impl<T: FlightService> tonic::server::ServerStreamingService<super::Action> for DoActionSvc<T> {
type Response = super::Result;
type ResponseStream = T::DoActionStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(&mut self, request: tonic::Request<super::Action>) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).do_action(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 = DoActionSvc(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.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/arrow.flight.protocol.FlightService/ListActions" => {
#[allow(non_camel_case_types)]
struct ListActionsSvc<T: FlightService>(pub Arc<T>);
impl<T: FlightService> tonic::server::ServerStreamingService<super::Empty> for ListActionsSvc<T> {
type Response = super::ActionType;
type ResponseStream = T::ListActionsStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(&mut self, request: tonic::Request<super::Empty>) -> Self::Future {
let inner = self.0.clone();
let fut = async move { (*inner).list_actions(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 = ListActionsSvc(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.server_streaming(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: FlightService> Clone for FlightServiceServer<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: FlightService> 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: FlightService> tonic::server::NamedService for FlightServiceServer<T> {
const NAME: &'static str = "arrow.flight.protocol.FlightService";
}
}