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