arrow_flight/arrow.flight.protocol.rs
1// This file was automatically generated through the build.rs script, and should not be edited.
2
3// This file is @generated by prost-build.
4///
5/// The request that a client provides to a server on handshake.
6#[allow(clippy::all)]
7#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
8pub struct HandshakeRequest {
9 ///
10 /// A defined protocol version
11 #[prost(uint64, tag = "1")]
12 pub protocol_version: u64,
13 ///
14 /// Arbitrary auth/handshake info.
15 #[prost(bytes = "bytes", tag = "2")]
16 pub payload: ::prost::bytes::Bytes,
17}
18#[allow(clippy::all)]
19#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
20pub struct HandshakeResponse {
21 ///
22 /// A defined protocol version
23 #[prost(uint64, tag = "1")]
24 pub protocol_version: u64,
25 ///
26 /// Arbitrary auth/handshake info.
27 #[prost(bytes = "bytes", tag = "2")]
28 pub payload: ::prost::bytes::Bytes,
29}
30///
31/// A message for doing simple auth.
32#[allow(clippy::all)]
33#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
34pub struct BasicAuth {
35 #[prost(string, tag = "2")]
36 pub username: ::prost::alloc::string::String,
37 #[prost(string, tag = "3")]
38 pub password: ::prost::alloc::string::String,
39}
40#[allow(clippy::all)]
41#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
42pub struct Empty {}
43///
44/// Describes an available action, including both the name used for execution
45/// along with a short description of the purpose of the action.
46#[allow(clippy::all)]
47#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
48pub struct ActionType {
49 #[prost(string, tag = "1")]
50 pub r#type: ::prost::alloc::string::String,
51 #[prost(string, tag = "2")]
52 pub description: ::prost::alloc::string::String,
53}
54///
55/// A service specific expression that can be used to return a limited set
56/// of available Arrow Flight streams.
57#[allow(clippy::all)]
58#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
59pub struct Criteria {
60 #[prost(bytes = "bytes", tag = "1")]
61 pub expression: ::prost::bytes::Bytes,
62}
63///
64/// An opaque action specific for the service.
65#[allow(clippy::all)]
66#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
67pub struct Action {
68 #[prost(string, tag = "1")]
69 pub r#type: ::prost::alloc::string::String,
70 #[prost(bytes = "bytes", tag = "2")]
71 pub body: ::prost::bytes::Bytes,
72}
73///
74/// An opaque result returned after executing an action.
75#[allow(clippy::all)]
76#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
77pub struct Result {
78 #[prost(bytes = "bytes", tag = "1")]
79 pub body: ::prost::bytes::Bytes,
80}
81///
82/// Wrap the result of a getSchema call
83#[allow(clippy::all)]
84#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
85pub struct SchemaResult {
86 /// The schema of the dataset in its IPC form:
87 /// 4 bytes - an optional IPC_CONTINUATION_TOKEN prefix
88 /// 4 bytes - the byte length of the payload
89 /// a flatbuffer Message whose header is the Schema
90 #[prost(bytes = "bytes", tag = "1")]
91 pub schema: ::prost::bytes::Bytes,
92}
93///
94/// The name or tag for a Flight. May be used as a way to retrieve or generate
95/// a flight or be used to expose a set of previously defined flights.
96#[allow(clippy::all)]
97#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
98pub struct FlightDescriptor {
99 #[prost(enumeration = "flight_descriptor::DescriptorType", tag = "1")]
100 pub r#type: i32,
101 ///
102 /// Opaque value used to express a command. Should only be defined when
103 /// type = CMD.
104 #[prost(bytes = "bytes", tag = "2")]
105 pub cmd: ::prost::bytes::Bytes,
106 ///
107 /// List of strings identifying a particular dataset. Should only be defined
108 /// when type = PATH.
109 #[prost(string, repeated, tag = "3")]
110 pub path: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
111}
112/// Nested message and enum types in `FlightDescriptor`.
113pub mod flight_descriptor {
114 ///
115 /// Describes what type of descriptor is defined.
116 #[allow(clippy::all)]
117 #[derive(
118 Clone,
119 Copy,
120 Debug,
121 PartialEq,
122 Eq,
123 Hash,
124 PartialOrd,
125 Ord,
126 ::prost::Enumeration
127 )]
128 #[repr(i32)]
129 pub enum DescriptorType {
130 /// Protobuf pattern, not used.
131 Unknown = 0,
132 ///
133 /// A named path that identifies a dataset. A path is composed of a string
134 /// or list of strings describing a particular dataset. This is conceptually
135 /// similar to a path inside a filesystem.
136 Path = 1,
137 ///
138 /// An opaque command to generate a dataset.
139 Cmd = 2,
140 }
141 impl DescriptorType {
142 /// String value of the enum field names used in the ProtoBuf definition.
143 ///
144 /// The values are not transformed in any way and thus are considered stable
145 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
146 pub fn as_str_name(&self) -> &'static str {
147 match self {
148 Self::Unknown => "UNKNOWN",
149 Self::Path => "PATH",
150 Self::Cmd => "CMD",
151 }
152 }
153 /// Creates an enum from field names used in the ProtoBuf definition.
154 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
155 match value {
156 "UNKNOWN" => Some(Self::Unknown),
157 "PATH" => Some(Self::Path),
158 "CMD" => Some(Self::Cmd),
159 _ => None,
160 }
161 }
162 }
163}
164///
165/// The access coordinates for retrieval of a dataset. With a FlightInfo, a
166/// consumer is able to determine how to retrieve a dataset.
167#[allow(clippy::all)]
168#[derive(Clone, PartialEq, ::prost::Message)]
169pub struct FlightInfo {
170 /// The schema of the dataset in its IPC form:
171 /// 4 bytes - an optional IPC_CONTINUATION_TOKEN prefix
172 /// 4 bytes - the byte length of the payload
173 /// a flatbuffer Message whose header is the Schema
174 #[prost(bytes = "bytes", tag = "1")]
175 pub schema: ::prost::bytes::Bytes,
176 ///
177 /// The descriptor associated with this info.
178 #[prost(message, optional, tag = "2")]
179 pub flight_descriptor: ::core::option::Option<FlightDescriptor>,
180 ///
181 /// A list of endpoints associated with the flight. To consume the
182 /// whole flight, all endpoints (and hence all Tickets) must be
183 /// consumed. Endpoints can be consumed in any order.
184 ///
185 /// In other words, an application can use multiple endpoints to
186 /// represent partitioned data.
187 ///
188 /// If the returned data has an ordering, an application can use
189 /// "FlightInfo.ordered = true" or should return all data in a
190 /// single endpoint. Otherwise, there is no ordering defined on
191 /// endpoints or the data within.
192 ///
193 /// A client can read ordered data by reading data from returned
194 /// endpoints, in order, from front to back.
195 ///
196 /// Note that a client may ignore "FlightInfo.ordered = true". If an
197 /// ordering is important for an application, an application must
198 /// choose one of them:
199 ///
200 /// * An application requires that all clients must read data in
201 /// returned endpoints order.
202 /// * An application must return all data in a single endpoint.
203 #[prost(message, repeated, tag = "3")]
204 pub endpoint: ::prost::alloc::vec::Vec<FlightEndpoint>,
205 /// Set these to -1 if unknown.
206 #[prost(int64, tag = "4")]
207 pub total_records: i64,
208 #[prost(int64, tag = "5")]
209 pub total_bytes: i64,
210 ///
211 /// FlightEndpoints are in the same order as the data.
212 #[prost(bool, tag = "6")]
213 pub ordered: bool,
214 ///
215 /// Application-defined metadata.
216 ///
217 /// There is no inherent or required relationship between this
218 /// and the app_metadata fields in the FlightEndpoints or resulting
219 /// FlightData messages. Since this metadata is application-defined,
220 /// a given application could define there to be a relationship,
221 /// but there is none required by the spec.
222 #[prost(bytes = "bytes", tag = "7")]
223 pub app_metadata: ::prost::bytes::Bytes,
224}
225///
226/// The information to process a long-running query.
227#[allow(clippy::all)]
228#[derive(Clone, PartialEq, ::prost::Message)]
229pub struct PollInfo {
230 ///
231 /// The currently available results.
232 ///
233 /// If "flight_descriptor" is not specified, the query is complete
234 /// and "info" specifies all results. Otherwise, "info" contains
235 /// partial query results.
236 ///
237 /// Note that each PollInfo response contains a complete
238 /// FlightInfo (not just the delta between the previous and current
239 /// FlightInfo).
240 ///
241 /// Subsequent PollInfo responses may only append new endpoints to
242 /// info.
243 ///
244 /// Clients can begin fetching results via DoGet(Ticket) with the
245 /// ticket in the info before the query is
246 /// completed. FlightInfo.ordered is also valid.
247 #[prost(message, optional, tag = "1")]
248 pub info: ::core::option::Option<FlightInfo>,
249 ///
250 /// The descriptor the client should use on the next try.
251 /// If unset, the query is complete.
252 #[prost(message, optional, tag = "2")]
253 pub flight_descriptor: ::core::option::Option<FlightDescriptor>,
254 ///
255 /// Query progress. If known, must be in \[0.0, 1.0\] but need not be
256 /// monotonic or nondecreasing. If unknown, do not set.
257 #[prost(double, optional, tag = "3")]
258 pub progress: ::core::option::Option<f64>,
259 ///
260 /// Expiration time for this request. After this passes, the server
261 /// might not accept the retry descriptor anymore (and the query may
262 /// be cancelled). This may be updated on a call to PollFlightInfo.
263 #[prost(message, optional, tag = "4")]
264 pub expiration_time: ::core::option::Option<::prost_types::Timestamp>,
265}
266///
267/// The request of the CancelFlightInfo action.
268///
269/// The request should be stored in Action.body.
270#[allow(clippy::all)]
271#[derive(Clone, PartialEq, ::prost::Message)]
272pub struct CancelFlightInfoRequest {
273 #[prost(message, optional, tag = "1")]
274 pub info: ::core::option::Option<FlightInfo>,
275}
276///
277/// The result of the CancelFlightInfo action.
278///
279/// The result should be stored in Result.body.
280#[allow(clippy::all)]
281#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
282pub struct CancelFlightInfoResult {
283 #[prost(enumeration = "CancelStatus", tag = "1")]
284 pub status: i32,
285}
286///
287/// An opaque identifier that the service can use to retrieve a particular
288/// portion of a stream.
289///
290/// Tickets are meant to be single use. It is an error/application-defined
291/// behavior to reuse a ticket.
292#[allow(clippy::all)]
293#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
294pub struct Ticket {
295 #[prost(bytes = "bytes", tag = "1")]
296 pub ticket: ::prost::bytes::Bytes,
297}
298///
299/// A location to retrieve a particular stream from. This URI should be one of
300/// the following:
301/// - An empty string or the string 'arrow-flight-reuse-connection://?':
302/// indicating that the ticket can be redeemed on the service where the
303/// ticket was generated via a DoGet request.
304/// - A valid grpc URI (grpc://, grpc+tls://, grpc+unix://, etc.):
305/// indicating that the ticket can be redeemed on the service at the given
306/// URI via a DoGet request.
307/// - A valid HTTP URI (<http://,> <https://,> etc.):
308/// indicating that the client should perform a GET request against the
309/// given URI to retrieve the stream. The ticket should be empty
310/// in this case and should be ignored by the client. Cloud object storage
311/// can be utilized by presigned URLs or mediating the auth separately and
312/// returning the full URL (e.g. <https://amzn-s3-demo-bucket.s3.us-west-2.amazonaws.com/...>).
313///
314/// We allow non-Flight URIs for the purpose of allowing Flight services to indicate that
315/// results can be downloaded in formats other than Arrow (such as Parquet) or to allow
316/// direct fetching of results from a URI to reduce excess copying and data movement.
317/// In these cases, the following conventions should be followed by servers and clients:
318///
319/// - Unless otherwise specified by the 'Content-Type' header of the response,
320/// a client should assume the response is using the Arrow IPC Streaming format.
321/// Usage of an IANA media type like 'application/octet-stream' should be assumed to
322/// be using the Arrow IPC Streaming format.
323/// - The server may allow the client to choose a specific response format by
324/// specifying an 'Accept' header in the request, such as 'application/vnd.apache.parquet'
325/// or 'application/vnd.apache.arrow.stream'. If multiple types are requested and
326/// supported by the server, the choice of which to use is server-specific. If
327/// none of the requested content-types are supported, the server may respond with
328/// either 406 (Not Acceptable) or 415 (Unsupported Media Type), or successfully
329/// respond with a different format that it does support along with the correct
330/// 'Content-Type' header.
331///
332/// Note: new schemes may be proposed in the future to allow for more flexibility based
333/// on community requests.
334#[allow(clippy::all)]
335#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
336pub struct Location {
337 #[prost(string, tag = "1")]
338 pub uri: ::prost::alloc::string::String,
339}
340///
341/// A particular stream or split associated with a flight.
342#[allow(clippy::all)]
343#[derive(Clone, PartialEq, ::prost::Message)]
344pub struct FlightEndpoint {
345 ///
346 /// Token used to retrieve this stream.
347 #[prost(message, optional, tag = "1")]
348 pub ticket: ::core::option::Option<Ticket>,
349 ///
350 /// A list of URIs where this ticket can be redeemed via DoGet().
351 ///
352 /// If the list is empty, the expectation is that the ticket can only
353 /// be redeemed on the current service where the ticket was
354 /// generated.
355 ///
356 /// If the list is not empty, the expectation is that the ticket can be
357 /// redeemed at any of the locations, and that the data returned will be
358 /// equivalent. In this case, the ticket may only be redeemed at one of the
359 /// given locations, and not (necessarily) on the current service. If one
360 /// of the given locations is "arrow-flight-reuse-connection://?", the
361 /// client may redeem the ticket on the service where the ticket was
362 /// generated (i.e., the same as above), in addition to the other
363 /// locations. (This URI was chosen to maximize compatibility, as 'scheme:'
364 /// or 'scheme://' are not accepted by Java's java.net.URI.)
365 ///
366 /// In other words, an application can use multiple locations to
367 /// represent redundant and/or load balanced services.
368 #[prost(message, repeated, tag = "2")]
369 pub location: ::prost::alloc::vec::Vec<Location>,
370 ///
371 /// Expiration time of this stream. If present, clients may assume
372 /// they can retry DoGet requests. Otherwise, it is
373 /// application-defined whether DoGet requests may be retried.
374 #[prost(message, optional, tag = "3")]
375 pub expiration_time: ::core::option::Option<::prost_types::Timestamp>,
376 ///
377 /// Application-defined metadata.
378 ///
379 /// There is no inherent or required relationship between this
380 /// and the app_metadata fields in the FlightInfo or resulting
381 /// FlightData messages. Since this metadata is application-defined,
382 /// a given application could define there to be a relationship,
383 /// but there is none required by the spec.
384 #[prost(bytes = "bytes", tag = "4")]
385 pub app_metadata: ::prost::bytes::Bytes,
386}
387///
388/// The request of the RenewFlightEndpoint action.
389///
390/// The request should be stored in Action.body.
391#[allow(clippy::all)]
392#[derive(Clone, PartialEq, ::prost::Message)]
393pub struct RenewFlightEndpointRequest {
394 #[prost(message, optional, tag = "1")]
395 pub endpoint: ::core::option::Option<FlightEndpoint>,
396}
397///
398/// A batch of Arrow data as part of a stream of batches.
399#[allow(clippy::all)]
400#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
401pub struct FlightData {
402 ///
403 /// The descriptor of the data. This is only relevant when a client is
404 /// starting a new DoPut stream.
405 #[prost(message, optional, tag = "1")]
406 pub flight_descriptor: ::core::option::Option<FlightDescriptor>,
407 ///
408 /// Header for message data as described in Message.fbs::Message.
409 #[prost(bytes = "bytes", tag = "2")]
410 pub data_header: ::prost::bytes::Bytes,
411 ///
412 /// Application-defined metadata.
413 #[prost(bytes = "bytes", tag = "3")]
414 pub app_metadata: ::prost::bytes::Bytes,
415 ///
416 /// The actual batch of Arrow data. Preferably handled with minimal-copies
417 /// coming last in the definition to help with sidecar patterns (it is
418 /// expected that some implementations will fetch this field off the wire
419 /// with specialized code to avoid extra memory copies).
420 #[prost(bytes = "bytes", tag = "1000")]
421 pub data_body: ::prost::bytes::Bytes,
422}
423/// *
424/// The response message associated with the submission of a DoPut.
425#[allow(clippy::all)]
426#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
427pub struct PutResult {
428 #[prost(bytes = "bytes", tag = "1")]
429 pub app_metadata: ::prost::bytes::Bytes,
430}
431///
432/// The result of a cancel operation.
433///
434/// This is used by CancelFlightInfoResult.status.
435#[allow(clippy::all)]
436#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
437#[repr(i32)]
438pub enum CancelStatus {
439 /// The cancellation status is unknown. Servers should avoid using
440 /// this value (send a NOT_FOUND error if the requested query is
441 /// not known). Clients can retry the request.
442 Unspecified = 0,
443 /// The cancellation request is complete. Subsequent requests with
444 /// the same payload may return CANCELLED or a NOT_FOUND error.
445 Cancelled = 1,
446 /// The cancellation request is in progress. The client may retry
447 /// the cancellation request.
448 Cancelling = 2,
449 /// The query is not cancellable. The client should not retry the
450 /// cancellation request.
451 NotCancellable = 3,
452}
453impl CancelStatus {
454 /// String value of the enum field names used in the ProtoBuf definition.
455 ///
456 /// The values are not transformed in any way and thus are considered stable
457 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
458 pub fn as_str_name(&self) -> &'static str {
459 match self {
460 Self::Unspecified => "CANCEL_STATUS_UNSPECIFIED",
461 Self::Cancelled => "CANCEL_STATUS_CANCELLED",
462 Self::Cancelling => "CANCEL_STATUS_CANCELLING",
463 Self::NotCancellable => "CANCEL_STATUS_NOT_CANCELLABLE",
464 }
465 }
466 /// Creates an enum from field names used in the ProtoBuf definition.
467 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
468 match value {
469 "CANCEL_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
470 "CANCEL_STATUS_CANCELLED" => Some(Self::Cancelled),
471 "CANCEL_STATUS_CANCELLING" => Some(Self::Cancelling),
472 "CANCEL_STATUS_NOT_CANCELLABLE" => Some(Self::NotCancellable),
473 _ => None,
474 }
475 }
476}
477/// Generated client implementations.
478pub mod flight_service_client {
479 #![allow(
480 unused_variables,
481 dead_code,
482 missing_docs,
483 clippy::wildcard_imports,
484 clippy::let_unit_value,
485 )]
486 use tonic::codegen::*;
487 use tonic::codegen::http::Uri;
488 ///
489 /// A flight service is an endpoint for retrieving or storing Arrow data. A
490 /// flight service can expose one or more predefined endpoints that can be
491 /// accessed using the Arrow Flight Protocol. Additionally, a flight service
492 /// can expose a set of actions that are available.
493 #[derive(Debug, Clone)]
494 pub struct FlightServiceClient<T> {
495 inner: tonic::client::Grpc<T>,
496 }
497 impl<T> FlightServiceClient<T>
498 where
499 T: tonic::client::GrpcService<tonic::body::Body>,
500 T::Error: Into<StdError>,
501 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
502 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
503 {
504 pub fn new(inner: T) -> Self {
505 let inner = tonic::client::Grpc::new(inner);
506 Self { inner }
507 }
508 pub fn with_origin(inner: T, origin: Uri) -> Self {
509 let inner = tonic::client::Grpc::with_origin(inner, origin);
510 Self { inner }
511 }
512 pub fn with_interceptor<F>(
513 inner: T,
514 interceptor: F,
515 ) -> FlightServiceClient<InterceptedService<T, F>>
516 where
517 F: tonic::service::Interceptor,
518 T::ResponseBody: Default,
519 T: tonic::codegen::Service<
520 http::Request<tonic::body::Body>,
521 Response = http::Response<
522 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
523 >,
524 >,
525 <T as tonic::codegen::Service<
526 http::Request<tonic::body::Body>,
527 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
528 {
529 FlightServiceClient::new(InterceptedService::new(inner, interceptor))
530 }
531 /// Compress requests with the given encoding.
532 ///
533 /// This requires the server to support it otherwise it might respond with an
534 /// error.
535 #[must_use]
536 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
537 self.inner = self.inner.send_compressed(encoding);
538 self
539 }
540 /// Enable decompressing responses.
541 #[must_use]
542 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
543 self.inner = self.inner.accept_compressed(encoding);
544 self
545 }
546 /// Limits the maximum size of a decoded message.
547 ///
548 /// Default: `4MB`
549 #[must_use]
550 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
551 self.inner = self.inner.max_decoding_message_size(limit);
552 self
553 }
554 /// Limits the maximum size of an encoded message.
555 ///
556 /// Default: `usize::MAX`
557 #[must_use]
558 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
559 self.inner = self.inner.max_encoding_message_size(limit);
560 self
561 }
562 ///
563 /// Handshake between client and server. Depending on the server, the
564 /// handshake may be required to determine the token that should be used for
565 /// future operations. Both request and response are streams to allow multiple
566 /// round-trips depending on auth mechanism.
567 pub async fn handshake(
568 &mut self,
569 request: impl tonic::IntoStreamingRequest<Message = super::HandshakeRequest>,
570 ) -> std::result::Result<
571 tonic::Response<tonic::codec::Streaming<super::HandshakeResponse>>,
572 tonic::Status,
573 > {
574 self.inner
575 .ready()
576 .await
577 .map_err(|e| {
578 tonic::Status::unknown(
579 format!("Service was not ready: {}", e.into()),
580 )
581 })?;
582 let codec = tonic_prost::ProstCodec::default();
583 let path = http::uri::PathAndQuery::from_static(
584 "/arrow.flight.protocol.FlightService/Handshake",
585 );
586 let mut req = request.into_streaming_request();
587 req.extensions_mut()
588 .insert(
589 GrpcMethod::new("arrow.flight.protocol.FlightService", "Handshake"),
590 );
591 self.inner.streaming(req, path, codec).await
592 }
593 ///
594 /// Get a list of available streams given a particular criteria. Most flight
595 /// services will expose one or more streams that are readily available for
596 /// retrieval. This api allows listing the streams available for
597 /// consumption. A user can also provide a criteria. The criteria can limit
598 /// the subset of streams that can be listed via this interface. Each flight
599 /// service allows its own definition of how to consume criteria.
600 pub async fn list_flights(
601 &mut self,
602 request: impl tonic::IntoRequest<super::Criteria>,
603 ) -> std::result::Result<
604 tonic::Response<tonic::codec::Streaming<super::FlightInfo>>,
605 tonic::Status,
606 > {
607 self.inner
608 .ready()
609 .await
610 .map_err(|e| {
611 tonic::Status::unknown(
612 format!("Service was not ready: {}", e.into()),
613 )
614 })?;
615 let codec = tonic_prost::ProstCodec::default();
616 let path = http::uri::PathAndQuery::from_static(
617 "/arrow.flight.protocol.FlightService/ListFlights",
618 );
619 let mut req = request.into_request();
620 req.extensions_mut()
621 .insert(
622 GrpcMethod::new("arrow.flight.protocol.FlightService", "ListFlights"),
623 );
624 self.inner.server_streaming(req, path, codec).await
625 }
626 ///
627 /// For a given FlightDescriptor, get information about how the flight can be
628 /// consumed. This is a useful interface if the consumer of the interface
629 /// already can identify the specific flight to consume. This interface can
630 /// also allow a consumer to generate a flight stream through a specified
631 /// descriptor. For example, a flight descriptor might be something that
632 /// includes a SQL statement or a Pickled Python operation that will be
633 /// executed. In those cases, the descriptor will not be previously available
634 /// within the list of available streams provided by ListFlights but will be
635 /// available for consumption for the duration defined by the specific flight
636 /// service.
637 pub async fn get_flight_info(
638 &mut self,
639 request: impl tonic::IntoRequest<super::FlightDescriptor>,
640 ) -> std::result::Result<tonic::Response<super::FlightInfo>, tonic::Status> {
641 self.inner
642 .ready()
643 .await
644 .map_err(|e| {
645 tonic::Status::unknown(
646 format!("Service was not ready: {}", e.into()),
647 )
648 })?;
649 let codec = tonic_prost::ProstCodec::default();
650 let path = http::uri::PathAndQuery::from_static(
651 "/arrow.flight.protocol.FlightService/GetFlightInfo",
652 );
653 let mut req = request.into_request();
654 req.extensions_mut()
655 .insert(
656 GrpcMethod::new(
657 "arrow.flight.protocol.FlightService",
658 "GetFlightInfo",
659 ),
660 );
661 self.inner.unary(req, path, codec).await
662 }
663 ///
664 /// For a given FlightDescriptor, start a query and get information
665 /// to poll its execution status. This is a useful interface if the
666 /// query may be a long-running query. The first PollFlightInfo call
667 /// should return as quickly as possible. (GetFlightInfo doesn't
668 /// return until the query is complete.)
669 ///
670 /// A client can consume any available results before
671 /// the query is completed. See PollInfo.info for details.
672 ///
673 /// A client can poll the updated query status by calling
674 /// PollFlightInfo() with PollInfo.flight_descriptor. A server
675 /// should not respond until the result would be different from last
676 /// time. That way, the client can "long poll" for updates
677 /// without constantly making requests. Clients can set a short timeout
678 /// to avoid blocking calls if desired.
679 ///
680 /// A client can't use PollInfo.flight_descriptor after
681 /// PollInfo.expiration_time passes. A server might not accept the
682 /// retry descriptor anymore and the query may be cancelled.
683 ///
684 /// A client may use the CancelFlightInfo action with
685 /// PollInfo.info to cancel the running query.
686 pub async fn poll_flight_info(
687 &mut self,
688 request: impl tonic::IntoRequest<super::FlightDescriptor>,
689 ) -> std::result::Result<tonic::Response<super::PollInfo>, tonic::Status> {
690 self.inner
691 .ready()
692 .await
693 .map_err(|e| {
694 tonic::Status::unknown(
695 format!("Service was not ready: {}", e.into()),
696 )
697 })?;
698 let codec = tonic_prost::ProstCodec::default();
699 let path = http::uri::PathAndQuery::from_static(
700 "/arrow.flight.protocol.FlightService/PollFlightInfo",
701 );
702 let mut req = request.into_request();
703 req.extensions_mut()
704 .insert(
705 GrpcMethod::new(
706 "arrow.flight.protocol.FlightService",
707 "PollFlightInfo",
708 ),
709 );
710 self.inner.unary(req, path, codec).await
711 }
712 ///
713 /// For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
714 /// This is used when a consumer needs the Schema of flight stream. Similar to
715 /// GetFlightInfo this interface may generate a new flight that was not previously
716 /// available in ListFlights.
717 pub async fn get_schema(
718 &mut self,
719 request: impl tonic::IntoRequest<super::FlightDescriptor>,
720 ) -> std::result::Result<tonic::Response<super::SchemaResult>, tonic::Status> {
721 self.inner
722 .ready()
723 .await
724 .map_err(|e| {
725 tonic::Status::unknown(
726 format!("Service was not ready: {}", e.into()),
727 )
728 })?;
729 let codec = tonic_prost::ProstCodec::default();
730 let path = http::uri::PathAndQuery::from_static(
731 "/arrow.flight.protocol.FlightService/GetSchema",
732 );
733 let mut req = request.into_request();
734 req.extensions_mut()
735 .insert(
736 GrpcMethod::new("arrow.flight.protocol.FlightService", "GetSchema"),
737 );
738 self.inner.unary(req, path, codec).await
739 }
740 ///
741 /// Retrieve a single stream associated with a particular descriptor
742 /// associated with the referenced ticket. A Flight can be composed of one or
743 /// more streams where each stream can be retrieved using a separate opaque
744 /// ticket that the flight service uses for managing a collection of streams.
745 pub async fn do_get(
746 &mut self,
747 request: impl tonic::IntoRequest<super::Ticket>,
748 ) -> std::result::Result<
749 tonic::Response<tonic::codec::Streaming<super::FlightData>>,
750 tonic::Status,
751 > {
752 self.inner
753 .ready()
754 .await
755 .map_err(|e| {
756 tonic::Status::unknown(
757 format!("Service was not ready: {}", e.into()),
758 )
759 })?;
760 let codec = tonic_prost::ProstCodec::default();
761 let path = http::uri::PathAndQuery::from_static(
762 "/arrow.flight.protocol.FlightService/DoGet",
763 );
764 let mut req = request.into_request();
765 req.extensions_mut()
766 .insert(GrpcMethod::new("arrow.flight.protocol.FlightService", "DoGet"));
767 self.inner.server_streaming(req, path, codec).await
768 }
769 ///
770 /// Push a stream to the flight service associated with a particular
771 /// flight stream. This allows a client of a flight service to upload a stream
772 /// of data. Depending on the particular flight service, a client consumer
773 /// could be allowed to upload a single stream per descriptor or an unlimited
774 /// number. In the latter, the service might implement a 'seal' action that
775 /// can be applied to a descriptor once all streams are uploaded.
776 pub async fn do_put(
777 &mut self,
778 request: impl tonic::IntoStreamingRequest<Message = super::FlightData>,
779 ) -> std::result::Result<
780 tonic::Response<tonic::codec::Streaming<super::PutResult>>,
781 tonic::Status,
782 > {
783 self.inner
784 .ready()
785 .await
786 .map_err(|e| {
787 tonic::Status::unknown(
788 format!("Service was not ready: {}", e.into()),
789 )
790 })?;
791 let codec = tonic_prost::ProstCodec::default();
792 let path = http::uri::PathAndQuery::from_static(
793 "/arrow.flight.protocol.FlightService/DoPut",
794 );
795 let mut req = request.into_streaming_request();
796 req.extensions_mut()
797 .insert(GrpcMethod::new("arrow.flight.protocol.FlightService", "DoPut"));
798 self.inner.streaming(req, path, codec).await
799 }
800 ///
801 /// Open a bidirectional data channel for a given descriptor. This
802 /// allows clients to send and receive arbitrary Arrow data and
803 /// application-specific metadata in a single logical stream. In
804 /// contrast to DoGet/DoPut, this is more suited for clients
805 /// offloading computation (rather than storage) to a Flight service.
806 pub async fn do_exchange(
807 &mut self,
808 request: impl tonic::IntoStreamingRequest<Message = super::FlightData>,
809 ) -> std::result::Result<
810 tonic::Response<tonic::codec::Streaming<super::FlightData>>,
811 tonic::Status,
812 > {
813 self.inner
814 .ready()
815 .await
816 .map_err(|e| {
817 tonic::Status::unknown(
818 format!("Service was not ready: {}", e.into()),
819 )
820 })?;
821 let codec = tonic_prost::ProstCodec::default();
822 let path = http::uri::PathAndQuery::from_static(
823 "/arrow.flight.protocol.FlightService/DoExchange",
824 );
825 let mut req = request.into_streaming_request();
826 req.extensions_mut()
827 .insert(
828 GrpcMethod::new("arrow.flight.protocol.FlightService", "DoExchange"),
829 );
830 self.inner.streaming(req, path, codec).await
831 }
832 ///
833 /// Flight services can support an arbitrary number of simple actions in
834 /// addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
835 /// operations that are potentially available. DoAction allows a flight client
836 /// to do a specific action against a flight service. An action includes
837 /// opaque request and response objects that are specific to the type action
838 /// being undertaken.
839 pub async fn do_action(
840 &mut self,
841 request: impl tonic::IntoRequest<super::Action>,
842 ) -> std::result::Result<
843 tonic::Response<tonic::codec::Streaming<super::Result>>,
844 tonic::Status,
845 > {
846 self.inner
847 .ready()
848 .await
849 .map_err(|e| {
850 tonic::Status::unknown(
851 format!("Service was not ready: {}", e.into()),
852 )
853 })?;
854 let codec = tonic_prost::ProstCodec::default();
855 let path = http::uri::PathAndQuery::from_static(
856 "/arrow.flight.protocol.FlightService/DoAction",
857 );
858 let mut req = request.into_request();
859 req.extensions_mut()
860 .insert(
861 GrpcMethod::new("arrow.flight.protocol.FlightService", "DoAction"),
862 );
863 self.inner.server_streaming(req, path, codec).await
864 }
865 ///
866 /// A flight service exposes all of the available action types that it has
867 /// along with descriptions. This allows different flight consumers to
868 /// understand the capabilities of the flight service.
869 pub async fn list_actions(
870 &mut self,
871 request: impl tonic::IntoRequest<super::Empty>,
872 ) -> std::result::Result<
873 tonic::Response<tonic::codec::Streaming<super::ActionType>>,
874 tonic::Status,
875 > {
876 self.inner
877 .ready()
878 .await
879 .map_err(|e| {
880 tonic::Status::unknown(
881 format!("Service was not ready: {}", e.into()),
882 )
883 })?;
884 let codec = tonic_prost::ProstCodec::default();
885 let path = http::uri::PathAndQuery::from_static(
886 "/arrow.flight.protocol.FlightService/ListActions",
887 );
888 let mut req = request.into_request();
889 req.extensions_mut()
890 .insert(
891 GrpcMethod::new("arrow.flight.protocol.FlightService", "ListActions"),
892 );
893 self.inner.server_streaming(req, path, codec).await
894 }
895 }
896}
897/// Generated server implementations.
898pub mod flight_service_server {
899 #![allow(
900 unused_variables,
901 dead_code,
902 missing_docs,
903 clippy::wildcard_imports,
904 clippy::let_unit_value,
905 )]
906 use tonic::codegen::*;
907 /// Generated trait containing gRPC methods that should be implemented for use with FlightServiceServer.
908 #[async_trait]
909 pub trait FlightService: std::marker::Send + std::marker::Sync + 'static {
910 /// Server streaming response type for the Handshake method.
911 type HandshakeStream: tonic::codegen::tokio_stream::Stream<
912 Item = std::result::Result<super::HandshakeResponse, tonic::Status>,
913 >
914 + std::marker::Send
915 + 'static;
916 ///
917 /// Handshake between client and server. Depending on the server, the
918 /// handshake may be required to determine the token that should be used for
919 /// future operations. Both request and response are streams to allow multiple
920 /// round-trips depending on auth mechanism.
921 async fn handshake(
922 &self,
923 request: tonic::Request<tonic::Streaming<super::HandshakeRequest>>,
924 ) -> std::result::Result<tonic::Response<Self::HandshakeStream>, tonic::Status>;
925 /// Server streaming response type for the ListFlights method.
926 type ListFlightsStream: tonic::codegen::tokio_stream::Stream<
927 Item = std::result::Result<super::FlightInfo, tonic::Status>,
928 >
929 + std::marker::Send
930 + 'static;
931 ///
932 /// Get a list of available streams given a particular criteria. Most flight
933 /// services will expose one or more streams that are readily available for
934 /// retrieval. This api allows listing the streams available for
935 /// consumption. A user can also provide a criteria. The criteria can limit
936 /// the subset of streams that can be listed via this interface. Each flight
937 /// service allows its own definition of how to consume criteria.
938 async fn list_flights(
939 &self,
940 request: tonic::Request<super::Criteria>,
941 ) -> std::result::Result<
942 tonic::Response<Self::ListFlightsStream>,
943 tonic::Status,
944 >;
945 ///
946 /// For a given FlightDescriptor, get information about how the flight can be
947 /// consumed. This is a useful interface if the consumer of the interface
948 /// already can identify the specific flight to consume. This interface can
949 /// also allow a consumer to generate a flight stream through a specified
950 /// descriptor. For example, a flight descriptor might be something that
951 /// includes a SQL statement or a Pickled Python operation that will be
952 /// executed. In those cases, the descriptor will not be previously available
953 /// within the list of available streams provided by ListFlights but will be
954 /// available for consumption for the duration defined by the specific flight
955 /// service.
956 async fn get_flight_info(
957 &self,
958 request: tonic::Request<super::FlightDescriptor>,
959 ) -> std::result::Result<tonic::Response<super::FlightInfo>, tonic::Status>;
960 ///
961 /// For a given FlightDescriptor, start a query and get information
962 /// to poll its execution status. This is a useful interface if the
963 /// query may be a long-running query. The first PollFlightInfo call
964 /// should return as quickly as possible. (GetFlightInfo doesn't
965 /// return until the query is complete.)
966 ///
967 /// A client can consume any available results before
968 /// the query is completed. See PollInfo.info for details.
969 ///
970 /// A client can poll the updated query status by calling
971 /// PollFlightInfo() with PollInfo.flight_descriptor. A server
972 /// should not respond until the result would be different from last
973 /// time. That way, the client can "long poll" for updates
974 /// without constantly making requests. Clients can set a short timeout
975 /// to avoid blocking calls if desired.
976 ///
977 /// A client can't use PollInfo.flight_descriptor after
978 /// PollInfo.expiration_time passes. A server might not accept the
979 /// retry descriptor anymore and the query may be cancelled.
980 ///
981 /// A client may use the CancelFlightInfo action with
982 /// PollInfo.info to cancel the running query.
983 async fn poll_flight_info(
984 &self,
985 request: tonic::Request<super::FlightDescriptor>,
986 ) -> std::result::Result<tonic::Response<super::PollInfo>, tonic::Status>;
987 ///
988 /// For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
989 /// This is used when a consumer needs the Schema of flight stream. Similar to
990 /// GetFlightInfo this interface may generate a new flight that was not previously
991 /// available in ListFlights.
992 async fn get_schema(
993 &self,
994 request: tonic::Request<super::FlightDescriptor>,
995 ) -> std::result::Result<tonic::Response<super::SchemaResult>, tonic::Status>;
996 /// Server streaming response type for the DoGet method.
997 type DoGetStream: tonic::codegen::tokio_stream::Stream<
998 Item = std::result::Result<super::FlightData, tonic::Status>,
999 >
1000 + std::marker::Send
1001 + 'static;
1002 ///
1003 /// Retrieve a single stream associated with a particular descriptor
1004 /// associated with the referenced ticket. A Flight can be composed of one or
1005 /// more streams where each stream can be retrieved using a separate opaque
1006 /// ticket that the flight service uses for managing a collection of streams.
1007 async fn do_get(
1008 &self,
1009 request: tonic::Request<super::Ticket>,
1010 ) -> std::result::Result<tonic::Response<Self::DoGetStream>, tonic::Status>;
1011 /// Server streaming response type for the DoPut method.
1012 type DoPutStream: tonic::codegen::tokio_stream::Stream<
1013 Item = std::result::Result<super::PutResult, tonic::Status>,
1014 >
1015 + std::marker::Send
1016 + 'static;
1017 ///
1018 /// Push a stream to the flight service associated with a particular
1019 /// flight stream. This allows a client of a flight service to upload a stream
1020 /// of data. Depending on the particular flight service, a client consumer
1021 /// could be allowed to upload a single stream per descriptor or an unlimited
1022 /// number. In the latter, the service might implement a 'seal' action that
1023 /// can be applied to a descriptor once all streams are uploaded.
1024 async fn do_put(
1025 &self,
1026 request: tonic::Request<tonic::Streaming<super::FlightData>>,
1027 ) -> std::result::Result<tonic::Response<Self::DoPutStream>, tonic::Status>;
1028 /// Server streaming response type for the DoExchange method.
1029 type DoExchangeStream: tonic::codegen::tokio_stream::Stream<
1030 Item = std::result::Result<super::FlightData, tonic::Status>,
1031 >
1032 + std::marker::Send
1033 + 'static;
1034 ///
1035 /// Open a bidirectional data channel for a given descriptor. This
1036 /// allows clients to send and receive arbitrary Arrow data and
1037 /// application-specific metadata in a single logical stream. In
1038 /// contrast to DoGet/DoPut, this is more suited for clients
1039 /// offloading computation (rather than storage) to a Flight service.
1040 async fn do_exchange(
1041 &self,
1042 request: tonic::Request<tonic::Streaming<super::FlightData>>,
1043 ) -> std::result::Result<tonic::Response<Self::DoExchangeStream>, tonic::Status>;
1044 /// Server streaming response type for the DoAction method.
1045 type DoActionStream: tonic::codegen::tokio_stream::Stream<
1046 Item = std::result::Result<super::Result, tonic::Status>,
1047 >
1048 + std::marker::Send
1049 + 'static;
1050 ///
1051 /// Flight services can support an arbitrary number of simple actions in
1052 /// addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
1053 /// operations that are potentially available. DoAction allows a flight client
1054 /// to do a specific action against a flight service. An action includes
1055 /// opaque request and response objects that are specific to the type action
1056 /// being undertaken.
1057 async fn do_action(
1058 &self,
1059 request: tonic::Request<super::Action>,
1060 ) -> std::result::Result<tonic::Response<Self::DoActionStream>, tonic::Status>;
1061 /// Server streaming response type for the ListActions method.
1062 type ListActionsStream: tonic::codegen::tokio_stream::Stream<
1063 Item = std::result::Result<super::ActionType, tonic::Status>,
1064 >
1065 + std::marker::Send
1066 + 'static;
1067 ///
1068 /// A flight service exposes all of the available action types that it has
1069 /// along with descriptions. This allows different flight consumers to
1070 /// understand the capabilities of the flight service.
1071 async fn list_actions(
1072 &self,
1073 request: tonic::Request<super::Empty>,
1074 ) -> std::result::Result<
1075 tonic::Response<Self::ListActionsStream>,
1076 tonic::Status,
1077 >;
1078 }
1079 ///
1080 /// A flight service is an endpoint for retrieving or storing Arrow data. A
1081 /// flight service can expose one or more predefined endpoints that can be
1082 /// accessed using the Arrow Flight Protocol. Additionally, a flight service
1083 /// can expose a set of actions that are available.
1084 #[derive(Debug)]
1085 pub struct FlightServiceServer<T> {
1086 inner: Arc<T>,
1087 accept_compression_encodings: EnabledCompressionEncodings,
1088 send_compression_encodings: EnabledCompressionEncodings,
1089 max_decoding_message_size: Option<usize>,
1090 max_encoding_message_size: Option<usize>,
1091 }
1092 impl<T> FlightServiceServer<T> {
1093 pub fn new(inner: T) -> Self {
1094 Self::from_arc(Arc::new(inner))
1095 }
1096 pub fn from_arc(inner: Arc<T>) -> Self {
1097 Self {
1098 inner,
1099 accept_compression_encodings: Default::default(),
1100 send_compression_encodings: Default::default(),
1101 max_decoding_message_size: None,
1102 max_encoding_message_size: None,
1103 }
1104 }
1105 pub fn with_interceptor<F>(
1106 inner: T,
1107 interceptor: F,
1108 ) -> InterceptedService<Self, F>
1109 where
1110 F: tonic::service::Interceptor,
1111 {
1112 InterceptedService::new(Self::new(inner), interceptor)
1113 }
1114 /// Enable decompressing requests with the given encoding.
1115 #[must_use]
1116 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1117 self.accept_compression_encodings.enable(encoding);
1118 self
1119 }
1120 /// Compress responses with the given encoding, if the client supports it.
1121 #[must_use]
1122 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1123 self.send_compression_encodings.enable(encoding);
1124 self
1125 }
1126 /// Limits the maximum size of a decoded message.
1127 ///
1128 /// Default: `4MB`
1129 #[must_use]
1130 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1131 self.max_decoding_message_size = Some(limit);
1132 self
1133 }
1134 /// Limits the maximum size of an encoded message.
1135 ///
1136 /// Default: `usize::MAX`
1137 #[must_use]
1138 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1139 self.max_encoding_message_size = Some(limit);
1140 self
1141 }
1142 }
1143 impl<T, B> tonic::codegen::Service<http::Request<B>> for FlightServiceServer<T>
1144 where
1145 T: FlightService,
1146 B: Body + std::marker::Send + 'static,
1147 B::Error: Into<StdError> + std::marker::Send + 'static,
1148 {
1149 type Response = http::Response<tonic::body::Body>;
1150 type Error = std::convert::Infallible;
1151 type Future = BoxFuture<Self::Response, Self::Error>;
1152 fn poll_ready(
1153 &mut self,
1154 _cx: &mut Context<'_>,
1155 ) -> Poll<std::result::Result<(), Self::Error>> {
1156 Poll::Ready(Ok(()))
1157 }
1158 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1159 match req.uri().path() {
1160 "/arrow.flight.protocol.FlightService/Handshake" => {
1161 #[allow(non_camel_case_types)]
1162 struct HandshakeSvc<T: FlightService>(pub Arc<T>);
1163 impl<
1164 T: FlightService,
1165 > tonic::server::StreamingService<super::HandshakeRequest>
1166 for HandshakeSvc<T> {
1167 type Response = super::HandshakeResponse;
1168 type ResponseStream = T::HandshakeStream;
1169 type Future = BoxFuture<
1170 tonic::Response<Self::ResponseStream>,
1171 tonic::Status,
1172 >;
1173 fn call(
1174 &mut self,
1175 request: tonic::Request<
1176 tonic::Streaming<super::HandshakeRequest>,
1177 >,
1178 ) -> Self::Future {
1179 let inner = Arc::clone(&self.0);
1180 let fut = async move {
1181 <T as FlightService>::handshake(&inner, request).await
1182 };
1183 Box::pin(fut)
1184 }
1185 }
1186 let accept_compression_encodings = self.accept_compression_encodings;
1187 let send_compression_encodings = self.send_compression_encodings;
1188 let max_decoding_message_size = self.max_decoding_message_size;
1189 let max_encoding_message_size = self.max_encoding_message_size;
1190 let inner = self.inner.clone();
1191 let fut = async move {
1192 let method = HandshakeSvc(inner);
1193 let codec = tonic_prost::ProstCodec::default();
1194 let mut grpc = tonic::server::Grpc::new(codec)
1195 .apply_compression_config(
1196 accept_compression_encodings,
1197 send_compression_encodings,
1198 )
1199 .apply_max_message_size_config(
1200 max_decoding_message_size,
1201 max_encoding_message_size,
1202 );
1203 let res = grpc.streaming(method, req).await;
1204 Ok(res)
1205 };
1206 Box::pin(fut)
1207 }
1208 "/arrow.flight.protocol.FlightService/ListFlights" => {
1209 #[allow(non_camel_case_types)]
1210 struct ListFlightsSvc<T: FlightService>(pub Arc<T>);
1211 impl<
1212 T: FlightService,
1213 > tonic::server::ServerStreamingService<super::Criteria>
1214 for ListFlightsSvc<T> {
1215 type Response = super::FlightInfo;
1216 type ResponseStream = T::ListFlightsStream;
1217 type Future = BoxFuture<
1218 tonic::Response<Self::ResponseStream>,
1219 tonic::Status,
1220 >;
1221 fn call(
1222 &mut self,
1223 request: tonic::Request<super::Criteria>,
1224 ) -> Self::Future {
1225 let inner = Arc::clone(&self.0);
1226 let fut = async move {
1227 <T as FlightService>::list_flights(&inner, request).await
1228 };
1229 Box::pin(fut)
1230 }
1231 }
1232 let accept_compression_encodings = self.accept_compression_encodings;
1233 let send_compression_encodings = self.send_compression_encodings;
1234 let max_decoding_message_size = self.max_decoding_message_size;
1235 let max_encoding_message_size = self.max_encoding_message_size;
1236 let inner = self.inner.clone();
1237 let fut = async move {
1238 let method = ListFlightsSvc(inner);
1239 let codec = tonic_prost::ProstCodec::default();
1240 let mut grpc = tonic::server::Grpc::new(codec)
1241 .apply_compression_config(
1242 accept_compression_encodings,
1243 send_compression_encodings,
1244 )
1245 .apply_max_message_size_config(
1246 max_decoding_message_size,
1247 max_encoding_message_size,
1248 );
1249 let res = grpc.server_streaming(method, req).await;
1250 Ok(res)
1251 };
1252 Box::pin(fut)
1253 }
1254 "/arrow.flight.protocol.FlightService/GetFlightInfo" => {
1255 #[allow(non_camel_case_types)]
1256 struct GetFlightInfoSvc<T: FlightService>(pub Arc<T>);
1257 impl<
1258 T: FlightService,
1259 > tonic::server::UnaryService<super::FlightDescriptor>
1260 for GetFlightInfoSvc<T> {
1261 type Response = super::FlightInfo;
1262 type Future = BoxFuture<
1263 tonic::Response<Self::Response>,
1264 tonic::Status,
1265 >;
1266 fn call(
1267 &mut self,
1268 request: tonic::Request<super::FlightDescriptor>,
1269 ) -> Self::Future {
1270 let inner = Arc::clone(&self.0);
1271 let fut = async move {
1272 <T as FlightService>::get_flight_info(&inner, request).await
1273 };
1274 Box::pin(fut)
1275 }
1276 }
1277 let accept_compression_encodings = self.accept_compression_encodings;
1278 let send_compression_encodings = self.send_compression_encodings;
1279 let max_decoding_message_size = self.max_decoding_message_size;
1280 let max_encoding_message_size = self.max_encoding_message_size;
1281 let inner = self.inner.clone();
1282 let fut = async move {
1283 let method = GetFlightInfoSvc(inner);
1284 let codec = tonic_prost::ProstCodec::default();
1285 let mut grpc = tonic::server::Grpc::new(codec)
1286 .apply_compression_config(
1287 accept_compression_encodings,
1288 send_compression_encodings,
1289 )
1290 .apply_max_message_size_config(
1291 max_decoding_message_size,
1292 max_encoding_message_size,
1293 );
1294 let res = grpc.unary(method, req).await;
1295 Ok(res)
1296 };
1297 Box::pin(fut)
1298 }
1299 "/arrow.flight.protocol.FlightService/PollFlightInfo" => {
1300 #[allow(non_camel_case_types)]
1301 struct PollFlightInfoSvc<T: FlightService>(pub Arc<T>);
1302 impl<
1303 T: FlightService,
1304 > tonic::server::UnaryService<super::FlightDescriptor>
1305 for PollFlightInfoSvc<T> {
1306 type Response = super::PollInfo;
1307 type Future = BoxFuture<
1308 tonic::Response<Self::Response>,
1309 tonic::Status,
1310 >;
1311 fn call(
1312 &mut self,
1313 request: tonic::Request<super::FlightDescriptor>,
1314 ) -> Self::Future {
1315 let inner = Arc::clone(&self.0);
1316 let fut = async move {
1317 <T as FlightService>::poll_flight_info(&inner, request)
1318 .await
1319 };
1320 Box::pin(fut)
1321 }
1322 }
1323 let accept_compression_encodings = self.accept_compression_encodings;
1324 let send_compression_encodings = self.send_compression_encodings;
1325 let max_decoding_message_size = self.max_decoding_message_size;
1326 let max_encoding_message_size = self.max_encoding_message_size;
1327 let inner = self.inner.clone();
1328 let fut = async move {
1329 let method = PollFlightInfoSvc(inner);
1330 let codec = tonic_prost::ProstCodec::default();
1331 let mut grpc = tonic::server::Grpc::new(codec)
1332 .apply_compression_config(
1333 accept_compression_encodings,
1334 send_compression_encodings,
1335 )
1336 .apply_max_message_size_config(
1337 max_decoding_message_size,
1338 max_encoding_message_size,
1339 );
1340 let res = grpc.unary(method, req).await;
1341 Ok(res)
1342 };
1343 Box::pin(fut)
1344 }
1345 "/arrow.flight.protocol.FlightService/GetSchema" => {
1346 #[allow(non_camel_case_types)]
1347 struct GetSchemaSvc<T: FlightService>(pub Arc<T>);
1348 impl<
1349 T: FlightService,
1350 > tonic::server::UnaryService<super::FlightDescriptor>
1351 for GetSchemaSvc<T> {
1352 type Response = super::SchemaResult;
1353 type Future = BoxFuture<
1354 tonic::Response<Self::Response>,
1355 tonic::Status,
1356 >;
1357 fn call(
1358 &mut self,
1359 request: tonic::Request<super::FlightDescriptor>,
1360 ) -> Self::Future {
1361 let inner = Arc::clone(&self.0);
1362 let fut = async move {
1363 <T as FlightService>::get_schema(&inner, request).await
1364 };
1365 Box::pin(fut)
1366 }
1367 }
1368 let accept_compression_encodings = self.accept_compression_encodings;
1369 let send_compression_encodings = self.send_compression_encodings;
1370 let max_decoding_message_size = self.max_decoding_message_size;
1371 let max_encoding_message_size = self.max_encoding_message_size;
1372 let inner = self.inner.clone();
1373 let fut = async move {
1374 let method = GetSchemaSvc(inner);
1375 let codec = tonic_prost::ProstCodec::default();
1376 let mut grpc = tonic::server::Grpc::new(codec)
1377 .apply_compression_config(
1378 accept_compression_encodings,
1379 send_compression_encodings,
1380 )
1381 .apply_max_message_size_config(
1382 max_decoding_message_size,
1383 max_encoding_message_size,
1384 );
1385 let res = grpc.unary(method, req).await;
1386 Ok(res)
1387 };
1388 Box::pin(fut)
1389 }
1390 "/arrow.flight.protocol.FlightService/DoGet" => {
1391 #[allow(non_camel_case_types)]
1392 struct DoGetSvc<T: FlightService>(pub Arc<T>);
1393 impl<
1394 T: FlightService,
1395 > tonic::server::ServerStreamingService<super::Ticket>
1396 for DoGetSvc<T> {
1397 type Response = super::FlightData;
1398 type ResponseStream = T::DoGetStream;
1399 type Future = BoxFuture<
1400 tonic::Response<Self::ResponseStream>,
1401 tonic::Status,
1402 >;
1403 fn call(
1404 &mut self,
1405 request: tonic::Request<super::Ticket>,
1406 ) -> Self::Future {
1407 let inner = Arc::clone(&self.0);
1408 let fut = async move {
1409 <T as FlightService>::do_get(&inner, request).await
1410 };
1411 Box::pin(fut)
1412 }
1413 }
1414 let accept_compression_encodings = self.accept_compression_encodings;
1415 let send_compression_encodings = self.send_compression_encodings;
1416 let max_decoding_message_size = self.max_decoding_message_size;
1417 let max_encoding_message_size = self.max_encoding_message_size;
1418 let inner = self.inner.clone();
1419 let fut = async move {
1420 let method = DoGetSvc(inner);
1421 let codec = tonic_prost::ProstCodec::default();
1422 let mut grpc = tonic::server::Grpc::new(codec)
1423 .apply_compression_config(
1424 accept_compression_encodings,
1425 send_compression_encodings,
1426 )
1427 .apply_max_message_size_config(
1428 max_decoding_message_size,
1429 max_encoding_message_size,
1430 );
1431 let res = grpc.server_streaming(method, req).await;
1432 Ok(res)
1433 };
1434 Box::pin(fut)
1435 }
1436 "/arrow.flight.protocol.FlightService/DoPut" => {
1437 #[allow(non_camel_case_types)]
1438 struct DoPutSvc<T: FlightService>(pub Arc<T>);
1439 impl<
1440 T: FlightService,
1441 > tonic::server::StreamingService<super::FlightData>
1442 for DoPutSvc<T> {
1443 type Response = super::PutResult;
1444 type ResponseStream = T::DoPutStream;
1445 type Future = BoxFuture<
1446 tonic::Response<Self::ResponseStream>,
1447 tonic::Status,
1448 >;
1449 fn call(
1450 &mut self,
1451 request: tonic::Request<tonic::Streaming<super::FlightData>>,
1452 ) -> Self::Future {
1453 let inner = Arc::clone(&self.0);
1454 let fut = async move {
1455 <T as FlightService>::do_put(&inner, request).await
1456 };
1457 Box::pin(fut)
1458 }
1459 }
1460 let accept_compression_encodings = self.accept_compression_encodings;
1461 let send_compression_encodings = self.send_compression_encodings;
1462 let max_decoding_message_size = self.max_decoding_message_size;
1463 let max_encoding_message_size = self.max_encoding_message_size;
1464 let inner = self.inner.clone();
1465 let fut = async move {
1466 let method = DoPutSvc(inner);
1467 let codec = tonic_prost::ProstCodec::default();
1468 let mut grpc = tonic::server::Grpc::new(codec)
1469 .apply_compression_config(
1470 accept_compression_encodings,
1471 send_compression_encodings,
1472 )
1473 .apply_max_message_size_config(
1474 max_decoding_message_size,
1475 max_encoding_message_size,
1476 );
1477 let res = grpc.streaming(method, req).await;
1478 Ok(res)
1479 };
1480 Box::pin(fut)
1481 }
1482 "/arrow.flight.protocol.FlightService/DoExchange" => {
1483 #[allow(non_camel_case_types)]
1484 struct DoExchangeSvc<T: FlightService>(pub Arc<T>);
1485 impl<
1486 T: FlightService,
1487 > tonic::server::StreamingService<super::FlightData>
1488 for DoExchangeSvc<T> {
1489 type Response = super::FlightData;
1490 type ResponseStream = T::DoExchangeStream;
1491 type Future = BoxFuture<
1492 tonic::Response<Self::ResponseStream>,
1493 tonic::Status,
1494 >;
1495 fn call(
1496 &mut self,
1497 request: tonic::Request<tonic::Streaming<super::FlightData>>,
1498 ) -> Self::Future {
1499 let inner = Arc::clone(&self.0);
1500 let fut = async move {
1501 <T as FlightService>::do_exchange(&inner, request).await
1502 };
1503 Box::pin(fut)
1504 }
1505 }
1506 let accept_compression_encodings = self.accept_compression_encodings;
1507 let send_compression_encodings = self.send_compression_encodings;
1508 let max_decoding_message_size = self.max_decoding_message_size;
1509 let max_encoding_message_size = self.max_encoding_message_size;
1510 let inner = self.inner.clone();
1511 let fut = async move {
1512 let method = DoExchangeSvc(inner);
1513 let codec = tonic_prost::ProstCodec::default();
1514 let mut grpc = tonic::server::Grpc::new(codec)
1515 .apply_compression_config(
1516 accept_compression_encodings,
1517 send_compression_encodings,
1518 )
1519 .apply_max_message_size_config(
1520 max_decoding_message_size,
1521 max_encoding_message_size,
1522 );
1523 let res = grpc.streaming(method, req).await;
1524 Ok(res)
1525 };
1526 Box::pin(fut)
1527 }
1528 "/arrow.flight.protocol.FlightService/DoAction" => {
1529 #[allow(non_camel_case_types)]
1530 struct DoActionSvc<T: FlightService>(pub Arc<T>);
1531 impl<
1532 T: FlightService,
1533 > tonic::server::ServerStreamingService<super::Action>
1534 for DoActionSvc<T> {
1535 type Response = super::Result;
1536 type ResponseStream = T::DoActionStream;
1537 type Future = BoxFuture<
1538 tonic::Response<Self::ResponseStream>,
1539 tonic::Status,
1540 >;
1541 fn call(
1542 &mut self,
1543 request: tonic::Request<super::Action>,
1544 ) -> Self::Future {
1545 let inner = Arc::clone(&self.0);
1546 let fut = async move {
1547 <T as FlightService>::do_action(&inner, request).await
1548 };
1549 Box::pin(fut)
1550 }
1551 }
1552 let accept_compression_encodings = self.accept_compression_encodings;
1553 let send_compression_encodings = self.send_compression_encodings;
1554 let max_decoding_message_size = self.max_decoding_message_size;
1555 let max_encoding_message_size = self.max_encoding_message_size;
1556 let inner = self.inner.clone();
1557 let fut = async move {
1558 let method = DoActionSvc(inner);
1559 let codec = tonic_prost::ProstCodec::default();
1560 let mut grpc = tonic::server::Grpc::new(codec)
1561 .apply_compression_config(
1562 accept_compression_encodings,
1563 send_compression_encodings,
1564 )
1565 .apply_max_message_size_config(
1566 max_decoding_message_size,
1567 max_encoding_message_size,
1568 );
1569 let res = grpc.server_streaming(method, req).await;
1570 Ok(res)
1571 };
1572 Box::pin(fut)
1573 }
1574 "/arrow.flight.protocol.FlightService/ListActions" => {
1575 #[allow(non_camel_case_types)]
1576 struct ListActionsSvc<T: FlightService>(pub Arc<T>);
1577 impl<
1578 T: FlightService,
1579 > tonic::server::ServerStreamingService<super::Empty>
1580 for ListActionsSvc<T> {
1581 type Response = super::ActionType;
1582 type ResponseStream = T::ListActionsStream;
1583 type Future = BoxFuture<
1584 tonic::Response<Self::ResponseStream>,
1585 tonic::Status,
1586 >;
1587 fn call(
1588 &mut self,
1589 request: tonic::Request<super::Empty>,
1590 ) -> Self::Future {
1591 let inner = Arc::clone(&self.0);
1592 let fut = async move {
1593 <T as FlightService>::list_actions(&inner, request).await
1594 };
1595 Box::pin(fut)
1596 }
1597 }
1598 let accept_compression_encodings = self.accept_compression_encodings;
1599 let send_compression_encodings = self.send_compression_encodings;
1600 let max_decoding_message_size = self.max_decoding_message_size;
1601 let max_encoding_message_size = self.max_encoding_message_size;
1602 let inner = self.inner.clone();
1603 let fut = async move {
1604 let method = ListActionsSvc(inner);
1605 let codec = tonic_prost::ProstCodec::default();
1606 let mut grpc = tonic::server::Grpc::new(codec)
1607 .apply_compression_config(
1608 accept_compression_encodings,
1609 send_compression_encodings,
1610 )
1611 .apply_max_message_size_config(
1612 max_decoding_message_size,
1613 max_encoding_message_size,
1614 );
1615 let res = grpc.server_streaming(method, req).await;
1616 Ok(res)
1617 };
1618 Box::pin(fut)
1619 }
1620 _ => {
1621 Box::pin(async move {
1622 let mut response = http::Response::new(
1623 tonic::body::Body::default(),
1624 );
1625 let headers = response.headers_mut();
1626 headers
1627 .insert(
1628 tonic::Status::GRPC_STATUS,
1629 (tonic::Code::Unimplemented as i32).into(),
1630 );
1631 headers
1632 .insert(
1633 http::header::CONTENT_TYPE,
1634 tonic::metadata::GRPC_CONTENT_TYPE,
1635 );
1636 Ok(response)
1637 })
1638 }
1639 }
1640 }
1641 }
1642 impl<T> Clone for FlightServiceServer<T> {
1643 fn clone(&self) -> Self {
1644 let inner = self.inner.clone();
1645 Self {
1646 inner,
1647 accept_compression_encodings: self.accept_compression_encodings,
1648 send_compression_encodings: self.send_compression_encodings,
1649 max_decoding_message_size: self.max_decoding_message_size,
1650 max_encoding_message_size: self.max_encoding_message_size,
1651 }
1652 }
1653 }
1654 /// Generated gRPC service name
1655 pub const SERVICE_NAME: &str = "arrow.flight.protocol.FlightService";
1656 impl<T> tonic::server::NamedService for FlightServiceServer<T> {
1657 const NAME: &'static str = SERVICE_NAME;
1658 }
1659}