Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ description = "Unofficial flatbuffers and tonic code of Apache Arrow spec"
[dependencies]
planus = { version = "0.3.1", optional = true }
serde = { version = "1", optional = true, default-features = false, features = ["derive", "std"] }
tonic = { version = "0.7.0", optional = true }
prost = { version = "0.10.0", optional = true }
prost-derive = { version = "0.10.0", optional = true }
tonic = { version = "0.8.0", optional = true }
prost = { version = "0.11.0", optional = true }
prost-derive = { version = "0.11.0", optional = true }

[features]
default = []
Expand Down
29 changes: 21 additions & 8 deletions src/flight/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ pub struct Result {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SchemaResult {
/// The schema of the dataset in its IPC form:
/// 4 bytes - an optional IPC_CONTINUATION_TOKEN prefix
/// 4 bytes - the byte length of the payload
/// a flatbuffer Message whose header is the Schema
/// 4 bytes - an optional IPC_CONTINUATION_TOKEN prefix
/// 4 bytes - the byte length of the payload
/// a flatbuffer Message whose header is the Schema
#[prost(bytes = "vec", tag = "1")]
pub schema: ::prost::alloc::vec::Vec<u8>,
}
Expand Down Expand Up @@ -111,22 +111,35 @@ pub mod flight_descriptor {
///
/// A named path that identifies a dataset. A path is composed of a string
/// or list of strings describing a particular dataset. This is conceptually
/// similar to a path inside a filesystem.
/// similar to a path inside a filesystem.
Path = 1,
///
/// An opaque command to generate a dataset.
Cmd = 2,
}
impl DescriptorType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
DescriptorType::Unknown => "UNKNOWN",
DescriptorType::Path => "PATH",
DescriptorType::Cmd => "CMD",
}
}
}
}
///
/// The access coordinates for retrieval of a dataset. With a FlightInfo, a
/// consumer is able to determine how to retrieve a dataset.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FlightInfo {
/// The schema of the dataset in its IPC form:
/// 4 bytes - an optional IPC_CONTINUATION_TOKEN prefix
/// 4 bytes - the byte length of the payload
/// a flatbuffer Message whose header is the Schema
/// 4 bytes - an optional IPC_CONTINUATION_TOKEN prefix
/// 4 bytes - the byte length of the payload
/// a flatbuffer Message whose header is the Schema
#[prost(bytes = "vec", tag = "1")]
pub schema: ::prost::alloc::vec::Vec<u8>,
///
Expand Down Expand Up @@ -221,7 +234,7 @@ pub struct FlightData {
#[prost(bytes = "vec", tag = "1000")]
pub data_body: ::prost::alloc::vec::Vec<u8>,
}
///*
/// *
/// The response message associated with the submission of a DoPut.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PutResult {
Expand Down
35 changes: 26 additions & 9 deletions src/flight/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use super::data::*;
/// Generated client implementations.
pub mod flight_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
///
/// A flight service is an endpoint for retrieving or storing Arrow data. A
Expand Down Expand Up @@ -35,6 +36,10 @@ pub mod flight_service_client {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
Expand All @@ -53,19 +58,19 @@ pub mod flight_service_client {
{
FlightServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with `gzip`.
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses with `gzip`.
/// Enable decompressing responses.
#[must_use]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
///
Expand Down Expand Up @@ -427,8 +432,8 @@ pub mod flight_service_server {
#[derive(Debug)]
pub struct FlightServiceServer<T: FlightService> {
inner: _Inner<T>,
accept_compression_encodings: (),
send_compression_encodings: (),
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
}
struct _Inner<T>(Arc<T>);
impl<T: FlightService> FlightServiceServer<T> {
Expand All @@ -449,6 +454,18 @@ pub mod flight_service_server {
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for FlightServiceServer<T>
where
Expand Down Expand Up @@ -786,7 +803,7 @@ pub mod flight_service_server {
write!(f, "{:?}", self.0)
}
}
impl<T: FlightService> tonic::transport::NamedService for FlightServiceServer<T> {
impl<T: FlightService> tonic::server::NamedService for FlightServiceServer<T> {
const NAME: &'static str = "arrow.flight.protocol.FlightService";
}
}