diff --git a/Cargo.toml b/Cargo.toml index 7a5de1c..de31a8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,9 +12,9 @@ description = "Unofficial flatbuffers and tonic code of Apache Arrow spec" [dependencies] flatbuffers = { version = "=2.0.0", optional = true } -tonic = { version = "0.5.2", optional = true } -prost = { version = "0.8.0", optional = true } -prost-derive = { version = "0.8.0", optional = true } +tonic = { version = "0.6.0", optional = true } +prost = { version = "0.9.0", optional = true } +prost-derive = { version = "0.9.0", optional = true } [features] default = [] diff --git a/src/flight.rs b/src/flight.rs index 29cbfae..31ccaab 100644 --- a/src/flight.rs +++ b/src/flight.rs @@ -100,9 +100,7 @@ pub struct FlightDescriptor { pub mod flight_descriptor { /// /// Describes what type of descriptor is defined. - #[derive( - Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration, - )] + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum DescriptorType { /// Protobuf pattern, not used. @@ -276,10 +274,8 @@ pub mod flight_service_client { pub async fn handshake( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> Result< - tonic::Response>, - tonic::Status, - > { + ) -> Result>, tonic::Status> + { self.inner.ready().await.map_err(|e| { tonic::Status::new( tonic::Code::Unknown, @@ -304,10 +300,8 @@ pub mod flight_service_client { pub async fn list_flights( &mut self, request: impl tonic::IntoRequest, - ) -> Result< - tonic::Response>, - tonic::Status, - > { + ) -> Result>, tonic::Status> + { self.inner.ready().await.map_err(|e| { tonic::Status::new( tonic::Code::Unknown, @@ -378,10 +372,8 @@ pub mod flight_service_client { pub async fn do_get( &mut self, request: impl tonic::IntoRequest, - ) -> Result< - tonic::Response>, - tonic::Status, - > { + ) -> Result>, tonic::Status> + { self.inner.ready().await.map_err(|e| { tonic::Status::new( tonic::Code::Unknown, @@ -389,9 +381,8 @@ pub mod flight_service_client { ) })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/arrow.flight.protocol.FlightService/DoGet", - ); + let path = + http::uri::PathAndQuery::from_static("/arrow.flight.protocol.FlightService/DoGet"); self.inner .server_streaming(request.into_request(), path, codec) .await @@ -406,10 +397,8 @@ pub mod flight_service_client { pub async fn do_put( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> Result< - tonic::Response>, - tonic::Status, - > { + ) -> Result>, tonic::Status> + { self.inner.ready().await.map_err(|e| { tonic::Status::new( tonic::Code::Unknown, @@ -417,9 +406,8 @@ pub mod flight_service_client { ) })?; let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/arrow.flight.protocol.FlightService/DoPut", - ); + let path = + http::uri::PathAndQuery::from_static("/arrow.flight.protocol.FlightService/DoPut"); self.inner .streaming(request.into_streaming_request(), path, codec) .await @@ -433,10 +421,8 @@ pub mod flight_service_client { pub async fn do_exchange( &mut self, request: impl tonic::IntoStreamingRequest, - ) -> Result< - tonic::Response>, - tonic::Status, - > { + ) -> Result>, tonic::Status> + { self.inner.ready().await.map_err(|e| { tonic::Status::new( tonic::Code::Unknown, @@ -484,10 +470,8 @@ pub mod flight_service_client { pub async fn list_actions( &mut self, request: impl tonic::IntoRequest, - ) -> Result< - tonic::Response>, - tonic::Status, - > { + ) -> Result>, tonic::Status> + { self.inner.ready().await.map_err(|e| { tonic::Status::new( tonic::Code::Unknown, @@ -662,10 +646,7 @@ pub mod flight_service_server { send_compression_encodings: Default::default(), } } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService where F: tonic::service::Interceptor, { @@ -690,21 +671,16 @@ pub mod flight_service_server { "/arrow.flight.protocol.FlightService/Handshake" => { #[allow(non_camel_case_types)] struct HandshakeSvc(pub Arc); - impl - tonic::server::StreamingService + impl tonic::server::StreamingService for HandshakeSvc { type Response = super::HandshakeResponse; type ResponseStream = T::HandshakeStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request< - tonic::Streaming, - >, + request: tonic::Request>, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).handshake(request).await }; @@ -718,11 +694,10 @@ pub mod flight_service_server { 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 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) }; @@ -731,16 +706,13 @@ pub mod flight_service_server { "/arrow.flight.protocol.FlightService/ListFlights" => { #[allow(non_camel_case_types)] struct ListFlightsSvc(pub Arc); - impl - tonic::server::ServerStreamingService + impl tonic::server::ServerStreamingService for ListFlightsSvc { type Response = super::FlightInfo; type ResponseStream = T::ListFlightsStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, @@ -757,11 +729,10 @@ pub mod flight_service_server { 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 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) }; @@ -770,20 +741,17 @@ pub mod flight_service_server { "/arrow.flight.protocol.FlightService/GetFlightInfo" => { #[allow(non_camel_case_types)] struct GetFlightInfoSvc(pub Arc); - impl - tonic::server::UnaryService + impl tonic::server::UnaryService for GetFlightInfoSvc { type Response = super::FlightInfo; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); - let fut = - async move { (*inner).get_flight_info(request).await }; + let fut = async move { (*inner).get_flight_info(request).await }; Box::pin(fut) } } @@ -794,11 +762,10 @@ pub mod flight_service_server { 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 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) }; @@ -807,13 +774,9 @@ pub mod flight_service_server { "/arrow.flight.protocol.FlightService/GetSchema" => { #[allow(non_camel_case_types)] struct GetSchemaSvc(pub Arc); - impl - tonic::server::UnaryService - for GetSchemaSvc - { + impl tonic::server::UnaryService for GetSchemaSvc { type Response = super::SchemaResult; - type Future = - BoxFuture, tonic::Status>; + type Future = BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request, @@ -830,11 +793,10 @@ pub mod flight_service_server { 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 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) }; @@ -843,20 +805,12 @@ pub mod flight_service_server { "/arrow.flight.protocol.FlightService/DoGet" => { #[allow(non_camel_case_types)] struct DoGetSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for DoGetSvc - { + impl tonic::server::ServerStreamingService for DoGetSvc { type Response = super::FlightData; type ResponseStream = T::DoGetStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = + BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).do_get(request).await }; Box::pin(fut) @@ -869,11 +823,10 @@ pub mod flight_service_server { 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 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) }; @@ -882,16 +835,11 @@ pub mod flight_service_server { "/arrow.flight.protocol.FlightService/DoPut" => { #[allow(non_camel_case_types)] struct DoPutSvc(pub Arc); - impl - tonic::server::StreamingService - for DoPutSvc - { + impl tonic::server::StreamingService for DoPutSvc { type Response = super::PutResult; type ResponseStream = T::DoPutStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request>, @@ -908,11 +856,10 @@ pub mod flight_service_server { 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 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) }; @@ -921,16 +868,11 @@ pub mod flight_service_server { "/arrow.flight.protocol.FlightService/DoExchange" => { #[allow(non_camel_case_types)] struct DoExchangeSvc(pub Arc); - impl - tonic::server::StreamingService - for DoExchangeSvc - { + impl tonic::server::StreamingService for DoExchangeSvc { type Response = super::FlightData; type ResponseStream = T::DoExchangeStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; + type Future = + BoxFuture, tonic::Status>; fn call( &mut self, request: tonic::Request>, @@ -947,11 +889,10 @@ pub mod flight_service_server { 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 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) }; @@ -960,20 +901,12 @@ pub mod flight_service_server { "/arrow.flight.protocol.FlightService/DoAction" => { #[allow(non_camel_case_types)] struct DoActionSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for DoActionSvc - { + impl tonic::server::ServerStreamingService for DoActionSvc { type Response = super::Result; type ResponseStream = T::DoActionStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = + BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).do_action(request).await }; Box::pin(fut) @@ -986,11 +919,10 @@ pub mod flight_service_server { 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 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) }; @@ -999,20 +931,12 @@ pub mod flight_service_server { "/arrow.flight.protocol.FlightService/ListActions" => { #[allow(non_camel_case_types)] struct ListActionsSvc(pub Arc); - impl - tonic::server::ServerStreamingService - for ListActionsSvc - { + impl tonic::server::ServerStreamingService for ListActionsSvc { type Response = super::ActionType; type ResponseStream = T::ListActionsStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { + type Future = + BoxFuture, tonic::Status>; + fn call(&mut self, request: tonic::Request) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).list_actions(request).await }; Box::pin(fut) @@ -1025,11 +949,10 @@ pub mod flight_service_server { 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 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) }; @@ -1069,4 +992,4 @@ pub mod flight_service_server { impl tonic::transport::NamedService for FlightServiceServer { const NAME: &'static str = "arrow.flight.protocol.FlightService"; } -} \ No newline at end of file +}