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