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/// 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, Eq, Hash, ::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, Eq, Hash, ::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, Eq, Hash, ::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, Eq, Hash, ::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, Eq, Hash, ::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, Eq, Hash, ::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, Eq, Hash, ::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, Eq, Hash, ::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<T> FlightServiceClient<T>
439 where
440 T: tonic::client::GrpcService<tonic::body::Body>,
441 T::Error: Into<StdError>,
442 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
443 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
444 {
445 pub fn new(inner: T) -> Self {
446 let inner = tonic::client::Grpc::new(inner);
447 Self { inner }
448 }
449 pub fn with_origin(inner: T, origin: Uri) -> Self {
450 let inner = tonic::client::Grpc::with_origin(inner, origin);
451 Self { inner }
452 }
453 pub fn with_interceptor<F>(
454 inner: T,
455 interceptor: F,
456 ) -> FlightServiceClient<InterceptedService<T, F>>
457 where
458 F: tonic::service::Interceptor,
459 T::ResponseBody: Default,
460 T: tonic::codegen::Service<
461 http::Request<tonic::body::Body>,
462 Response = http::Response<
463 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
464 >,
465 >,
466 <T as tonic::codegen::Service<
467 http::Request<tonic::body::Body>,
468 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
469 {
470 FlightServiceClient::new(InterceptedService::new(inner, interceptor))
471 }
472 /// Compress requests with the given encoding.
473 ///
474 /// This requires the server to support it otherwise it might respond with an
475 /// error.
476 #[must_use]
477 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
478 self.inner = self.inner.send_compressed(encoding);
479 self
480 }
481 /// Enable decompressing responses.
482 #[must_use]
483 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
484 self.inner = self.inner.accept_compressed(encoding);
485 self
486 }
487 /// Limits the maximum size of a decoded message.
488 ///
489 /// Default: `4MB`
490 #[must_use]
491 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
492 self.inner = self.inner.max_decoding_message_size(limit);
493 self
494 }
495 /// Limits the maximum size of an encoded message.
496 ///
497 /// Default: `usize::MAX`
498 #[must_use]
499 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
500 self.inner = self.inner.max_encoding_message_size(limit);
501 self
502 }
503 ///
504 /// Handshake between client and server. Depending on the server, the
505 /// handshake may be required to determine the token that should be used for
506 /// future operations. Both request and response are streams to allow multiple
507 /// round-trips depending on auth mechanism.
508 pub async fn handshake(
509 &mut self,
510 request: impl tonic::IntoStreamingRequest<Message = super::HandshakeRequest>,
511 ) -> std::result::Result<
512 tonic::Response<tonic::codec::Streaming<super::HandshakeResponse>>,
513 tonic::Status,
514 > {
515 self.inner
516 .ready()
517 .await
518 .map_err(|e| {
519 tonic::Status::unknown(
520 format!("Service was not ready: {}", e.into()),
521 )
522 })?;
523 let codec = tonic_prost::ProstCodec::default();
524 let path = http::uri::PathAndQuery::from_static(
525 "/arrow.flight.protocol.FlightService/Handshake",
526 );
527 let mut req = request.into_streaming_request();
528 req.extensions_mut()
529 .insert(
530 GrpcMethod::new("arrow.flight.protocol.FlightService", "Handshake"),
531 );
532 self.inner.streaming(req, path, codec).await
533 }
534 ///
535 /// Get a list of available streams given a particular criteria. Most flight
536 /// services will expose one or more streams that are readily available for
537 /// retrieval. This api allows listing the streams available for
538 /// consumption. A user can also provide a criteria. The criteria can limit
539 /// the subset of streams that can be listed via this interface. Each flight
540 /// service allows its own definition of how to consume criteria.
541 pub async fn list_flights(
542 &mut self,
543 request: impl tonic::IntoRequest<super::Criteria>,
544 ) -> std::result::Result<
545 tonic::Response<tonic::codec::Streaming<super::FlightInfo>>,
546 tonic::Status,
547 > {
548 self.inner
549 .ready()
550 .await
551 .map_err(|e| {
552 tonic::Status::unknown(
553 format!("Service was not ready: {}", e.into()),
554 )
555 })?;
556 let codec = tonic_prost::ProstCodec::default();
557 let path = http::uri::PathAndQuery::from_static(
558 "/arrow.flight.protocol.FlightService/ListFlights",
559 );
560 let mut req = request.into_request();
561 req.extensions_mut()
562 .insert(
563 GrpcMethod::new("arrow.flight.protocol.FlightService", "ListFlights"),
564 );
565 self.inner.server_streaming(req, path, codec).await
566 }
567 ///
568 /// For a given FlightDescriptor, get information about how the flight can be
569 /// consumed. This is a useful interface if the consumer of the interface
570 /// already can identify the specific flight to consume. This interface can
571 /// also allow a consumer to generate a flight stream through a specified
572 /// descriptor. For example, a flight descriptor might be something that
573 /// includes a SQL statement or a Pickled Python operation that will be
574 /// executed. In those cases, the descriptor will not be previously available
575 /// within the list of available streams provided by ListFlights but will be
576 /// available for consumption for the duration defined by the specific flight
577 /// service.
578 pub async fn get_flight_info(
579 &mut self,
580 request: impl tonic::IntoRequest<super::FlightDescriptor>,
581 ) -> std::result::Result<tonic::Response<super::FlightInfo>, tonic::Status> {
582 self.inner
583 .ready()
584 .await
585 .map_err(|e| {
586 tonic::Status::unknown(
587 format!("Service was not ready: {}", e.into()),
588 )
589 })?;
590 let codec = tonic_prost::ProstCodec::default();
591 let path = http::uri::PathAndQuery::from_static(
592 "/arrow.flight.protocol.FlightService/GetFlightInfo",
593 );
594 let mut req = request.into_request();
595 req.extensions_mut()
596 .insert(
597 GrpcMethod::new(
598 "arrow.flight.protocol.FlightService",
599 "GetFlightInfo",
600 ),
601 );
602 self.inner.unary(req, path, codec).await
603 }
604 ///
605 /// For a given FlightDescriptor, start a query and get information
606 /// to poll its execution status. This is a useful interface if the
607 /// query may be a long-running query. The first PollFlightInfo call
608 /// should return as quickly as possible. (GetFlightInfo doesn't
609 /// return until the query is complete.)
610 ///
611 /// A client can consume any available results before
612 /// the query is completed. See PollInfo.info for details.
613 ///
614 /// A client can poll the updated query status by calling
615 /// PollFlightInfo() with PollInfo.flight_descriptor. A server
616 /// should not respond until the result would be different from last
617 /// time. That way, the client can "long poll" for updates
618 /// without constantly making requests. Clients can set a short timeout
619 /// to avoid blocking calls if desired.
620 ///
621 /// A client can't use PollInfo.flight_descriptor after
622 /// PollInfo.expiration_time passes. A server might not accept the
623 /// retry descriptor anymore and the query may be cancelled.
624 ///
625 /// A client may use the CancelFlightInfo action with
626 /// PollInfo.info to cancel the running query.
627 pub async fn poll_flight_info(
628 &mut self,
629 request: impl tonic::IntoRequest<super::FlightDescriptor>,
630 ) -> std::result::Result<tonic::Response<super::PollInfo>, tonic::Status> {
631 self.inner
632 .ready()
633 .await
634 .map_err(|e| {
635 tonic::Status::unknown(
636 format!("Service was not ready: {}", e.into()),
637 )
638 })?;
639 let codec = tonic_prost::ProstCodec::default();
640 let path = http::uri::PathAndQuery::from_static(
641 "/arrow.flight.protocol.FlightService/PollFlightInfo",
642 );
643 let mut req = request.into_request();
644 req.extensions_mut()
645 .insert(
646 GrpcMethod::new(
647 "arrow.flight.protocol.FlightService",
648 "PollFlightInfo",
649 ),
650 );
651 self.inner.unary(req, path, codec).await
652 }
653 ///
654 /// For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
655 /// This is used when a consumer needs the Schema of flight stream. Similar to
656 /// GetFlightInfo this interface may generate a new flight that was not previously
657 /// available in ListFlights.
658 pub async fn get_schema(
659 &mut self,
660 request: impl tonic::IntoRequest<super::FlightDescriptor>,
661 ) -> std::result::Result<tonic::Response<super::SchemaResult>, tonic::Status> {
662 self.inner
663 .ready()
664 .await
665 .map_err(|e| {
666 tonic::Status::unknown(
667 format!("Service was not ready: {}", e.into()),
668 )
669 })?;
670 let codec = tonic_prost::ProstCodec::default();
671 let path = http::uri::PathAndQuery::from_static(
672 "/arrow.flight.protocol.FlightService/GetSchema",
673 );
674 let mut req = request.into_request();
675 req.extensions_mut()
676 .insert(
677 GrpcMethod::new("arrow.flight.protocol.FlightService", "GetSchema"),
678 );
679 self.inner.unary(req, path, codec).await
680 }
681 ///
682 /// Retrieve a single stream associated with a particular descriptor
683 /// associated with the referenced ticket. A Flight can be composed of one or
684 /// more streams where each stream can be retrieved using a separate opaque
685 /// ticket that the flight service uses for managing a collection of streams.
686 pub async fn do_get(
687 &mut self,
688 request: impl tonic::IntoRequest<super::Ticket>,
689 ) -> std::result::Result<
690 tonic::Response<tonic::codec::Streaming<super::FlightData>>,
691 tonic::Status,
692 > {
693 self.inner
694 .ready()
695 .await
696 .map_err(|e| {
697 tonic::Status::unknown(
698 format!("Service was not ready: {}", e.into()),
699 )
700 })?;
701 let codec = tonic_prost::ProstCodec::default();
702 let path = http::uri::PathAndQuery::from_static(
703 "/arrow.flight.protocol.FlightService/DoGet",
704 );
705 let mut req = request.into_request();
706 req.extensions_mut()
707 .insert(GrpcMethod::new("arrow.flight.protocol.FlightService", "DoGet"));
708 self.inner.server_streaming(req, path, codec).await
709 }
710 ///
711 /// Push a stream to the flight service associated with a particular
712 /// flight stream. This allows a client of a flight service to upload a stream
713 /// of data. Depending on the particular flight service, a client consumer
714 /// could be allowed to upload a single stream per descriptor or an unlimited
715 /// number. In the latter, the service might implement a 'seal' action that
716 /// can be applied to a descriptor once all streams are uploaded.
717 pub async fn do_put(
718 &mut self,
719 request: impl tonic::IntoStreamingRequest<Message = super::FlightData>,
720 ) -> std::result::Result<
721 tonic::Response<tonic::codec::Streaming<super::PutResult>>,
722 tonic::Status,
723 > {
724 self.inner
725 .ready()
726 .await
727 .map_err(|e| {
728 tonic::Status::unknown(
729 format!("Service was not ready: {}", e.into()),
730 )
731 })?;
732 let codec = tonic_prost::ProstCodec::default();
733 let path = http::uri::PathAndQuery::from_static(
734 "/arrow.flight.protocol.FlightService/DoPut",
735 );
736 let mut req = request.into_streaming_request();
737 req.extensions_mut()
738 .insert(GrpcMethod::new("arrow.flight.protocol.FlightService", "DoPut"));
739 self.inner.streaming(req, path, codec).await
740 }
741 ///
742 /// Open a bidirectional data channel for a given descriptor. This
743 /// allows clients to send and receive arbitrary Arrow data and
744 /// application-specific metadata in a single logical stream. In
745 /// contrast to DoGet/DoPut, this is more suited for clients
746 /// offloading computation (rather than storage) to a Flight service.
747 pub async fn do_exchange(
748 &mut self,
749 request: impl tonic::IntoStreamingRequest<Message = super::FlightData>,
750 ) -> std::result::Result<
751 tonic::Response<tonic::codec::Streaming<super::FlightData>>,
752 tonic::Status,
753 > {
754 self.inner
755 .ready()
756 .await
757 .map_err(|e| {
758 tonic::Status::unknown(
759 format!("Service was not ready: {}", e.into()),
760 )
761 })?;
762 let codec = tonic_prost::ProstCodec::default();
763 let path = http::uri::PathAndQuery::from_static(
764 "/arrow.flight.protocol.FlightService/DoExchange",
765 );
766 let mut req = request.into_streaming_request();
767 req.extensions_mut()
768 .insert(
769 GrpcMethod::new("arrow.flight.protocol.FlightService", "DoExchange"),
770 );
771 self.inner.streaming(req, path, codec).await
772 }
773 ///
774 /// Flight services can support an arbitrary number of simple actions in
775 /// addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
776 /// operations that are potentially available. DoAction allows a flight client
777 /// to do a specific action against a flight service. An action includes
778 /// opaque request and response objects that are specific to the type action
779 /// being undertaken.
780 pub async fn do_action(
781 &mut self,
782 request: impl tonic::IntoRequest<super::Action>,
783 ) -> std::result::Result<
784 tonic::Response<tonic::codec::Streaming<super::Result>>,
785 tonic::Status,
786 > {
787 self.inner
788 .ready()
789 .await
790 .map_err(|e| {
791 tonic::Status::unknown(
792 format!("Service was not ready: {}", e.into()),
793 )
794 })?;
795 let codec = tonic_prost::ProstCodec::default();
796 let path = http::uri::PathAndQuery::from_static(
797 "/arrow.flight.protocol.FlightService/DoAction",
798 );
799 let mut req = request.into_request();
800 req.extensions_mut()
801 .insert(
802 GrpcMethod::new("arrow.flight.protocol.FlightService", "DoAction"),
803 );
804 self.inner.server_streaming(req, path, codec).await
805 }
806 ///
807 /// A flight service exposes all of the available action types that it has
808 /// along with descriptions. This allows different flight consumers to
809 /// understand the capabilities of the flight service.
810 pub async fn list_actions(
811 &mut self,
812 request: impl tonic::IntoRequest<super::Empty>,
813 ) -> std::result::Result<
814 tonic::Response<tonic::codec::Streaming<super::ActionType>>,
815 tonic::Status,
816 > {
817 self.inner
818 .ready()
819 .await
820 .map_err(|e| {
821 tonic::Status::unknown(
822 format!("Service was not ready: {}", e.into()),
823 )
824 })?;
825 let codec = tonic_prost::ProstCodec::default();
826 let path = http::uri::PathAndQuery::from_static(
827 "/arrow.flight.protocol.FlightService/ListActions",
828 );
829 let mut req = request.into_request();
830 req.extensions_mut()
831 .insert(
832 GrpcMethod::new("arrow.flight.protocol.FlightService", "ListActions"),
833 );
834 self.inner.server_streaming(req, path, codec).await
835 }
836 }
837}
838/// Generated server implementations.
839pub mod flight_service_server {
840 #![allow(
841 unused_variables,
842 dead_code,
843 missing_docs,
844 clippy::wildcard_imports,
845 clippy::let_unit_value,
846 )]
847 use tonic::codegen::*;
848 /// Generated trait containing gRPC methods that should be implemented for use with FlightServiceServer.
849 #[async_trait]
850 pub trait FlightService: std::marker::Send + std::marker::Sync + 'static {
851 /// Server streaming response type for the Handshake method.
852 type HandshakeStream: tonic::codegen::tokio_stream::Stream<
853 Item = std::result::Result<super::HandshakeResponse, tonic::Status>,
854 >
855 + std::marker::Send
856 + 'static;
857 ///
858 /// Handshake between client and server. Depending on the server, the
859 /// handshake may be required to determine the token that should be used for
860 /// future operations. Both request and response are streams to allow multiple
861 /// round-trips depending on auth mechanism.
862 async fn handshake(
863 &self,
864 request: tonic::Request<tonic::Streaming<super::HandshakeRequest>>,
865 ) -> std::result::Result<tonic::Response<Self::HandshakeStream>, tonic::Status>;
866 /// Server streaming response type for the ListFlights method.
867 type ListFlightsStream: tonic::codegen::tokio_stream::Stream<
868 Item = std::result::Result<super::FlightInfo, tonic::Status>,
869 >
870 + std::marker::Send
871 + 'static;
872 ///
873 /// Get a list of available streams given a particular criteria. Most flight
874 /// services will expose one or more streams that are readily available for
875 /// retrieval. This api allows listing the streams available for
876 /// consumption. A user can also provide a criteria. The criteria can limit
877 /// the subset of streams that can be listed via this interface. Each flight
878 /// service allows its own definition of how to consume criteria.
879 async fn list_flights(
880 &self,
881 request: tonic::Request<super::Criteria>,
882 ) -> std::result::Result<
883 tonic::Response<Self::ListFlightsStream>,
884 tonic::Status,
885 >;
886 ///
887 /// For a given FlightDescriptor, get information about how the flight can be
888 /// consumed. This is a useful interface if the consumer of the interface
889 /// already can identify the specific flight to consume. This interface can
890 /// also allow a consumer to generate a flight stream through a specified
891 /// descriptor. For example, a flight descriptor might be something that
892 /// includes a SQL statement or a Pickled Python operation that will be
893 /// executed. In those cases, the descriptor will not be previously available
894 /// within the list of available streams provided by ListFlights but will be
895 /// available for consumption for the duration defined by the specific flight
896 /// service.
897 async fn get_flight_info(
898 &self,
899 request: tonic::Request<super::FlightDescriptor>,
900 ) -> std::result::Result<tonic::Response<super::FlightInfo>, tonic::Status>;
901 ///
902 /// For a given FlightDescriptor, start a query and get information
903 /// to poll its execution status. This is a useful interface if the
904 /// query may be a long-running query. The first PollFlightInfo call
905 /// should return as quickly as possible. (GetFlightInfo doesn't
906 /// return until the query is complete.)
907 ///
908 /// A client can consume any available results before
909 /// the query is completed. See PollInfo.info for details.
910 ///
911 /// A client can poll the updated query status by calling
912 /// PollFlightInfo() with PollInfo.flight_descriptor. A server
913 /// should not respond until the result would be different from last
914 /// time. That way, the client can "long poll" for updates
915 /// without constantly making requests. Clients can set a short timeout
916 /// to avoid blocking calls if desired.
917 ///
918 /// A client can't use PollInfo.flight_descriptor after
919 /// PollInfo.expiration_time passes. A server might not accept the
920 /// retry descriptor anymore and the query may be cancelled.
921 ///
922 /// A client may use the CancelFlightInfo action with
923 /// PollInfo.info to cancel the running query.
924 async fn poll_flight_info(
925 &self,
926 request: tonic::Request<super::FlightDescriptor>,
927 ) -> std::result::Result<tonic::Response<super::PollInfo>, tonic::Status>;
928 ///
929 /// For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
930 /// This is used when a consumer needs the Schema of flight stream. Similar to
931 /// GetFlightInfo this interface may generate a new flight that was not previously
932 /// available in ListFlights.
933 async fn get_schema(
934 &self,
935 request: tonic::Request<super::FlightDescriptor>,
936 ) -> std::result::Result<tonic::Response<super::SchemaResult>, tonic::Status>;
937 /// Server streaming response type for the DoGet method.
938 type DoGetStream: tonic::codegen::tokio_stream::Stream<
939 Item = std::result::Result<super::FlightData, tonic::Status>,
940 >
941 + std::marker::Send
942 + 'static;
943 ///
944 /// Retrieve a single stream associated with a particular descriptor
945 /// associated with the referenced ticket. A Flight can be composed of one or
946 /// more streams where each stream can be retrieved using a separate opaque
947 /// ticket that the flight service uses for managing a collection of streams.
948 async fn do_get(
949 &self,
950 request: tonic::Request<super::Ticket>,
951 ) -> std::result::Result<tonic::Response<Self::DoGetStream>, tonic::Status>;
952 /// Server streaming response type for the DoPut method.
953 type DoPutStream: tonic::codegen::tokio_stream::Stream<
954 Item = std::result::Result<super::PutResult, tonic::Status>,
955 >
956 + std::marker::Send
957 + 'static;
958 ///
959 /// Push a stream to the flight service associated with a particular
960 /// flight stream. This allows a client of a flight service to upload a stream
961 /// of data. Depending on the particular flight service, a client consumer
962 /// could be allowed to upload a single stream per descriptor or an unlimited
963 /// number. In the latter, the service might implement a 'seal' action that
964 /// can be applied to a descriptor once all streams are uploaded.
965 async fn do_put(
966 &self,
967 request: tonic::Request<tonic::Streaming<super::FlightData>>,
968 ) -> std::result::Result<tonic::Response<Self::DoPutStream>, tonic::Status>;
969 /// Server streaming response type for the DoExchange method.
970 type DoExchangeStream: tonic::codegen::tokio_stream::Stream<
971 Item = std::result::Result<super::FlightData, tonic::Status>,
972 >
973 + std::marker::Send
974 + 'static;
975 ///
976 /// Open a bidirectional data channel for a given descriptor. This
977 /// allows clients to send and receive arbitrary Arrow data and
978 /// application-specific metadata in a single logical stream. In
979 /// contrast to DoGet/DoPut, this is more suited for clients
980 /// offloading computation (rather than storage) to a Flight service.
981 async fn do_exchange(
982 &self,
983 request: tonic::Request<tonic::Streaming<super::FlightData>>,
984 ) -> std::result::Result<tonic::Response<Self::DoExchangeStream>, tonic::Status>;
985 /// Server streaming response type for the DoAction method.
986 type DoActionStream: tonic::codegen::tokio_stream::Stream<
987 Item = std::result::Result<super::Result, tonic::Status>,
988 >
989 + std::marker::Send
990 + 'static;
991 ///
992 /// Flight services can support an arbitrary number of simple actions in
993 /// addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
994 /// operations that are potentially available. DoAction allows a flight client
995 /// to do a specific action against a flight service. An action includes
996 /// opaque request and response objects that are specific to the type action
997 /// being undertaken.
998 async fn do_action(
999 &self,
1000 request: tonic::Request<super::Action>,
1001 ) -> std::result::Result<tonic::Response<Self::DoActionStream>, tonic::Status>;
1002 /// Server streaming response type for the ListActions method.
1003 type ListActionsStream: tonic::codegen::tokio_stream::Stream<
1004 Item = std::result::Result<super::ActionType, tonic::Status>,
1005 >
1006 + std::marker::Send
1007 + 'static;
1008 ///
1009 /// A flight service exposes all of the available action types that it has
1010 /// along with descriptions. This allows different flight consumers to
1011 /// understand the capabilities of the flight service.
1012 async fn list_actions(
1013 &self,
1014 request: tonic::Request<super::Empty>,
1015 ) -> std::result::Result<
1016 tonic::Response<Self::ListActionsStream>,
1017 tonic::Status,
1018 >;
1019 }
1020 ///
1021 /// A flight service is an endpoint for retrieving or storing Arrow data. A
1022 /// flight service can expose one or more predefined endpoints that can be
1023 /// accessed using the Arrow Flight Protocol. Additionally, a flight service
1024 /// can expose a set of actions that are available.
1025 #[derive(Debug)]
1026 pub struct FlightServiceServer<T> {
1027 inner: Arc<T>,
1028 accept_compression_encodings: EnabledCompressionEncodings,
1029 send_compression_encodings: EnabledCompressionEncodings,
1030 max_decoding_message_size: Option<usize>,
1031 max_encoding_message_size: Option<usize>,
1032 }
1033 impl<T> FlightServiceServer<T> {
1034 pub fn new(inner: T) -> Self {
1035 Self::from_arc(Arc::new(inner))
1036 }
1037 pub fn from_arc(inner: Arc<T>) -> Self {
1038 Self {
1039 inner,
1040 accept_compression_encodings: Default::default(),
1041 send_compression_encodings: Default::default(),
1042 max_decoding_message_size: None,
1043 max_encoding_message_size: None,
1044 }
1045 }
1046 pub fn with_interceptor<F>(
1047 inner: T,
1048 interceptor: F,
1049 ) -> InterceptedService<Self, F>
1050 where
1051 F: tonic::service::Interceptor,
1052 {
1053 InterceptedService::new(Self::new(inner), interceptor)
1054 }
1055 /// Enable decompressing requests with the given encoding.
1056 #[must_use]
1057 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1058 self.accept_compression_encodings.enable(encoding);
1059 self
1060 }
1061 /// Compress responses with the given encoding, if the client supports it.
1062 #[must_use]
1063 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1064 self.send_compression_encodings.enable(encoding);
1065 self
1066 }
1067 /// Limits the maximum size of a decoded message.
1068 ///
1069 /// Default: `4MB`
1070 #[must_use]
1071 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1072 self.max_decoding_message_size = Some(limit);
1073 self
1074 }
1075 /// Limits the maximum size of an encoded message.
1076 ///
1077 /// Default: `usize::MAX`
1078 #[must_use]
1079 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1080 self.max_encoding_message_size = Some(limit);
1081 self
1082 }
1083 }
1084 impl<T, B> tonic::codegen::Service<http::Request<B>> for FlightServiceServer<T>
1085 where
1086 T: FlightService,
1087 B: Body + std::marker::Send + 'static,
1088 B::Error: Into<StdError> + std::marker::Send + 'static,
1089 {
1090 type Response = http::Response<tonic::body::Body>;
1091 type Error = std::convert::Infallible;
1092 type Future = BoxFuture<Self::Response, Self::Error>;
1093 fn poll_ready(
1094 &mut self,
1095 _cx: &mut Context<'_>,
1096 ) -> Poll<std::result::Result<(), Self::Error>> {
1097 Poll::Ready(Ok(()))
1098 }
1099 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1100 match req.uri().path() {
1101 "/arrow.flight.protocol.FlightService/Handshake" => {
1102 #[allow(non_camel_case_types)]
1103 struct HandshakeSvc<T: FlightService>(pub Arc<T>);
1104 impl<
1105 T: FlightService,
1106 > tonic::server::StreamingService<super::HandshakeRequest>
1107 for HandshakeSvc<T> {
1108 type Response = super::HandshakeResponse;
1109 type ResponseStream = T::HandshakeStream;
1110 type Future = BoxFuture<
1111 tonic::Response<Self::ResponseStream>,
1112 tonic::Status,
1113 >;
1114 fn call(
1115 &mut self,
1116 request: tonic::Request<
1117 tonic::Streaming<super::HandshakeRequest>,
1118 >,
1119 ) -> Self::Future {
1120 let inner = Arc::clone(&self.0);
1121 let fut = async move {
1122 <T as FlightService>::handshake(&inner, request).await
1123 };
1124 Box::pin(fut)
1125 }
1126 }
1127 let accept_compression_encodings = self.accept_compression_encodings;
1128 let send_compression_encodings = self.send_compression_encodings;
1129 let max_decoding_message_size = self.max_decoding_message_size;
1130 let max_encoding_message_size = self.max_encoding_message_size;
1131 let inner = self.inner.clone();
1132 let fut = async move {
1133 let method = HandshakeSvc(inner);
1134 let codec = tonic_prost::ProstCodec::default();
1135 let mut grpc = tonic::server::Grpc::new(codec)
1136 .apply_compression_config(
1137 accept_compression_encodings,
1138 send_compression_encodings,
1139 )
1140 .apply_max_message_size_config(
1141 max_decoding_message_size,
1142 max_encoding_message_size,
1143 );
1144 let res = grpc.streaming(method, req).await;
1145 Ok(res)
1146 };
1147 Box::pin(fut)
1148 }
1149 "/arrow.flight.protocol.FlightService/ListFlights" => {
1150 #[allow(non_camel_case_types)]
1151 struct ListFlightsSvc<T: FlightService>(pub Arc<T>);
1152 impl<
1153 T: FlightService,
1154 > tonic::server::ServerStreamingService<super::Criteria>
1155 for ListFlightsSvc<T> {
1156 type Response = super::FlightInfo;
1157 type ResponseStream = T::ListFlightsStream;
1158 type Future = BoxFuture<
1159 tonic::Response<Self::ResponseStream>,
1160 tonic::Status,
1161 >;
1162 fn call(
1163 &mut self,
1164 request: tonic::Request<super::Criteria>,
1165 ) -> Self::Future {
1166 let inner = Arc::clone(&self.0);
1167 let fut = async move {
1168 <T as FlightService>::list_flights(&inner, request).await
1169 };
1170 Box::pin(fut)
1171 }
1172 }
1173 let accept_compression_encodings = self.accept_compression_encodings;
1174 let send_compression_encodings = self.send_compression_encodings;
1175 let max_decoding_message_size = self.max_decoding_message_size;
1176 let max_encoding_message_size = self.max_encoding_message_size;
1177 let inner = self.inner.clone();
1178 let fut = async move {
1179 let method = ListFlightsSvc(inner);
1180 let codec = tonic_prost::ProstCodec::default();
1181 let mut grpc = tonic::server::Grpc::new(codec)
1182 .apply_compression_config(
1183 accept_compression_encodings,
1184 send_compression_encodings,
1185 )
1186 .apply_max_message_size_config(
1187 max_decoding_message_size,
1188 max_encoding_message_size,
1189 );
1190 let res = grpc.server_streaming(method, req).await;
1191 Ok(res)
1192 };
1193 Box::pin(fut)
1194 }
1195 "/arrow.flight.protocol.FlightService/GetFlightInfo" => {
1196 #[allow(non_camel_case_types)]
1197 struct GetFlightInfoSvc<T: FlightService>(pub Arc<T>);
1198 impl<
1199 T: FlightService,
1200 > tonic::server::UnaryService<super::FlightDescriptor>
1201 for GetFlightInfoSvc<T> {
1202 type Response = super::FlightInfo;
1203 type Future = BoxFuture<
1204 tonic::Response<Self::Response>,
1205 tonic::Status,
1206 >;
1207 fn call(
1208 &mut self,
1209 request: tonic::Request<super::FlightDescriptor>,
1210 ) -> Self::Future {
1211 let inner = Arc::clone(&self.0);
1212 let fut = async move {
1213 <T as FlightService>::get_flight_info(&inner, request).await
1214 };
1215 Box::pin(fut)
1216 }
1217 }
1218 let accept_compression_encodings = self.accept_compression_encodings;
1219 let send_compression_encodings = self.send_compression_encodings;
1220 let max_decoding_message_size = self.max_decoding_message_size;
1221 let max_encoding_message_size = self.max_encoding_message_size;
1222 let inner = self.inner.clone();
1223 let fut = async move {
1224 let method = GetFlightInfoSvc(inner);
1225 let codec = tonic_prost::ProstCodec::default();
1226 let mut grpc = tonic::server::Grpc::new(codec)
1227 .apply_compression_config(
1228 accept_compression_encodings,
1229 send_compression_encodings,
1230 )
1231 .apply_max_message_size_config(
1232 max_decoding_message_size,
1233 max_encoding_message_size,
1234 );
1235 let res = grpc.unary(method, req).await;
1236 Ok(res)
1237 };
1238 Box::pin(fut)
1239 }
1240 "/arrow.flight.protocol.FlightService/PollFlightInfo" => {
1241 #[allow(non_camel_case_types)]
1242 struct PollFlightInfoSvc<T: FlightService>(pub Arc<T>);
1243 impl<
1244 T: FlightService,
1245 > tonic::server::UnaryService<super::FlightDescriptor>
1246 for PollFlightInfoSvc<T> {
1247 type Response = super::PollInfo;
1248 type Future = BoxFuture<
1249 tonic::Response<Self::Response>,
1250 tonic::Status,
1251 >;
1252 fn call(
1253 &mut self,
1254 request: tonic::Request<super::FlightDescriptor>,
1255 ) -> Self::Future {
1256 let inner = Arc::clone(&self.0);
1257 let fut = async move {
1258 <T as FlightService>::poll_flight_info(&inner, request)
1259 .await
1260 };
1261 Box::pin(fut)
1262 }
1263 }
1264 let accept_compression_encodings = self.accept_compression_encodings;
1265 let send_compression_encodings = self.send_compression_encodings;
1266 let max_decoding_message_size = self.max_decoding_message_size;
1267 let max_encoding_message_size = self.max_encoding_message_size;
1268 let inner = self.inner.clone();
1269 let fut = async move {
1270 let method = PollFlightInfoSvc(inner);
1271 let codec = tonic_prost::ProstCodec::default();
1272 let mut grpc = tonic::server::Grpc::new(codec)
1273 .apply_compression_config(
1274 accept_compression_encodings,
1275 send_compression_encodings,
1276 )
1277 .apply_max_message_size_config(
1278 max_decoding_message_size,
1279 max_encoding_message_size,
1280 );
1281 let res = grpc.unary(method, req).await;
1282 Ok(res)
1283 };
1284 Box::pin(fut)
1285 }
1286 "/arrow.flight.protocol.FlightService/GetSchema" => {
1287 #[allow(non_camel_case_types)]
1288 struct GetSchemaSvc<T: FlightService>(pub Arc<T>);
1289 impl<
1290 T: FlightService,
1291 > tonic::server::UnaryService<super::FlightDescriptor>
1292 for GetSchemaSvc<T> {
1293 type Response = super::SchemaResult;
1294 type Future = BoxFuture<
1295 tonic::Response<Self::Response>,
1296 tonic::Status,
1297 >;
1298 fn call(
1299 &mut self,
1300 request: tonic::Request<super::FlightDescriptor>,
1301 ) -> Self::Future {
1302 let inner = Arc::clone(&self.0);
1303 let fut = async move {
1304 <T as FlightService>::get_schema(&inner, request).await
1305 };
1306 Box::pin(fut)
1307 }
1308 }
1309 let accept_compression_encodings = self.accept_compression_encodings;
1310 let send_compression_encodings = self.send_compression_encodings;
1311 let max_decoding_message_size = self.max_decoding_message_size;
1312 let max_encoding_message_size = self.max_encoding_message_size;
1313 let inner = self.inner.clone();
1314 let fut = async move {
1315 let method = GetSchemaSvc(inner);
1316 let codec = tonic_prost::ProstCodec::default();
1317 let mut grpc = tonic::server::Grpc::new(codec)
1318 .apply_compression_config(
1319 accept_compression_encodings,
1320 send_compression_encodings,
1321 )
1322 .apply_max_message_size_config(
1323 max_decoding_message_size,
1324 max_encoding_message_size,
1325 );
1326 let res = grpc.unary(method, req).await;
1327 Ok(res)
1328 };
1329 Box::pin(fut)
1330 }
1331 "/arrow.flight.protocol.FlightService/DoGet" => {
1332 #[allow(non_camel_case_types)]
1333 struct DoGetSvc<T: FlightService>(pub Arc<T>);
1334 impl<
1335 T: FlightService,
1336 > tonic::server::ServerStreamingService<super::Ticket>
1337 for DoGetSvc<T> {
1338 type Response = super::FlightData;
1339 type ResponseStream = T::DoGetStream;
1340 type Future = BoxFuture<
1341 tonic::Response<Self::ResponseStream>,
1342 tonic::Status,
1343 >;
1344 fn call(
1345 &mut self,
1346 request: tonic::Request<super::Ticket>,
1347 ) -> Self::Future {
1348 let inner = Arc::clone(&self.0);
1349 let fut = async move {
1350 <T as FlightService>::do_get(&inner, request).await
1351 };
1352 Box::pin(fut)
1353 }
1354 }
1355 let accept_compression_encodings = self.accept_compression_encodings;
1356 let send_compression_encodings = self.send_compression_encodings;
1357 let max_decoding_message_size = self.max_decoding_message_size;
1358 let max_encoding_message_size = self.max_encoding_message_size;
1359 let inner = self.inner.clone();
1360 let fut = async move {
1361 let method = DoGetSvc(inner);
1362 let codec = tonic_prost::ProstCodec::default();
1363 let mut grpc = tonic::server::Grpc::new(codec)
1364 .apply_compression_config(
1365 accept_compression_encodings,
1366 send_compression_encodings,
1367 )
1368 .apply_max_message_size_config(
1369 max_decoding_message_size,
1370 max_encoding_message_size,
1371 );
1372 let res = grpc.server_streaming(method, req).await;
1373 Ok(res)
1374 };
1375 Box::pin(fut)
1376 }
1377 "/arrow.flight.protocol.FlightService/DoPut" => {
1378 #[allow(non_camel_case_types)]
1379 struct DoPutSvc<T: FlightService>(pub Arc<T>);
1380 impl<
1381 T: FlightService,
1382 > tonic::server::StreamingService<super::FlightData>
1383 for DoPutSvc<T> {
1384 type Response = super::PutResult;
1385 type ResponseStream = T::DoPutStream;
1386 type Future = BoxFuture<
1387 tonic::Response<Self::ResponseStream>,
1388 tonic::Status,
1389 >;
1390 fn call(
1391 &mut self,
1392 request: tonic::Request<tonic::Streaming<super::FlightData>>,
1393 ) -> Self::Future {
1394 let inner = Arc::clone(&self.0);
1395 let fut = async move {
1396 <T as FlightService>::do_put(&inner, request).await
1397 };
1398 Box::pin(fut)
1399 }
1400 }
1401 let accept_compression_encodings = self.accept_compression_encodings;
1402 let send_compression_encodings = self.send_compression_encodings;
1403 let max_decoding_message_size = self.max_decoding_message_size;
1404 let max_encoding_message_size = self.max_encoding_message_size;
1405 let inner = self.inner.clone();
1406 let fut = async move {
1407 let method = DoPutSvc(inner);
1408 let codec = tonic_prost::ProstCodec::default();
1409 let mut grpc = tonic::server::Grpc::new(codec)
1410 .apply_compression_config(
1411 accept_compression_encodings,
1412 send_compression_encodings,
1413 )
1414 .apply_max_message_size_config(
1415 max_decoding_message_size,
1416 max_encoding_message_size,
1417 );
1418 let res = grpc.streaming(method, req).await;
1419 Ok(res)
1420 };
1421 Box::pin(fut)
1422 }
1423 "/arrow.flight.protocol.FlightService/DoExchange" => {
1424 #[allow(non_camel_case_types)]
1425 struct DoExchangeSvc<T: FlightService>(pub Arc<T>);
1426 impl<
1427 T: FlightService,
1428 > tonic::server::StreamingService<super::FlightData>
1429 for DoExchangeSvc<T> {
1430 type Response = super::FlightData;
1431 type ResponseStream = T::DoExchangeStream;
1432 type Future = BoxFuture<
1433 tonic::Response<Self::ResponseStream>,
1434 tonic::Status,
1435 >;
1436 fn call(
1437 &mut self,
1438 request: tonic::Request<tonic::Streaming<super::FlightData>>,
1439 ) -> Self::Future {
1440 let inner = Arc::clone(&self.0);
1441 let fut = async move {
1442 <T as FlightService>::do_exchange(&inner, request).await
1443 };
1444 Box::pin(fut)
1445 }
1446 }
1447 let accept_compression_encodings = self.accept_compression_encodings;
1448 let send_compression_encodings = self.send_compression_encodings;
1449 let max_decoding_message_size = self.max_decoding_message_size;
1450 let max_encoding_message_size = self.max_encoding_message_size;
1451 let inner = self.inner.clone();
1452 let fut = async move {
1453 let method = DoExchangeSvc(inner);
1454 let codec = tonic_prost::ProstCodec::default();
1455 let mut grpc = tonic::server::Grpc::new(codec)
1456 .apply_compression_config(
1457 accept_compression_encodings,
1458 send_compression_encodings,
1459 )
1460 .apply_max_message_size_config(
1461 max_decoding_message_size,
1462 max_encoding_message_size,
1463 );
1464 let res = grpc.streaming(method, req).await;
1465 Ok(res)
1466 };
1467 Box::pin(fut)
1468 }
1469 "/arrow.flight.protocol.FlightService/DoAction" => {
1470 #[allow(non_camel_case_types)]
1471 struct DoActionSvc<T: FlightService>(pub Arc<T>);
1472 impl<
1473 T: FlightService,
1474 > tonic::server::ServerStreamingService<super::Action>
1475 for DoActionSvc<T> {
1476 type Response = super::Result;
1477 type ResponseStream = T::DoActionStream;
1478 type Future = BoxFuture<
1479 tonic::Response<Self::ResponseStream>,
1480 tonic::Status,
1481 >;
1482 fn call(
1483 &mut self,
1484 request: tonic::Request<super::Action>,
1485 ) -> Self::Future {
1486 let inner = Arc::clone(&self.0);
1487 let fut = async move {
1488 <T as FlightService>::do_action(&inner, request).await
1489 };
1490 Box::pin(fut)
1491 }
1492 }
1493 let accept_compression_encodings = self.accept_compression_encodings;
1494 let send_compression_encodings = self.send_compression_encodings;
1495 let max_decoding_message_size = self.max_decoding_message_size;
1496 let max_encoding_message_size = self.max_encoding_message_size;
1497 let inner = self.inner.clone();
1498 let fut = async move {
1499 let method = DoActionSvc(inner);
1500 let codec = tonic_prost::ProstCodec::default();
1501 let mut grpc = tonic::server::Grpc::new(codec)
1502 .apply_compression_config(
1503 accept_compression_encodings,
1504 send_compression_encodings,
1505 )
1506 .apply_max_message_size_config(
1507 max_decoding_message_size,
1508 max_encoding_message_size,
1509 );
1510 let res = grpc.server_streaming(method, req).await;
1511 Ok(res)
1512 };
1513 Box::pin(fut)
1514 }
1515 "/arrow.flight.protocol.FlightService/ListActions" => {
1516 #[allow(non_camel_case_types)]
1517 struct ListActionsSvc<T: FlightService>(pub Arc<T>);
1518 impl<
1519 T: FlightService,
1520 > tonic::server::ServerStreamingService<super::Empty>
1521 for ListActionsSvc<T> {
1522 type Response = super::ActionType;
1523 type ResponseStream = T::ListActionsStream;
1524 type Future = BoxFuture<
1525 tonic::Response<Self::ResponseStream>,
1526 tonic::Status,
1527 >;
1528 fn call(
1529 &mut self,
1530 request: tonic::Request<super::Empty>,
1531 ) -> Self::Future {
1532 let inner = Arc::clone(&self.0);
1533 let fut = async move {
1534 <T as FlightService>::list_actions(&inner, request).await
1535 };
1536 Box::pin(fut)
1537 }
1538 }
1539 let accept_compression_encodings = self.accept_compression_encodings;
1540 let send_compression_encodings = self.send_compression_encodings;
1541 let max_decoding_message_size = self.max_decoding_message_size;
1542 let max_encoding_message_size = self.max_encoding_message_size;
1543 let inner = self.inner.clone();
1544 let fut = async move {
1545 let method = ListActionsSvc(inner);
1546 let codec = tonic_prost::ProstCodec::default();
1547 let mut grpc = tonic::server::Grpc::new(codec)
1548 .apply_compression_config(
1549 accept_compression_encodings,
1550 send_compression_encodings,
1551 )
1552 .apply_max_message_size_config(
1553 max_decoding_message_size,
1554 max_encoding_message_size,
1555 );
1556 let res = grpc.server_streaming(method, req).await;
1557 Ok(res)
1558 };
1559 Box::pin(fut)
1560 }
1561 _ => {
1562 Box::pin(async move {
1563 let mut response = http::Response::new(
1564 tonic::body::Body::default(),
1565 );
1566 let headers = response.headers_mut();
1567 headers
1568 .insert(
1569 tonic::Status::GRPC_STATUS,
1570 (tonic::Code::Unimplemented as i32).into(),
1571 );
1572 headers
1573 .insert(
1574 http::header::CONTENT_TYPE,
1575 tonic::metadata::GRPC_CONTENT_TYPE,
1576 );
1577 Ok(response)
1578 })
1579 }
1580 }
1581 }
1582 }
1583 impl<T> Clone for FlightServiceServer<T> {
1584 fn clone(&self) -> Self {
1585 let inner = self.inner.clone();
1586 Self {
1587 inner,
1588 accept_compression_encodings: self.accept_compression_encodings,
1589 send_compression_encodings: self.send_compression_encodings,
1590 max_decoding_message_size: self.max_decoding_message_size,
1591 max_encoding_message_size: self.max_encoding_message_size,
1592 }
1593 }
1594 }
1595 /// Generated gRPC service name
1596 pub const SERVICE_NAME: &str = "arrow.flight.protocol.FlightService";
1597 impl<T> tonic::server::NamedService for FlightServiceServer<T> {
1598 const NAME: &'static str = SERVICE_NAME;
1599 }
1600}