You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ra...@apache.org on 2025/05/29 08:36:25 UTC
(arrow-swift) 07/47: GH-36546: [Swift] The initial implementation for swift arrow flight (#36547)
This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-swift.git
commit ce97998c203fbf114d534856b9a36794804218e4
Author: abandy <ab...@live.com>
AuthorDate: Wed Jul 19 19:55:47 2023 -0400
GH-36546: [Swift] The initial implementation for swift arrow flight (#36547)
The initial implementation for swift arrow flight.
This change depends on PR GH-36544.
* Closes: #36546
Authored-by: Alva Bandy <ab...@live.com>
Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
ArrowFlight/.gitignore | 9 +
ArrowFlight/Package.swift | 53 +
ArrowFlight/Sources/ArrowFlight/Flight.grpc.swift | 1343 +++++++++++++++++++
ArrowFlight/Sources/ArrowFlight/Flight.pb.swift | 1366 ++++++++++++++++++++
ArrowFlight/Sources/ArrowFlight/FlightAction.swift | 39 +
.../Sources/ArrowFlight/FlightActionType.swift | 38 +
ArrowFlight/Sources/ArrowFlight/FlightClient.swift | 144 +++
.../Sources/ArrowFlight/FlightCriteria.swift | 37 +
ArrowFlight/Sources/ArrowFlight/FlightData.swift | 46 +
.../Sources/ArrowFlight/FlightDescriptor.swift | 56 +
.../Sources/ArrowFlight/FlightEndpoint.swift | 38 +
ArrowFlight/Sources/ArrowFlight/FlightInfo.swift | 55 +
.../Sources/ArrowFlight/FlightLocation.swift | 36 +
.../Sources/ArrowFlight/FlightPutResult.swift | 35 +
ArrowFlight/Sources/ArrowFlight/FlightResult.swift | 35 +
.../Sources/ArrowFlight/FlightSchemaResult.swift | 37 +
ArrowFlight/Sources/ArrowFlight/FlightServer.swift | 162 +++
ArrowFlight/Sources/ArrowFlight/FlightTicket.swift | 35 +
.../ArrowFlight/RecordBatchStreamReader.swift | 67 +
.../ArrowFlight/RecordBatchStreamWriter.swift | 91 ++
.../Tests/ArrowFlightTests/FlightTest.swift | 302 +++++
gen-protobuffers.sh | 44 +
22 files changed, 4068 insertions(+)
diff --git a/ArrowFlight/.gitignore b/ArrowFlight/.gitignore
new file mode 100644
index 0000000..d561187
--- /dev/null
+++ b/ArrowFlight/.gitignore
@@ -0,0 +1,9 @@
+.DS_Store
+/.build
+/Packages
+/*.xcodeproj
+xcuserdata/
+DerivedData/
+.swiftpm/
+.netrc
+Package.resolved
\ No newline at end of file
diff --git a/ArrowFlight/Package.swift b/ArrowFlight/Package.swift
new file mode 100644
index 0000000..f3caa83
--- /dev/null
+++ b/ArrowFlight/Package.swift
@@ -0,0 +1,53 @@
+// swift-tools-version:5.7
+// The swift-tools-version declares the minimum version of Swift required to build this package.
+
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import PackageDescription
+
+let package = Package(
+ name: "ArrowFlight",
+ platforms: [
+ .macOS(.v10_15)
+ ],
+ products: [
+ // Products define the executables and libraries a package produces, making them visible to other packages.
+ .library(
+ name: "ArrowFlight",
+ targets: ["ArrowFlight"]),
+ ],
+ dependencies: [
+ .package(url: "https://github.com/grpc/grpc-swift.git", from: "1.15.0"),
+ .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.6.0"),
+ .package(path: "../Arrow")
+ ],
+ targets: [
+ // Targets are the basic building blocks of a package, defining a module or a test suite.
+ // Targets can depend on other targets in this package and products from dependencies.
+ .target(
+ name: "ArrowFlight",
+ dependencies: [
+ .product(name: "Arrow", package: "Arrow"),
+ .product(name: "GRPC", package: "grpc-swift"),
+ .product(name: "SwiftProtobuf", package: "swift-protobuf")
+ ]),
+ .testTarget(
+ name: "ArrowFlightTests",
+ dependencies: ["ArrowFlight"]),
+ ]
+)
diff --git a/ArrowFlight/Sources/ArrowFlight/Flight.grpc.swift b/ArrowFlight/Sources/ArrowFlight/Flight.grpc.swift
new file mode 100644
index 0000000..8daaa19
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/Flight.grpc.swift
@@ -0,0 +1,1343 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// DO NOT EDIT.
+// swift-format-ignore-file
+//
+// Generated by the protocol buffer compiler.
+// Source: Flight.proto
+//
+import GRPC
+import NIO
+import NIOConcurrencyHelpers
+import SwiftProtobuf
+
+
+///
+/// A flight service is an endpoint for retrieving or storing Arrow data. A
+/// flight service can expose one or more predefined endpoints that can be
+/// accessed using the Arrow Flight Protocol. Additionally, a flight service
+/// can expose a set of actions that are available.
+///
+/// Usage: instantiate `Arrow_Flight_Protocol_FlightServiceClient`, then call methods of this protocol to make API calls.
+internal protocol Arrow_Flight_Protocol_FlightServiceClientProtocol: GRPCClient {
+ var serviceName: String { get }
+ var interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol? { get }
+
+ func handshake(
+ callOptions: CallOptions?,
+ handler: @escaping (Arrow_Flight_Protocol_HandshakeResponse) -> Void
+ ) -> BidirectionalStreamingCall<Arrow_Flight_Protocol_HandshakeRequest, Arrow_Flight_Protocol_HandshakeResponse>
+
+ func listFlights(
+ _ request: Arrow_Flight_Protocol_Criteria,
+ callOptions: CallOptions?,
+ handler: @escaping (Arrow_Flight_Protocol_FlightInfo) -> Void
+ ) -> ServerStreamingCall<Arrow_Flight_Protocol_Criteria, Arrow_Flight_Protocol_FlightInfo>
+
+ func getFlightInfo(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions?
+ ) -> UnaryCall<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_FlightInfo>
+
+ func getSchema(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions?
+ ) -> UnaryCall<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_SchemaResult>
+
+ func doGet(
+ _ request: Arrow_Flight_Protocol_Ticket,
+ callOptions: CallOptions?,
+ handler: @escaping (Arrow_Flight_Protocol_FlightData) -> Void
+ ) -> ServerStreamingCall<Arrow_Flight_Protocol_Ticket, Arrow_Flight_Protocol_FlightData>
+
+ func doPut(
+ callOptions: CallOptions?,
+ handler: @escaping (Arrow_Flight_Protocol_PutResult) -> Void
+ ) -> BidirectionalStreamingCall<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_PutResult>
+
+ func doExchange(
+ callOptions: CallOptions?,
+ handler: @escaping (Arrow_Flight_Protocol_FlightData) -> Void
+ ) -> BidirectionalStreamingCall<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_FlightData>
+
+ func doAction(
+ _ request: Arrow_Flight_Protocol_Action,
+ callOptions: CallOptions?,
+ handler: @escaping (Arrow_Flight_Protocol_Result) -> Void
+ ) -> ServerStreamingCall<Arrow_Flight_Protocol_Action, Arrow_Flight_Protocol_Result>
+
+ func listActions(
+ _ request: Arrow_Flight_Protocol_Empty,
+ callOptions: CallOptions?,
+ handler: @escaping (Arrow_Flight_Protocol_ActionType) -> Void
+ ) -> ServerStreamingCall<Arrow_Flight_Protocol_Empty, Arrow_Flight_Protocol_ActionType>
+}
+
+extension Arrow_Flight_Protocol_FlightServiceClientProtocol {
+ internal var serviceName: String {
+ return "arrow.flight.protocol.FlightService"
+ }
+
+ ///
+ /// Handshake between client and server. Depending on the server, the
+ /// handshake may be required to determine the token that should be used for
+ /// future operations. Both request and response are streams to allow multiple
+ /// round-trips depending on auth mechanism.
+ ///
+ /// Callers should use the `send` method on the returned object to send messages
+ /// to the server. The caller should send an `.end` after the final message has been sent.
+ ///
+ /// - Parameters:
+ /// - callOptions: Call options.
+ /// - handler: A closure called when each response is received from the server.
+ /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
+ internal func handshake(
+ callOptions: CallOptions? = nil,
+ handler: @escaping (Arrow_Flight_Protocol_HandshakeResponse) -> Void
+ ) -> BidirectionalStreamingCall<Arrow_Flight_Protocol_HandshakeRequest, Arrow_Flight_Protocol_HandshakeResponse> {
+ return self.makeBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.handshake.path,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeHandshakeInterceptors() ?? [],
+ handler: handler
+ )
+ }
+
+ ///
+ /// Get a list of available streams given a particular criteria. Most flight
+ /// services will expose one or more streams that are readily available for
+ /// retrieval. This api allows listing the streams available for
+ /// consumption. A user can also provide a criteria. The criteria can limit
+ /// the subset of streams that can be listed via this interface. Each flight
+ /// service allows its own definition of how to consume criteria.
+ ///
+ /// - Parameters:
+ /// - request: Request to send to ListFlights.
+ /// - callOptions: Call options.
+ /// - handler: A closure called when each response is received from the server.
+ /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
+ internal func listFlights(
+ _ request: Arrow_Flight_Protocol_Criteria,
+ callOptions: CallOptions? = nil,
+ handler: @escaping (Arrow_Flight_Protocol_FlightInfo) -> Void
+ ) -> ServerStreamingCall<Arrow_Flight_Protocol_Criteria, Arrow_Flight_Protocol_FlightInfo> {
+ return self.makeServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.listFlights.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeListFlightsInterceptors() ?? [],
+ handler: handler
+ )
+ }
+
+ ///
+ /// For a given FlightDescriptor, get information about how the flight can be
+ /// consumed. This is a useful interface if the consumer of the interface
+ /// already can identify the specific flight to consume. This interface can
+ /// also allow a consumer to generate a flight stream through a specified
+ /// descriptor. For example, a flight descriptor might be something that
+ /// includes a SQL statement or a Pickled Python operation that will be
+ /// executed. In those cases, the descriptor will not be previously available
+ /// within the list of available streams provided by ListFlights but will be
+ /// available for consumption for the duration defined by the specific flight
+ /// service.
+ ///
+ /// - Parameters:
+ /// - request: Request to send to GetFlightInfo.
+ /// - callOptions: Call options.
+ /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
+ internal func getFlightInfo(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions? = nil
+ ) -> UnaryCall<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_FlightInfo> {
+ return self.makeUnaryCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.getFlightInfo.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeGetFlightInfoInterceptors() ?? []
+ )
+ }
+
+ ///
+ /// For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
+ /// This is used when a consumer needs the Schema of flight stream. Similar to
+ /// GetFlightInfo this interface may generate a new flight that was not previously
+ /// available in ListFlights.
+ ///
+ /// - Parameters:
+ /// - request: Request to send to GetSchema.
+ /// - callOptions: Call options.
+ /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
+ internal func getSchema(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions? = nil
+ ) -> UnaryCall<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_SchemaResult> {
+ return self.makeUnaryCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.getSchema.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeGetSchemaInterceptors() ?? []
+ )
+ }
+
+ ///
+ /// Retrieve a single stream associated with a particular descriptor
+ /// associated with the referenced ticket. A Flight can be composed of one or
+ /// more streams where each stream can be retrieved using a separate opaque
+ /// ticket that the flight service uses for managing a collection of streams.
+ ///
+ /// - Parameters:
+ /// - request: Request to send to DoGet.
+ /// - callOptions: Call options.
+ /// - handler: A closure called when each response is received from the server.
+ /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
+ internal func doGet(
+ _ request: Arrow_Flight_Protocol_Ticket,
+ callOptions: CallOptions? = nil,
+ handler: @escaping (Arrow_Flight_Protocol_FlightData) -> Void
+ ) -> ServerStreamingCall<Arrow_Flight_Protocol_Ticket, Arrow_Flight_Protocol_FlightData> {
+ return self.makeServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doGet.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoGetInterceptors() ?? [],
+ handler: handler
+ )
+ }
+
+ ///
+ /// Push a stream to the flight service associated with a particular
+ /// flight stream. This allows a client of a flight service to upload a stream
+ /// of data. Depending on the particular flight service, a client consumer
+ /// could be allowed to upload a single stream per descriptor or an unlimited
+ /// number. In the latter, the service might implement a 'seal' action that
+ /// can be applied to a descriptor once all streams are uploaded.
+ ///
+ /// Callers should use the `send` method on the returned object to send messages
+ /// to the server. The caller should send an `.end` after the final message has been sent.
+ ///
+ /// - Parameters:
+ /// - callOptions: Call options.
+ /// - handler: A closure called when each response is received from the server.
+ /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
+ internal func doPut(
+ callOptions: CallOptions? = nil,
+ handler: @escaping (Arrow_Flight_Protocol_PutResult) -> Void
+ ) -> BidirectionalStreamingCall<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_PutResult> {
+ return self.makeBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doPut.path,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoPutInterceptors() ?? [],
+ handler: handler
+ )
+ }
+
+ ///
+ /// Open a bidirectional data channel for a given descriptor. This
+ /// allows clients to send and receive arbitrary Arrow data and
+ /// application-specific metadata in a single logical stream. In
+ /// contrast to DoGet/DoPut, this is more suited for clients
+ /// offloading computation (rather than storage) to a Flight service.
+ ///
+ /// Callers should use the `send` method on the returned object to send messages
+ /// to the server. The caller should send an `.end` after the final message has been sent.
+ ///
+ /// - Parameters:
+ /// - callOptions: Call options.
+ /// - handler: A closure called when each response is received from the server.
+ /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
+ internal func doExchange(
+ callOptions: CallOptions? = nil,
+ handler: @escaping (Arrow_Flight_Protocol_FlightData) -> Void
+ ) -> BidirectionalStreamingCall<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_FlightData> {
+ return self.makeBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doExchange.path,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoExchangeInterceptors() ?? [],
+ handler: handler
+ )
+ }
+
+ ///
+ /// Flight services can support an arbitrary number of simple actions in
+ /// addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
+ /// operations that are potentially available. DoAction allows a flight client
+ /// to do a specific action against a flight service. An action includes
+ /// opaque request and response objects that are specific to the type action
+ /// being undertaken.
+ ///
+ /// - Parameters:
+ /// - request: Request to send to DoAction.
+ /// - callOptions: Call options.
+ /// - handler: A closure called when each response is received from the server.
+ /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
+ internal func doAction(
+ _ request: Arrow_Flight_Protocol_Action,
+ callOptions: CallOptions? = nil,
+ handler: @escaping (Arrow_Flight_Protocol_Result) -> Void
+ ) -> ServerStreamingCall<Arrow_Flight_Protocol_Action, Arrow_Flight_Protocol_Result> {
+ return self.makeServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doAction.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoActionInterceptors() ?? [],
+ handler: handler
+ )
+ }
+
+ ///
+ /// A flight service exposes all of the available action types that it has
+ /// along with descriptions. This allows different flight consumers to
+ /// understand the capabilities of the flight service.
+ ///
+ /// - Parameters:
+ /// - request: Request to send to ListActions.
+ /// - callOptions: Call options.
+ /// - handler: A closure called when each response is received from the server.
+ /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
+ internal func listActions(
+ _ request: Arrow_Flight_Protocol_Empty,
+ callOptions: CallOptions? = nil,
+ handler: @escaping (Arrow_Flight_Protocol_ActionType) -> Void
+ ) -> ServerStreamingCall<Arrow_Flight_Protocol_Empty, Arrow_Flight_Protocol_ActionType> {
+ return self.makeServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.listActions.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeListActionsInterceptors() ?? [],
+ handler: handler
+ )
+ }
+}
+
+@available(*, deprecated)
+extension Arrow_Flight_Protocol_FlightServiceClient: @unchecked Sendable {}
+
+@available(*, deprecated, renamed: "Arrow_Flight_Protocol_FlightServiceNIOClient")
+internal final class Arrow_Flight_Protocol_FlightServiceClient: Arrow_Flight_Protocol_FlightServiceClientProtocol {
+ private let lock = Lock()
+ private var _defaultCallOptions: CallOptions
+ private var _interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol?
+ internal let channel: GRPCChannel
+ internal var defaultCallOptions: CallOptions {
+ get { self.lock.withLock { return self._defaultCallOptions } }
+ set { self.lock.withLockVoid { self._defaultCallOptions = newValue } }
+ }
+ internal var interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol? {
+ get { self.lock.withLock { return self._interceptors } }
+ set { self.lock.withLockVoid { self._interceptors = newValue } }
+ }
+
+ /// Creates a client for the arrow.flight.protocol.FlightService service.
+ ///
+ /// - Parameters:
+ /// - channel: `GRPCChannel` to the service host.
+ /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
+ /// - interceptors: A factory providing interceptors for each RPC.
+ internal init(
+ channel: GRPCChannel,
+ defaultCallOptions: CallOptions = CallOptions(),
+ interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol? = nil
+ ) {
+ self.channel = channel
+ self._defaultCallOptions = defaultCallOptions
+ self._interceptors = interceptors
+ }
+}
+
+internal struct Arrow_Flight_Protocol_FlightServiceNIOClient: Arrow_Flight_Protocol_FlightServiceClientProtocol {
+ internal var channel: GRPCChannel
+ internal var defaultCallOptions: CallOptions
+ internal var interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol?
+
+ /// Creates a client for the arrow.flight.protocol.FlightService service.
+ ///
+ /// - Parameters:
+ /// - channel: `GRPCChannel` to the service host.
+ /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
+ /// - interceptors: A factory providing interceptors for each RPC.
+ internal init(
+ channel: GRPCChannel,
+ defaultCallOptions: CallOptions = CallOptions(),
+ interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol? = nil
+ ) {
+ self.channel = channel
+ self.defaultCallOptions = defaultCallOptions
+ self.interceptors = interceptors
+ }
+}
+
+///
+/// A flight service is an endpoint for retrieving or storing Arrow data. A
+/// flight service can expose one or more predefined endpoints that can be
+/// accessed using the Arrow Flight Protocol. Additionally, a flight service
+/// can expose a set of actions that are available.
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
+internal protocol Arrow_Flight_Protocol_FlightServiceAsyncClientProtocol: GRPCClient {
+ static var serviceDescriptor: GRPCServiceDescriptor { get }
+ var interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol? { get }
+
+ func makeHandshakeCall(
+ callOptions: CallOptions?
+ ) -> GRPCAsyncBidirectionalStreamingCall<Arrow_Flight_Protocol_HandshakeRequest, Arrow_Flight_Protocol_HandshakeResponse>
+
+ func makeListFlightsCall(
+ _ request: Arrow_Flight_Protocol_Criteria,
+ callOptions: CallOptions?
+ ) -> GRPCAsyncServerStreamingCall<Arrow_Flight_Protocol_Criteria, Arrow_Flight_Protocol_FlightInfo>
+
+ func makeGetFlightInfoCall(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions?
+ ) -> GRPCAsyncUnaryCall<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_FlightInfo>
+
+ func makeGetSchemaCall(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions?
+ ) -> GRPCAsyncUnaryCall<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_SchemaResult>
+
+ func makeDoGetCall(
+ _ request: Arrow_Flight_Protocol_Ticket,
+ callOptions: CallOptions?
+ ) -> GRPCAsyncServerStreamingCall<Arrow_Flight_Protocol_Ticket, Arrow_Flight_Protocol_FlightData>
+
+ func makeDoPutCall(
+ callOptions: CallOptions?
+ ) -> GRPCAsyncBidirectionalStreamingCall<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_PutResult>
+
+ func makeDoExchangeCall(
+ callOptions: CallOptions?
+ ) -> GRPCAsyncBidirectionalStreamingCall<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_FlightData>
+
+ func makeDoActionCall(
+ _ request: Arrow_Flight_Protocol_Action,
+ callOptions: CallOptions?
+ ) -> GRPCAsyncServerStreamingCall<Arrow_Flight_Protocol_Action, Arrow_Flight_Protocol_Result>
+
+ func makeListActionsCall(
+ _ request: Arrow_Flight_Protocol_Empty,
+ callOptions: CallOptions?
+ ) -> GRPCAsyncServerStreamingCall<Arrow_Flight_Protocol_Empty, Arrow_Flight_Protocol_ActionType>
+}
+
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
+extension Arrow_Flight_Protocol_FlightServiceAsyncClientProtocol {
+ internal static var serviceDescriptor: GRPCServiceDescriptor {
+ return Arrow_Flight_Protocol_FlightServiceClientMetadata.serviceDescriptor
+ }
+
+ internal var interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol? {
+ return nil
+ }
+
+ internal func makeHandshakeCall(
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncBidirectionalStreamingCall<Arrow_Flight_Protocol_HandshakeRequest, Arrow_Flight_Protocol_HandshakeResponse> {
+ return self.makeAsyncBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.handshake.path,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeHandshakeInterceptors() ?? []
+ )
+ }
+
+ internal func makeListFlightsCall(
+ _ request: Arrow_Flight_Protocol_Criteria,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncServerStreamingCall<Arrow_Flight_Protocol_Criteria, Arrow_Flight_Protocol_FlightInfo> {
+ return self.makeAsyncServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.listFlights.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeListFlightsInterceptors() ?? []
+ )
+ }
+
+ internal func makeGetFlightInfoCall(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncUnaryCall<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_FlightInfo> {
+ return self.makeAsyncUnaryCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.getFlightInfo.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeGetFlightInfoInterceptors() ?? []
+ )
+ }
+
+ internal func makeGetSchemaCall(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncUnaryCall<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_SchemaResult> {
+ return self.makeAsyncUnaryCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.getSchema.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeGetSchemaInterceptors() ?? []
+ )
+ }
+
+ internal func makeDoGetCall(
+ _ request: Arrow_Flight_Protocol_Ticket,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncServerStreamingCall<Arrow_Flight_Protocol_Ticket, Arrow_Flight_Protocol_FlightData> {
+ return self.makeAsyncServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doGet.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoGetInterceptors() ?? []
+ )
+ }
+
+ internal func makeDoPutCall(
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncBidirectionalStreamingCall<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_PutResult> {
+ return self.makeAsyncBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doPut.path,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoPutInterceptors() ?? []
+ )
+ }
+
+ internal func makeDoExchangeCall(
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncBidirectionalStreamingCall<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_FlightData> {
+ return self.makeAsyncBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doExchange.path,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoExchangeInterceptors() ?? []
+ )
+ }
+
+ internal func makeDoActionCall(
+ _ request: Arrow_Flight_Protocol_Action,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncServerStreamingCall<Arrow_Flight_Protocol_Action, Arrow_Flight_Protocol_Result> {
+ return self.makeAsyncServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doAction.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoActionInterceptors() ?? []
+ )
+ }
+
+ internal func makeListActionsCall(
+ _ request: Arrow_Flight_Protocol_Empty,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncServerStreamingCall<Arrow_Flight_Protocol_Empty, Arrow_Flight_Protocol_ActionType> {
+ return self.makeAsyncServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.listActions.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeListActionsInterceptors() ?? []
+ )
+ }
+}
+
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
+extension Arrow_Flight_Protocol_FlightServiceAsyncClientProtocol {
+ internal func handshake<RequestStream>(
+ _ requests: RequestStream,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_HandshakeResponse> where RequestStream: Sequence, RequestStream.Element == Arrow_Flight_Protocol_HandshakeRequest {
+ return self.performAsyncBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.handshake.path,
+ requests: requests,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeHandshakeInterceptors() ?? []
+ )
+ }
+
+ internal func handshake<RequestStream>(
+ _ requests: RequestStream,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_HandshakeResponse> where RequestStream: AsyncSequence & Sendable, RequestStream.Element == Arrow_Flight_Protocol_HandshakeRequest {
+ return self.performAsyncBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.handshake.path,
+ requests: requests,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeHandshakeInterceptors() ?? []
+ )
+ }
+
+ internal func listFlights(
+ _ request: Arrow_Flight_Protocol_Criteria,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_FlightInfo> {
+ return self.performAsyncServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.listFlights.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeListFlightsInterceptors() ?? []
+ )
+ }
+
+ internal func getFlightInfo(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions? = nil
+ ) async throws -> Arrow_Flight_Protocol_FlightInfo {
+ return try await self.performAsyncUnaryCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.getFlightInfo.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeGetFlightInfoInterceptors() ?? []
+ )
+ }
+
+ internal func getSchema(
+ _ request: Arrow_Flight_Protocol_FlightDescriptor,
+ callOptions: CallOptions? = nil
+ ) async throws -> Arrow_Flight_Protocol_SchemaResult {
+ return try await self.performAsyncUnaryCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.getSchema.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeGetSchemaInterceptors() ?? []
+ )
+ }
+
+ internal func doGet(
+ _ request: Arrow_Flight_Protocol_Ticket,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_FlightData> {
+ return self.performAsyncServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doGet.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoGetInterceptors() ?? []
+ )
+ }
+
+ internal func doPut<RequestStream>(
+ _ requests: RequestStream,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_PutResult> where RequestStream: Sequence, RequestStream.Element == Arrow_Flight_Protocol_FlightData {
+ return self.performAsyncBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doPut.path,
+ requests: requests,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoPutInterceptors() ?? []
+ )
+ }
+
+ internal func doPut<RequestStream>(
+ _ requests: RequestStream,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_PutResult> where RequestStream: AsyncSequence & Sendable, RequestStream.Element == Arrow_Flight_Protocol_FlightData {
+ return self.performAsyncBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doPut.path,
+ requests: requests,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoPutInterceptors() ?? []
+ )
+ }
+
+ internal func doExchange<RequestStream>(
+ _ requests: RequestStream,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_FlightData> where RequestStream: Sequence, RequestStream.Element == Arrow_Flight_Protocol_FlightData {
+ return self.performAsyncBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doExchange.path,
+ requests: requests,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoExchangeInterceptors() ?? []
+ )
+ }
+
+ internal func doExchange<RequestStream>(
+ _ requests: RequestStream,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_FlightData> where RequestStream: AsyncSequence & Sendable, RequestStream.Element == Arrow_Flight_Protocol_FlightData {
+ return self.performAsyncBidirectionalStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doExchange.path,
+ requests: requests,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoExchangeInterceptors() ?? []
+ )
+ }
+
+ internal func doAction(
+ _ request: Arrow_Flight_Protocol_Action,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_Result> {
+ return self.performAsyncServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doAction.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeDoActionInterceptors() ?? []
+ )
+ }
+
+ internal func listActions(
+ _ request: Arrow_Flight_Protocol_Empty,
+ callOptions: CallOptions? = nil
+ ) -> GRPCAsyncResponseStream<Arrow_Flight_Protocol_ActionType> {
+ return self.performAsyncServerStreamingCall(
+ path: Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.listActions.path,
+ request: request,
+ callOptions: callOptions ?? self.defaultCallOptions,
+ interceptors: self.interceptors?.makeListActionsInterceptors() ?? []
+ )
+ }
+}
+
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
+internal struct Arrow_Flight_Protocol_FlightServiceAsyncClient: Arrow_Flight_Protocol_FlightServiceAsyncClientProtocol {
+ internal var channel: GRPCChannel
+ internal var defaultCallOptions: CallOptions
+ internal var interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol?
+
+ internal init(
+ channel: GRPCChannel,
+ defaultCallOptions: CallOptions = CallOptions(),
+ interceptors: Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol? = nil
+ ) {
+ self.channel = channel
+ self.defaultCallOptions = defaultCallOptions
+ self.interceptors = interceptors
+ }
+}
+
+internal protocol Arrow_Flight_Protocol_FlightServiceClientInterceptorFactoryProtocol: Sendable {
+
+ /// - Returns: Interceptors to use when invoking 'handshake'.
+ func makeHandshakeInterceptors() -> [ClientInterceptor<Arrow_Flight_Protocol_HandshakeRequest, Arrow_Flight_Protocol_HandshakeResponse>]
+
+ /// - Returns: Interceptors to use when invoking 'listFlights'.
+ func makeListFlightsInterceptors() -> [ClientInterceptor<Arrow_Flight_Protocol_Criteria, Arrow_Flight_Protocol_FlightInfo>]
+
+ /// - Returns: Interceptors to use when invoking 'getFlightInfo'.
+ func makeGetFlightInfoInterceptors() -> [ClientInterceptor<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_FlightInfo>]
+
+ /// - Returns: Interceptors to use when invoking 'getSchema'.
+ func makeGetSchemaInterceptors() -> [ClientInterceptor<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_SchemaResult>]
+
+ /// - Returns: Interceptors to use when invoking 'doGet'.
+ func makeDoGetInterceptors() -> [ClientInterceptor<Arrow_Flight_Protocol_Ticket, Arrow_Flight_Protocol_FlightData>]
+
+ /// - Returns: Interceptors to use when invoking 'doPut'.
+ func makeDoPutInterceptors() -> [ClientInterceptor<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_PutResult>]
+
+ /// - Returns: Interceptors to use when invoking 'doExchange'.
+ func makeDoExchangeInterceptors() -> [ClientInterceptor<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_FlightData>]
+
+ /// - Returns: Interceptors to use when invoking 'doAction'.
+ func makeDoActionInterceptors() -> [ClientInterceptor<Arrow_Flight_Protocol_Action, Arrow_Flight_Protocol_Result>]
+
+ /// - Returns: Interceptors to use when invoking 'listActions'.
+ func makeListActionsInterceptors() -> [ClientInterceptor<Arrow_Flight_Protocol_Empty, Arrow_Flight_Protocol_ActionType>]
+}
+
+internal enum Arrow_Flight_Protocol_FlightServiceClientMetadata {
+ internal static let serviceDescriptor = GRPCServiceDescriptor(
+ name: "FlightService",
+ fullName: "arrow.flight.protocol.FlightService",
+ methods: [
+ Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.handshake,
+ Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.listFlights,
+ Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.getFlightInfo,
+ Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.getSchema,
+ Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doGet,
+ Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doPut,
+ Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doExchange,
+ Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.doAction,
+ Arrow_Flight_Protocol_FlightServiceClientMetadata.Methods.listActions,
+ ]
+ )
+
+ internal enum Methods {
+ internal static let handshake = GRPCMethodDescriptor(
+ name: "Handshake",
+ path: "/arrow.flight.protocol.FlightService/Handshake",
+ type: GRPCCallType.bidirectionalStreaming
+ )
+
+ internal static let listFlights = GRPCMethodDescriptor(
+ name: "ListFlights",
+ path: "/arrow.flight.protocol.FlightService/ListFlights",
+ type: GRPCCallType.serverStreaming
+ )
+
+ internal static let getFlightInfo = GRPCMethodDescriptor(
+ name: "GetFlightInfo",
+ path: "/arrow.flight.protocol.FlightService/GetFlightInfo",
+ type: GRPCCallType.unary
+ )
+
+ internal static let getSchema = GRPCMethodDescriptor(
+ name: "GetSchema",
+ path: "/arrow.flight.protocol.FlightService/GetSchema",
+ type: GRPCCallType.unary
+ )
+
+ internal static let doGet = GRPCMethodDescriptor(
+ name: "DoGet",
+ path: "/arrow.flight.protocol.FlightService/DoGet",
+ type: GRPCCallType.serverStreaming
+ )
+
+ internal static let doPut = GRPCMethodDescriptor(
+ name: "DoPut",
+ path: "/arrow.flight.protocol.FlightService/DoPut",
+ type: GRPCCallType.bidirectionalStreaming
+ )
+
+ internal static let doExchange = GRPCMethodDescriptor(
+ name: "DoExchange",
+ path: "/arrow.flight.protocol.FlightService/DoExchange",
+ type: GRPCCallType.bidirectionalStreaming
+ )
+
+ internal static let doAction = GRPCMethodDescriptor(
+ name: "DoAction",
+ path: "/arrow.flight.protocol.FlightService/DoAction",
+ type: GRPCCallType.serverStreaming
+ )
+
+ internal static let listActions = GRPCMethodDescriptor(
+ name: "ListActions",
+ path: "/arrow.flight.protocol.FlightService/ListActions",
+ type: GRPCCallType.serverStreaming
+ )
+ }
+}
+
+///
+/// A flight service is an endpoint for retrieving or storing Arrow data. A
+/// flight service can expose one or more predefined endpoints that can be
+/// accessed using the Arrow Flight Protocol. Additionally, a flight service
+/// can expose a set of actions that are available.
+///
+/// To build a server, implement a class that conforms to this protocol.
+internal protocol Arrow_Flight_Protocol_FlightServiceProvider: CallHandlerProvider {
+ var interceptors: Arrow_Flight_Protocol_FlightServiceServerInterceptorFactoryProtocol? { get }
+
+ ///
+ /// Handshake between client and server. Depending on the server, the
+ /// handshake may be required to determine the token that should be used for
+ /// future operations. Both request and response are streams to allow multiple
+ /// round-trips depending on auth mechanism.
+ func handshake(context: StreamingResponseCallContext<Arrow_Flight_Protocol_HandshakeResponse>) -> EventLoopFuture<(StreamEvent<Arrow_Flight_Protocol_HandshakeRequest>) -> Void>
+
+ ///
+ /// Get a list of available streams given a particular criteria. Most flight
+ /// services will expose one or more streams that are readily available for
+ /// retrieval. This api allows listing the streams available for
+ /// consumption. A user can also provide a criteria. The criteria can limit
+ /// the subset of streams that can be listed via this interface. Each flight
+ /// service allows its own definition of how to consume criteria.
+ func listFlights(request: Arrow_Flight_Protocol_Criteria, context: StreamingResponseCallContext<Arrow_Flight_Protocol_FlightInfo>) -> EventLoopFuture<GRPCStatus>
+
+ ///
+ /// For a given FlightDescriptor, get information about how the flight can be
+ /// consumed. This is a useful interface if the consumer of the interface
+ /// already can identify the specific flight to consume. This interface can
+ /// also allow a consumer to generate a flight stream through a specified
+ /// descriptor. For example, a flight descriptor might be something that
+ /// includes a SQL statement or a Pickled Python operation that will be
+ /// executed. In those cases, the descriptor will not be previously available
+ /// within the list of available streams provided by ListFlights but will be
+ /// available for consumption for the duration defined by the specific flight
+ /// service.
+ func getFlightInfo(request: Arrow_Flight_Protocol_FlightDescriptor, context: StatusOnlyCallContext) -> EventLoopFuture<Arrow_Flight_Protocol_FlightInfo>
+
+ ///
+ /// For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
+ /// This is used when a consumer needs the Schema of flight stream. Similar to
+ /// GetFlightInfo this interface may generate a new flight that was not previously
+ /// available in ListFlights.
+ func getSchema(request: Arrow_Flight_Protocol_FlightDescriptor, context: StatusOnlyCallContext) -> EventLoopFuture<Arrow_Flight_Protocol_SchemaResult>
+
+ ///
+ /// Retrieve a single stream associated with a particular descriptor
+ /// associated with the referenced ticket. A Flight can be composed of one or
+ /// more streams where each stream can be retrieved using a separate opaque
+ /// ticket that the flight service uses for managing a collection of streams.
+ func doGet(request: Arrow_Flight_Protocol_Ticket, context: StreamingResponseCallContext<Arrow_Flight_Protocol_FlightData>) -> EventLoopFuture<GRPCStatus>
+
+ ///
+ /// Push a stream to the flight service associated with a particular
+ /// flight stream. This allows a client of a flight service to upload a stream
+ /// of data. Depending on the particular flight service, a client consumer
+ /// could be allowed to upload a single stream per descriptor or an unlimited
+ /// number. In the latter, the service might implement a 'seal' action that
+ /// can be applied to a descriptor once all streams are uploaded.
+ func doPut(context: StreamingResponseCallContext<Arrow_Flight_Protocol_PutResult>) -> EventLoopFuture<(StreamEvent<Arrow_Flight_Protocol_FlightData>) -> Void>
+
+ ///
+ /// Open a bidirectional data channel for a given descriptor. This
+ /// allows clients to send and receive arbitrary Arrow data and
+ /// application-specific metadata in a single logical stream. In
+ /// contrast to DoGet/DoPut, this is more suited for clients
+ /// offloading computation (rather than storage) to a Flight service.
+ func doExchange(context: StreamingResponseCallContext<Arrow_Flight_Protocol_FlightData>) -> EventLoopFuture<(StreamEvent<Arrow_Flight_Protocol_FlightData>) -> Void>
+
+ ///
+ /// Flight services can support an arbitrary number of simple actions in
+ /// addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
+ /// operations that are potentially available. DoAction allows a flight client
+ /// to do a specific action against a flight service. An action includes
+ /// opaque request and response objects that are specific to the type action
+ /// being undertaken.
+ func doAction(request: Arrow_Flight_Protocol_Action, context: StreamingResponseCallContext<Arrow_Flight_Protocol_Result>) -> EventLoopFuture<GRPCStatus>
+
+ ///
+ /// A flight service exposes all of the available action types that it has
+ /// along with descriptions. This allows different flight consumers to
+ /// understand the capabilities of the flight service.
+ func listActions(request: Arrow_Flight_Protocol_Empty, context: StreamingResponseCallContext<Arrow_Flight_Protocol_ActionType>) -> EventLoopFuture<GRPCStatus>
+}
+
+extension Arrow_Flight_Protocol_FlightServiceProvider {
+ internal var serviceName: Substring {
+ return Arrow_Flight_Protocol_FlightServiceServerMetadata.serviceDescriptor.fullName[...]
+ }
+
+ /// Determines, calls and returns the appropriate request handler, depending on the request's method.
+ /// Returns nil for methods not handled by this service.
+ internal func handle(
+ method name: Substring,
+ context: CallHandlerContext
+ ) -> GRPCServerHandlerProtocol? {
+ switch name {
+ case "Handshake":
+ return BidirectionalStreamingServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_HandshakeRequest>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_HandshakeResponse>(),
+ interceptors: self.interceptors?.makeHandshakeInterceptors() ?? [],
+ observerFactory: self.handshake(context:)
+ )
+
+ case "ListFlights":
+ return ServerStreamingServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_Criteria>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_FlightInfo>(),
+ interceptors: self.interceptors?.makeListFlightsInterceptors() ?? [],
+ userFunction: self.listFlights(request:context:)
+ )
+
+ case "GetFlightInfo":
+ return UnaryServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_FlightDescriptor>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_FlightInfo>(),
+ interceptors: self.interceptors?.makeGetFlightInfoInterceptors() ?? [],
+ userFunction: self.getFlightInfo(request:context:)
+ )
+
+ case "GetSchema":
+ return UnaryServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_FlightDescriptor>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_SchemaResult>(),
+ interceptors: self.interceptors?.makeGetSchemaInterceptors() ?? [],
+ userFunction: self.getSchema(request:context:)
+ )
+
+ case "DoGet":
+ return ServerStreamingServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_Ticket>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_FlightData>(),
+ interceptors: self.interceptors?.makeDoGetInterceptors() ?? [],
+ userFunction: self.doGet(request:context:)
+ )
+
+ case "DoPut":
+ return BidirectionalStreamingServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_FlightData>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_PutResult>(),
+ interceptors: self.interceptors?.makeDoPutInterceptors() ?? [],
+ observerFactory: self.doPut(context:)
+ )
+
+ case "DoExchange":
+ return BidirectionalStreamingServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_FlightData>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_FlightData>(),
+ interceptors: self.interceptors?.makeDoExchangeInterceptors() ?? [],
+ observerFactory: self.doExchange(context:)
+ )
+
+ case "DoAction":
+ return ServerStreamingServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_Action>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_Result>(),
+ interceptors: self.interceptors?.makeDoActionInterceptors() ?? [],
+ userFunction: self.doAction(request:context:)
+ )
+
+ case "ListActions":
+ return ServerStreamingServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_Empty>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_ActionType>(),
+ interceptors: self.interceptors?.makeListActionsInterceptors() ?? [],
+ userFunction: self.listActions(request:context:)
+ )
+
+ default:
+ return nil
+ }
+ }
+}
+
+///
+/// A flight service is an endpoint for retrieving or storing Arrow data. A
+/// flight service can expose one or more predefined endpoints that can be
+/// accessed using the Arrow Flight Protocol. Additionally, a flight service
+/// can expose a set of actions that are available.
+///
+/// To implement a server, implement an object which conforms to this protocol.
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
+internal protocol Arrow_Flight_Protocol_FlightServiceAsyncProvider: CallHandlerProvider, Sendable {
+ static var serviceDescriptor: GRPCServiceDescriptor { get }
+ var interceptors: Arrow_Flight_Protocol_FlightServiceServerInterceptorFactoryProtocol? { get }
+
+ ///
+ /// Handshake between client and server. Depending on the server, the
+ /// handshake may be required to determine the token that should be used for
+ /// future operations. Both request and response are streams to allow multiple
+ /// round-trips depending on auth mechanism.
+ func handshake(
+ requestStream: GRPCAsyncRequestStream<Arrow_Flight_Protocol_HandshakeRequest>,
+ responseStream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_HandshakeResponse>,
+ context: GRPCAsyncServerCallContext
+ ) async throws
+
+ ///
+ /// Get a list of available streams given a particular criteria. Most flight
+ /// services will expose one or more streams that are readily available for
+ /// retrieval. This api allows listing the streams available for
+ /// consumption. A user can also provide a criteria. The criteria can limit
+ /// the subset of streams that can be listed via this interface. Each flight
+ /// service allows its own definition of how to consume criteria.
+ func listFlights(
+ request: Arrow_Flight_Protocol_Criteria,
+ responseStream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightInfo>,
+ context: GRPCAsyncServerCallContext
+ ) async throws
+
+ ///
+ /// For a given FlightDescriptor, get information about how the flight can be
+ /// consumed. This is a useful interface if the consumer of the interface
+ /// already can identify the specific flight to consume. This interface can
+ /// also allow a consumer to generate a flight stream through a specified
+ /// descriptor. For example, a flight descriptor might be something that
+ /// includes a SQL statement or a Pickled Python operation that will be
+ /// executed. In those cases, the descriptor will not be previously available
+ /// within the list of available streams provided by ListFlights but will be
+ /// available for consumption for the duration defined by the specific flight
+ /// service.
+ func getFlightInfo(
+ request: Arrow_Flight_Protocol_FlightDescriptor,
+ context: GRPCAsyncServerCallContext
+ ) async throws -> Arrow_Flight_Protocol_FlightInfo
+
+ ///
+ /// For a given FlightDescriptor, get the Schema as described in Schema.fbs::Schema
+ /// This is used when a consumer needs the Schema of flight stream. Similar to
+ /// GetFlightInfo this interface may generate a new flight that was not previously
+ /// available in ListFlights.
+ func getSchema(
+ request: Arrow_Flight_Protocol_FlightDescriptor,
+ context: GRPCAsyncServerCallContext
+ ) async throws -> Arrow_Flight_Protocol_SchemaResult
+
+ ///
+ /// Retrieve a single stream associated with a particular descriptor
+ /// associated with the referenced ticket. A Flight can be composed of one or
+ /// more streams where each stream can be retrieved using a separate opaque
+ /// ticket that the flight service uses for managing a collection of streams.
+ func doGet(
+ request: Arrow_Flight_Protocol_Ticket,
+ responseStream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightData>,
+ context: GRPCAsyncServerCallContext
+ ) async throws
+
+ ///
+ /// Push a stream to the flight service associated with a particular
+ /// flight stream. This allows a client of a flight service to upload a stream
+ /// of data. Depending on the particular flight service, a client consumer
+ /// could be allowed to upload a single stream per descriptor or an unlimited
+ /// number. In the latter, the service might implement a 'seal' action that
+ /// can be applied to a descriptor once all streams are uploaded.
+ func doPut(
+ requestStream: GRPCAsyncRequestStream<Arrow_Flight_Protocol_FlightData>,
+ responseStream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_PutResult>,
+ context: GRPCAsyncServerCallContext
+ ) async throws
+
+ ///
+ /// Open a bidirectional data channel for a given descriptor. This
+ /// allows clients to send and receive arbitrary Arrow data and
+ /// application-specific metadata in a single logical stream. In
+ /// contrast to DoGet/DoPut, this is more suited for clients
+ /// offloading computation (rather than storage) to a Flight service.
+ func doExchange(
+ requestStream: GRPCAsyncRequestStream<Arrow_Flight_Protocol_FlightData>,
+ responseStream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightData>,
+ context: GRPCAsyncServerCallContext
+ ) async throws
+
+ ///
+ /// Flight services can support an arbitrary number of simple actions in
+ /// addition to the possible ListFlights, GetFlightInfo, DoGet, DoPut
+ /// operations that are potentially available. DoAction allows a flight client
+ /// to do a specific action against a flight service. An action includes
+ /// opaque request and response objects that are specific to the type action
+ /// being undertaken.
+ func doAction(
+ request: Arrow_Flight_Protocol_Action,
+ responseStream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_Result>,
+ context: GRPCAsyncServerCallContext
+ ) async throws
+
+ ///
+ /// A flight service exposes all of the available action types that it has
+ /// along with descriptions. This allows different flight consumers to
+ /// understand the capabilities of the flight service.
+ func listActions(
+ request: Arrow_Flight_Protocol_Empty,
+ responseStream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_ActionType>,
+ context: GRPCAsyncServerCallContext
+ ) async throws
+}
+
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
+extension Arrow_Flight_Protocol_FlightServiceAsyncProvider {
+ internal static var serviceDescriptor: GRPCServiceDescriptor {
+ return Arrow_Flight_Protocol_FlightServiceServerMetadata.serviceDescriptor
+ }
+
+ internal var serviceName: Substring {
+ return Arrow_Flight_Protocol_FlightServiceServerMetadata.serviceDescriptor.fullName[...]
+ }
+
+ internal var interceptors: Arrow_Flight_Protocol_FlightServiceServerInterceptorFactoryProtocol? {
+ return nil
+ }
+
+ internal func handle(
+ method name: Substring,
+ context: CallHandlerContext
+ ) -> GRPCServerHandlerProtocol? {
+ switch name {
+ case "Handshake":
+ return GRPCAsyncServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_HandshakeRequest>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_HandshakeResponse>(),
+ interceptors: self.interceptors?.makeHandshakeInterceptors() ?? [],
+ wrapping: { try await self.handshake(requestStream: $0, responseStream: $1, context: $2) }
+ )
+
+ case "ListFlights":
+ return GRPCAsyncServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_Criteria>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_FlightInfo>(),
+ interceptors: self.interceptors?.makeListFlightsInterceptors() ?? [],
+ wrapping: { try await self.listFlights(request: $0, responseStream: $1, context: $2) }
+ )
+
+ case "GetFlightInfo":
+ return GRPCAsyncServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_FlightDescriptor>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_FlightInfo>(),
+ interceptors: self.interceptors?.makeGetFlightInfoInterceptors() ?? [],
+ wrapping: { try await self.getFlightInfo(request: $0, context: $1) }
+ )
+
+ case "GetSchema":
+ return GRPCAsyncServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_FlightDescriptor>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_SchemaResult>(),
+ interceptors: self.interceptors?.makeGetSchemaInterceptors() ?? [],
+ wrapping: { try await self.getSchema(request: $0, context: $1) }
+ )
+
+ case "DoGet":
+ return GRPCAsyncServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_Ticket>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_FlightData>(),
+ interceptors: self.interceptors?.makeDoGetInterceptors() ?? [],
+ wrapping: { try await self.doGet(request: $0, responseStream: $1, context: $2) }
+ )
+
+ case "DoPut":
+ return GRPCAsyncServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_FlightData>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_PutResult>(),
+ interceptors: self.interceptors?.makeDoPutInterceptors() ?? [],
+ wrapping: { try await self.doPut(requestStream: $0, responseStream: $1, context: $2) }
+ )
+
+ case "DoExchange":
+ return GRPCAsyncServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_FlightData>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_FlightData>(),
+ interceptors: self.interceptors?.makeDoExchangeInterceptors() ?? [],
+ wrapping: { try await self.doExchange(requestStream: $0, responseStream: $1, context: $2) }
+ )
+
+ case "DoAction":
+ return GRPCAsyncServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_Action>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_Result>(),
+ interceptors: self.interceptors?.makeDoActionInterceptors() ?? [],
+ wrapping: { try await self.doAction(request: $0, responseStream: $1, context: $2) }
+ )
+
+ case "ListActions":
+ return GRPCAsyncServerHandler(
+ context: context,
+ requestDeserializer: ProtobufDeserializer<Arrow_Flight_Protocol_Empty>(),
+ responseSerializer: ProtobufSerializer<Arrow_Flight_Protocol_ActionType>(),
+ interceptors: self.interceptors?.makeListActionsInterceptors() ?? [],
+ wrapping: { try await self.listActions(request: $0, responseStream: $1, context: $2) }
+ )
+
+ default:
+ return nil
+ }
+ }
+}
+
+internal protocol Arrow_Flight_Protocol_FlightServiceServerInterceptorFactoryProtocol: Sendable {
+
+ /// - Returns: Interceptors to use when handling 'handshake'.
+ /// Defaults to calling `self.makeInterceptors()`.
+ func makeHandshakeInterceptors() -> [ServerInterceptor<Arrow_Flight_Protocol_HandshakeRequest, Arrow_Flight_Protocol_HandshakeResponse>]
+
+ /// - Returns: Interceptors to use when handling 'listFlights'.
+ /// Defaults to calling `self.makeInterceptors()`.
+ func makeListFlightsInterceptors() -> [ServerInterceptor<Arrow_Flight_Protocol_Criteria, Arrow_Flight_Protocol_FlightInfo>]
+
+ /// - Returns: Interceptors to use when handling 'getFlightInfo'.
+ /// Defaults to calling `self.makeInterceptors()`.
+ func makeGetFlightInfoInterceptors() -> [ServerInterceptor<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_FlightInfo>]
+
+ /// - Returns: Interceptors to use when handling 'getSchema'.
+ /// Defaults to calling `self.makeInterceptors()`.
+ func makeGetSchemaInterceptors() -> [ServerInterceptor<Arrow_Flight_Protocol_FlightDescriptor, Arrow_Flight_Protocol_SchemaResult>]
+
+ /// - Returns: Interceptors to use when handling 'doGet'.
+ /// Defaults to calling `self.makeInterceptors()`.
+ func makeDoGetInterceptors() -> [ServerInterceptor<Arrow_Flight_Protocol_Ticket, Arrow_Flight_Protocol_FlightData>]
+
+ /// - Returns: Interceptors to use when handling 'doPut'.
+ /// Defaults to calling `self.makeInterceptors()`.
+ func makeDoPutInterceptors() -> [ServerInterceptor<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_PutResult>]
+
+ /// - Returns: Interceptors to use when handling 'doExchange'.
+ /// Defaults to calling `self.makeInterceptors()`.
+ func makeDoExchangeInterceptors() -> [ServerInterceptor<Arrow_Flight_Protocol_FlightData, Arrow_Flight_Protocol_FlightData>]
+
+ /// - Returns: Interceptors to use when handling 'doAction'.
+ /// Defaults to calling `self.makeInterceptors()`.
+ func makeDoActionInterceptors() -> [ServerInterceptor<Arrow_Flight_Protocol_Action, Arrow_Flight_Protocol_Result>]
+
+ /// - Returns: Interceptors to use when handling 'listActions'.
+ /// Defaults to calling `self.makeInterceptors()`.
+ func makeListActionsInterceptors() -> [ServerInterceptor<Arrow_Flight_Protocol_Empty, Arrow_Flight_Protocol_ActionType>]
+}
+
+internal enum Arrow_Flight_Protocol_FlightServiceServerMetadata {
+ internal static let serviceDescriptor = GRPCServiceDescriptor(
+ name: "FlightService",
+ fullName: "arrow.flight.protocol.FlightService",
+ methods: [
+ Arrow_Flight_Protocol_FlightServiceServerMetadata.Methods.handshake,
+ Arrow_Flight_Protocol_FlightServiceServerMetadata.Methods.listFlights,
+ Arrow_Flight_Protocol_FlightServiceServerMetadata.Methods.getFlightInfo,
+ Arrow_Flight_Protocol_FlightServiceServerMetadata.Methods.getSchema,
+ Arrow_Flight_Protocol_FlightServiceServerMetadata.Methods.doGet,
+ Arrow_Flight_Protocol_FlightServiceServerMetadata.Methods.doPut,
+ Arrow_Flight_Protocol_FlightServiceServerMetadata.Methods.doExchange,
+ Arrow_Flight_Protocol_FlightServiceServerMetadata.Methods.doAction,
+ Arrow_Flight_Protocol_FlightServiceServerMetadata.Methods.listActions,
+ ]
+ )
+
+ internal enum Methods {
+ internal static let handshake = GRPCMethodDescriptor(
+ name: "Handshake",
+ path: "/arrow.flight.protocol.FlightService/Handshake",
+ type: GRPCCallType.bidirectionalStreaming
+ )
+
+ internal static let listFlights = GRPCMethodDescriptor(
+ name: "ListFlights",
+ path: "/arrow.flight.protocol.FlightService/ListFlights",
+ type: GRPCCallType.serverStreaming
+ )
+
+ internal static let getFlightInfo = GRPCMethodDescriptor(
+ name: "GetFlightInfo",
+ path: "/arrow.flight.protocol.FlightService/GetFlightInfo",
+ type: GRPCCallType.unary
+ )
+
+ internal static let getSchema = GRPCMethodDescriptor(
+ name: "GetSchema",
+ path: "/arrow.flight.protocol.FlightService/GetSchema",
+ type: GRPCCallType.unary
+ )
+
+ internal static let doGet = GRPCMethodDescriptor(
+ name: "DoGet",
+ path: "/arrow.flight.protocol.FlightService/DoGet",
+ type: GRPCCallType.serverStreaming
+ )
+
+ internal static let doPut = GRPCMethodDescriptor(
+ name: "DoPut",
+ path: "/arrow.flight.protocol.FlightService/DoPut",
+ type: GRPCCallType.bidirectionalStreaming
+ )
+
+ internal static let doExchange = GRPCMethodDescriptor(
+ name: "DoExchange",
+ path: "/arrow.flight.protocol.FlightService/DoExchange",
+ type: GRPCCallType.bidirectionalStreaming
+ )
+
+ internal static let doAction = GRPCMethodDescriptor(
+ name: "DoAction",
+ path: "/arrow.flight.protocol.FlightService/DoAction",
+ type: GRPCCallType.serverStreaming
+ )
+
+ internal static let listActions = GRPCMethodDescriptor(
+ name: "ListActions",
+ path: "/arrow.flight.protocol.FlightService/ListActions",
+ type: GRPCCallType.serverStreaming
+ )
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/Flight.pb.swift b/ArrowFlight/Sources/ArrowFlight/Flight.pb.swift
new file mode 100644
index 0000000..b50d406
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/Flight.pb.swift
@@ -0,0 +1,1366 @@
+// DO NOT EDIT.
+// swift-format-ignore-file
+//
+// Generated by the Swift generator plugin for the protocol buffer compiler.
+// Source: Flight.proto
+//
+// For information on using the generated types, please see the documentation:
+// https://github.com/apple/swift-protobuf/
+
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+// <p>
+// http://www.apache.org/licenses/LICENSE-2.0
+// <p>
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import Foundation
+import SwiftProtobuf
+
+// If the compiler emits an error on this type, it is because this file
+// was generated by a version of the `protoc` Swift plug-in that is
+// incompatible with the version of SwiftProtobuf to which you are linking.
+// Please ensure that you are building against the same version of the API
+// that was used to generate this file.
+fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
+ struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
+ typealias Version = _2
+}
+
+///
+/// The result of a cancel operation.
+///
+/// This is used by CancelFlightInfoResult.status.
+enum Arrow_Flight_Protocol_CancelStatus: SwiftProtobuf.Enum {
+ typealias RawValue = Int
+
+ /// The cancellation status is unknown. Servers should avoid using
+ /// this value (send a NOT_FOUND error if the requested query is
+ /// not known). Clients can retry the request.
+ case unspecified // = 0
+
+ /// The cancellation request is complete. Subsequent requests with
+ /// the same payload may return CANCELLED or a NOT_FOUND error.
+ case cancelled // = 1
+
+ /// The cancellation request is in progress. The client may retry
+ /// the cancellation request.
+ case cancelling // = 2
+
+ /// The query is not cancellable. The client should not retry the
+ /// cancellation request.
+ case notCancellable // = 3
+ case UNRECOGNIZED(Int)
+
+ init() {
+ self = .unspecified
+ }
+
+ init?(rawValue: Int) {
+ switch rawValue {
+ case 0: self = .unspecified
+ case 1: self = .cancelled
+ case 2: self = .cancelling
+ case 3: self = .notCancellable
+ default: self = .UNRECOGNIZED(rawValue)
+ }
+ }
+
+ var rawValue: Int {
+ switch self {
+ case .unspecified: return 0
+ case .cancelled: return 1
+ case .cancelling: return 2
+ case .notCancellable: return 3
+ case .UNRECOGNIZED(let i): return i
+ }
+ }
+
+}
+
+#if swift(>=4.2)
+
+extension Arrow_Flight_Protocol_CancelStatus: CaseIterable {
+ // The compiler won't synthesize support with the UNRECOGNIZED case.
+ static var allCases: [Arrow_Flight_Protocol_CancelStatus] = [
+ .unspecified,
+ .cancelled,
+ .cancelling,
+ .notCancellable,
+ ]
+}
+
+#endif // swift(>=4.2)
+
+///
+/// The request that a client provides to a server on handshake.
+struct Arrow_Flight_Protocol_HandshakeRequest {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ ///
+ /// A defined protocol version
+ var protocolVersion: UInt64 = 0
+
+ ///
+ /// Arbitrary auth/handshake info.
+ var payload: Data = Data()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+struct Arrow_Flight_Protocol_HandshakeResponse {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ ///
+ /// A defined protocol version
+ var protocolVersion: UInt64 = 0
+
+ ///
+ /// Arbitrary auth/handshake info.
+ var payload: Data = Data()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// A message for doing simple auth.
+struct Arrow_Flight_Protocol_BasicAuth {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var username: String = String()
+
+ var password: String = String()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+struct Arrow_Flight_Protocol_Empty {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// Describes an available action, including both the name used for execution
+/// along with a short description of the purpose of the action.
+struct Arrow_Flight_Protocol_ActionType {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var type: String = String()
+
+ var description_p: String = String()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// A service specific expression that can be used to return a limited set
+/// of available Arrow Flight streams.
+struct Arrow_Flight_Protocol_Criteria {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var expression: Data = Data()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// An opaque action specific for the service.
+struct Arrow_Flight_Protocol_Action {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var type: String = String()
+
+ var body: Data = Data()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// The request of the CancelFlightInfo action.
+///
+/// The request should be stored in Action.body.
+struct Arrow_Flight_Protocol_CancelFlightInfoRequest {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var info: Arrow_Flight_Protocol_FlightInfo {
+ get {return _info ?? Arrow_Flight_Protocol_FlightInfo()}
+ set {_info = newValue}
+ }
+ /// Returns true if `info` has been explicitly set.
+ var hasInfo: Bool {return self._info != nil}
+ /// Clears the value of `info`. Subsequent reads from it will return its default value.
+ mutating func clearInfo() {self._info = nil}
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+
+ fileprivate var _info: Arrow_Flight_Protocol_FlightInfo? = nil
+}
+
+///
+/// The request of the RenewFlightEndpoint action.
+///
+/// The request should be stored in Action.body.
+struct Arrow_Flight_Protocol_RenewFlightEndpointRequest {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var endpoint: Arrow_Flight_Protocol_FlightEndpoint {
+ get {return _endpoint ?? Arrow_Flight_Protocol_FlightEndpoint()}
+ set {_endpoint = newValue}
+ }
+ /// Returns true if `endpoint` has been explicitly set.
+ var hasEndpoint: Bool {return self._endpoint != nil}
+ /// Clears the value of `endpoint`. Subsequent reads from it will return its default value.
+ mutating func clearEndpoint() {self._endpoint = nil}
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+
+ fileprivate var _endpoint: Arrow_Flight_Protocol_FlightEndpoint? = nil
+}
+
+///
+/// An opaque result returned after executing an action.
+struct Arrow_Flight_Protocol_Result {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var body: Data = Data()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// The result of the CancelFlightInfo action.
+///
+/// The result should be stored in Result.body.
+struct Arrow_Flight_Protocol_CancelFlightInfoResult {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var status: Arrow_Flight_Protocol_CancelStatus = .unspecified
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// Wrap the result of a getSchema call
+struct Arrow_Flight_Protocol_SchemaResult {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ /// 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
+ var schema: Data = Data()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// The name or tag for a Flight. May be used as a way to retrieve or generate
+/// a flight or be used to expose a set of previously defined flights.
+struct Arrow_Flight_Protocol_FlightDescriptor {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var type: Arrow_Flight_Protocol_FlightDescriptor.DescriptorType = .unknown
+
+ ///
+ /// Opaque value used to express a command. Should only be defined when
+ /// type = CMD.
+ var cmd: Data = Data()
+
+ ///
+ /// List of strings identifying a particular dataset. Should only be defined
+ /// when type = PATH.
+ var path: [String] = []
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ ///
+ /// Describes what type of descriptor is defined.
+ enum DescriptorType: SwiftProtobuf.Enum {
+ typealias RawValue = Int
+
+ /// Protobuf pattern, not used.
+ case unknown // = 0
+
+ ///
+ /// 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.
+ case path // = 1
+
+ ///
+ /// An opaque command to generate a dataset.
+ case cmd // = 2
+ case UNRECOGNIZED(Int)
+
+ init() {
+ self = .unknown
+ }
+
+ init?(rawValue: Int) {
+ switch rawValue {
+ case 0: self = .unknown
+ case 1: self = .path
+ case 2: self = .cmd
+ default: self = .UNRECOGNIZED(rawValue)
+ }
+ }
+
+ var rawValue: Int {
+ switch self {
+ case .unknown: return 0
+ case .path: return 1
+ case .cmd: return 2
+ case .UNRECOGNIZED(let i): return i
+ }
+ }
+
+ }
+
+ init() {}
+}
+
+#if swift(>=4.2)
+
+extension Arrow_Flight_Protocol_FlightDescriptor.DescriptorType: CaseIterable {
+ // The compiler won't synthesize support with the UNRECOGNIZED case.
+ static var allCases: [Arrow_Flight_Protocol_FlightDescriptor.DescriptorType] = [
+ .unknown,
+ .path,
+ .cmd,
+ ]
+}
+
+#endif // swift(>=4.2)
+
+///
+/// The access coordinates for retrieval of a dataset. With a FlightInfo, a
+/// consumer is able to determine how to retrieve a dataset.
+struct Arrow_Flight_Protocol_FlightInfo {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ /// 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
+ var schema: Data = Data()
+
+ ///
+ /// The descriptor associated with this info.
+ var flightDescriptor: Arrow_Flight_Protocol_FlightDescriptor {
+ get {return _flightDescriptor ?? Arrow_Flight_Protocol_FlightDescriptor()}
+ set {_flightDescriptor = newValue}
+ }
+ /// Returns true if `flightDescriptor` has been explicitly set.
+ var hasFlightDescriptor: Bool {return self._flightDescriptor != nil}
+ /// Clears the value of `flightDescriptor`. Subsequent reads from it will return its default value.
+ mutating func clearFlightDescriptor() {self._flightDescriptor = nil}
+
+ ///
+ /// A list of endpoints associated with the flight. To consume the
+ /// whole flight, all endpoints (and hence all Tickets) must be
+ /// consumed. Endpoints can be consumed in any order.
+ ///
+ /// In other words, an application can use multiple endpoints to
+ /// represent partitioned data.
+ ///
+ /// If the returned data has an ordering, an application can use
+ /// "FlightInfo.ordered = true" or should return the all data in a
+ /// single endpoint. Otherwise, there is no ordering defined on
+ /// endpoints or the data within.
+ ///
+ /// A client can read ordered data by reading data from returned
+ /// endpoints, in order, from front to back.
+ ///
+ /// Note that a client may ignore "FlightInfo.ordered = true". If an
+ /// ordering is important for an application, an application must
+ /// choose one of them:
+ ///
+ /// * An application requires that all clients must read data in
+ /// returned endpoints order.
+ /// * An application must return the all data in a single endpoint.
+ var endpoint: [Arrow_Flight_Protocol_FlightEndpoint] = []
+
+ /// Set these to -1 if unknown.
+ var totalRecords: Int64 = 0
+
+ var totalBytes: Int64 = 0
+
+ ///
+ /// FlightEndpoints are in the same order as the data.
+ var ordered: Bool = false
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+
+ fileprivate var _flightDescriptor: Arrow_Flight_Protocol_FlightDescriptor? = nil
+}
+
+///
+/// A particular stream or split associated with a flight.
+struct Arrow_Flight_Protocol_FlightEndpoint {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ ///
+ /// Token used to retrieve this stream.
+ var ticket: Arrow_Flight_Protocol_Ticket {
+ get {return _ticket ?? Arrow_Flight_Protocol_Ticket()}
+ set {_ticket = newValue}
+ }
+ /// Returns true if `ticket` has been explicitly set.
+ var hasTicket: Bool {return self._ticket != nil}
+ /// Clears the value of `ticket`. Subsequent reads from it will return its default value.
+ mutating func clearTicket() {self._ticket = nil}
+
+ ///
+ /// A list of URIs where this ticket can be redeemed via DoGet().
+ ///
+ /// If the list is empty, the expectation is that the ticket can only
+ /// be redeemed on the current service where the ticket was
+ /// generated.
+ ///
+ /// If the list is not empty, the expectation is that the ticket can
+ /// be redeemed at any of the locations, and that the data returned
+ /// will be equivalent. In this case, the ticket may only be redeemed
+ /// at one of the given locations, and not (necessarily) on the
+ /// current service.
+ ///
+ /// In other words, an application can use multiple locations to
+ /// represent redundant and/or load balanced services.
+ var location: [Arrow_Flight_Protocol_Location] = []
+
+ ///
+ /// Expiration time of this stream. If present, clients may assume
+ /// they can retry DoGet requests. Otherwise, it is
+ /// application-defined whether DoGet requests may be retried.
+ var expirationTime: SwiftProtobuf.Google_Protobuf_Timestamp {
+ get {return _expirationTime ?? SwiftProtobuf.Google_Protobuf_Timestamp()}
+ set {_expirationTime = newValue}
+ }
+ /// Returns true if `expirationTime` has been explicitly set.
+ var hasExpirationTime: Bool {return self._expirationTime != nil}
+ /// Clears the value of `expirationTime`. Subsequent reads from it will return its default value.
+ mutating func clearExpirationTime() {self._expirationTime = nil}
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+
+ fileprivate var _ticket: Arrow_Flight_Protocol_Ticket? = nil
+ fileprivate var _expirationTime: SwiftProtobuf.Google_Protobuf_Timestamp? = nil
+}
+
+///
+/// A location where a Flight service will accept retrieval of a particular
+/// stream given a ticket.
+struct Arrow_Flight_Protocol_Location {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var uri: String = String()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// An opaque identifier that the service can use to retrieve a particular
+/// portion of a stream.
+///
+/// Tickets are meant to be single use. It is an error/application-defined
+/// behavior to reuse a ticket.
+struct Arrow_Flight_Protocol_Ticket {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var ticket: Data = Data()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+///
+/// A batch of Arrow data as part of a stream of batches.
+struct Arrow_Flight_Protocol_FlightData {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ ///
+ /// The descriptor of the data. This is only relevant when a client is
+ /// starting a new DoPut stream.
+ var flightDescriptor: Arrow_Flight_Protocol_FlightDescriptor {
+ get {return _flightDescriptor ?? Arrow_Flight_Protocol_FlightDescriptor()}
+ set {_flightDescriptor = newValue}
+ }
+ /// Returns true if `flightDescriptor` has been explicitly set.
+ var hasFlightDescriptor: Bool {return self._flightDescriptor != nil}
+ /// Clears the value of `flightDescriptor`. Subsequent reads from it will return its default value.
+ mutating func clearFlightDescriptor() {self._flightDescriptor = nil}
+
+ ///
+ /// Header for message data as described in Message.fbs::Message.
+ var dataHeader: Data = Data()
+
+ ///
+ /// Application-defined metadata.
+ var appMetadata: Data = Data()
+
+ ///
+ /// The actual batch of Arrow data. Preferably handled with minimal-copies
+ /// coming last in the definition to help with sidecar patterns (it is
+ /// expected that some implementations will fetch this field off the wire
+ /// with specialized code to avoid extra memory copies).
+ var dataBody: Data = Data()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+
+ fileprivate var _flightDescriptor: Arrow_Flight_Protocol_FlightDescriptor? = nil
+}
+
+///*
+/// The response message associated with the submission of a DoPut.
+struct Arrow_Flight_Protocol_PutResult {
+ // SwiftProtobuf.Message conformance is added in an extension below. See the
+ // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+ // methods supported on all messages.
+
+ var appMetadata: Data = Data()
+
+ var unknownFields = SwiftProtobuf.UnknownStorage()
+
+ init() {}
+}
+
+#if swift(>=5.5) && canImport(_Concurrency)
+extension Arrow_Flight_Protocol_CancelStatus: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_HandshakeRequest: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_HandshakeResponse: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_BasicAuth: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_Empty: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_ActionType: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_Criteria: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_Action: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_CancelFlightInfoRequest: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_RenewFlightEndpointRequest: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_Result: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_CancelFlightInfoResult: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_SchemaResult: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_FlightDescriptor: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_FlightDescriptor.DescriptorType: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_FlightInfo: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_FlightEndpoint: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_Location: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_Ticket: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_FlightData: @unchecked Sendable {}
+extension Arrow_Flight_Protocol_PutResult: @unchecked Sendable {}
+#endif // swift(>=5.5) && canImport(_Concurrency)
+
+// MARK: - Code below here is support for the SwiftProtobuf runtime.
+
+fileprivate let _protobuf_package = "arrow.flight.protocol"
+
+extension Arrow_Flight_Protocol_CancelStatus: SwiftProtobuf._ProtoNameProviding {
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 0: .same(proto: "CANCEL_STATUS_UNSPECIFIED"),
+ 1: .same(proto: "CANCEL_STATUS_CANCELLED"),
+ 2: .same(proto: "CANCEL_STATUS_CANCELLING"),
+ 3: .same(proto: "CANCEL_STATUS_NOT_CANCELLABLE"),
+ ]
+}
+
+extension Arrow_Flight_Protocol_HandshakeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".HandshakeRequest"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .standard(proto: "protocol_version"),
+ 2: .same(proto: "payload"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularUInt64Field(value: &self.protocolVersion) }()
+ case 2: try { try decoder.decodeSingularBytesField(value: &self.payload) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if self.protocolVersion != 0 {
+ try visitor.visitSingularUInt64Field(value: self.protocolVersion, fieldNumber: 1)
+ }
+ if !self.payload.isEmpty {
+ try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 2)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_HandshakeRequest, rhs: Arrow_Flight_Protocol_HandshakeRequest) -> Bool {
+ if lhs.protocolVersion != rhs.protocolVersion {return false}
+ if lhs.payload != rhs.payload {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_HandshakeResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".HandshakeResponse"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .standard(proto: "protocol_version"),
+ 2: .same(proto: "payload"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularUInt64Field(value: &self.protocolVersion) }()
+ case 2: try { try decoder.decodeSingularBytesField(value: &self.payload) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if self.protocolVersion != 0 {
+ try visitor.visitSingularUInt64Field(value: self.protocolVersion, fieldNumber: 1)
+ }
+ if !self.payload.isEmpty {
+ try visitor.visitSingularBytesField(value: self.payload, fieldNumber: 2)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_HandshakeResponse, rhs: Arrow_Flight_Protocol_HandshakeResponse) -> Bool {
+ if lhs.protocolVersion != rhs.protocolVersion {return false}
+ if lhs.payload != rhs.payload {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_BasicAuth: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".BasicAuth"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 2: .same(proto: "username"),
+ 3: .same(proto: "password"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 2: try { try decoder.decodeSingularStringField(value: &self.username) }()
+ case 3: try { try decoder.decodeSingularStringField(value: &self.password) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if !self.username.isEmpty {
+ try visitor.visitSingularStringField(value: self.username, fieldNumber: 2)
+ }
+ if !self.password.isEmpty {
+ try visitor.visitSingularStringField(value: self.password, fieldNumber: 3)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_BasicAuth, rhs: Arrow_Flight_Protocol_BasicAuth) -> Bool {
+ if lhs.username != rhs.username {return false}
+ if lhs.password != rhs.password {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_Empty: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".Empty"
+ static let _protobuf_nameMap = SwiftProtobuf._NameMap()
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let _ = try decoder.nextFieldNumber() {
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_Empty, rhs: Arrow_Flight_Protocol_Empty) -> Bool {
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_ActionType: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".ActionType"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "type"),
+ 2: .same(proto: "description"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularStringField(value: &self.type) }()
+ case 2: try { try decoder.decodeSingularStringField(value: &self.description_p) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if !self.type.isEmpty {
+ try visitor.visitSingularStringField(value: self.type, fieldNumber: 1)
+ }
+ if !self.description_p.isEmpty {
+ try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 2)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_ActionType, rhs: Arrow_Flight_Protocol_ActionType) -> Bool {
+ if lhs.type != rhs.type {return false}
+ if lhs.description_p != rhs.description_p {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_Criteria: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".Criteria"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "expression"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularBytesField(value: &self.expression) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if !self.expression.isEmpty {
+ try visitor.visitSingularBytesField(value: self.expression, fieldNumber: 1)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_Criteria, rhs: Arrow_Flight_Protocol_Criteria) -> Bool {
+ if lhs.expression != rhs.expression {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_Action: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".Action"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "type"),
+ 2: .same(proto: "body"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularStringField(value: &self.type) }()
+ case 2: try { try decoder.decodeSingularBytesField(value: &self.body) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if !self.type.isEmpty {
+ try visitor.visitSingularStringField(value: self.type, fieldNumber: 1)
+ }
+ if !self.body.isEmpty {
+ try visitor.visitSingularBytesField(value: self.body, fieldNumber: 2)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_Action, rhs: Arrow_Flight_Protocol_Action) -> Bool {
+ if lhs.type != rhs.type {return false}
+ if lhs.body != rhs.body {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_CancelFlightInfoRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".CancelFlightInfoRequest"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "info"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularMessageField(value: &self._info) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every if/case branch local when no optimizations
+ // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
+ // https://github.com/apple/swift-protobuf/issues/1182
+ try { if let v = self._info {
+ try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
+ } }()
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_CancelFlightInfoRequest, rhs: Arrow_Flight_Protocol_CancelFlightInfoRequest) -> Bool {
+ if lhs._info != rhs._info {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_RenewFlightEndpointRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".RenewFlightEndpointRequest"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "endpoint"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularMessageField(value: &self._endpoint) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every if/case branch local when no optimizations
+ // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
+ // https://github.com/apple/swift-protobuf/issues/1182
+ try { if let v = self._endpoint {
+ try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
+ } }()
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_RenewFlightEndpointRequest, rhs: Arrow_Flight_Protocol_RenewFlightEndpointRequest) -> Bool {
+ if lhs._endpoint != rhs._endpoint {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_Result: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".Result"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "body"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularBytesField(value: &self.body) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if !self.body.isEmpty {
+ try visitor.visitSingularBytesField(value: self.body, fieldNumber: 1)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_Result, rhs: Arrow_Flight_Protocol_Result) -> Bool {
+ if lhs.body != rhs.body {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_CancelFlightInfoResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".CancelFlightInfoResult"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "status"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularEnumField(value: &self.status) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if self.status != .unspecified {
+ try visitor.visitSingularEnumField(value: self.status, fieldNumber: 1)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_CancelFlightInfoResult, rhs: Arrow_Flight_Protocol_CancelFlightInfoResult) -> Bool {
+ if lhs.status != rhs.status {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_SchemaResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".SchemaResult"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "schema"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularBytesField(value: &self.schema) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if !self.schema.isEmpty {
+ try visitor.visitSingularBytesField(value: self.schema, fieldNumber: 1)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_SchemaResult, rhs: Arrow_Flight_Protocol_SchemaResult) -> Bool {
+ if lhs.schema != rhs.schema {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_FlightDescriptor: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".FlightDescriptor"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "type"),
+ 2: .same(proto: "cmd"),
+ 3: .same(proto: "path"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularEnumField(value: &self.type) }()
+ case 2: try { try decoder.decodeSingularBytesField(value: &self.cmd) }()
+ case 3: try { try decoder.decodeRepeatedStringField(value: &self.path) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if self.type != .unknown {
+ try visitor.visitSingularEnumField(value: self.type, fieldNumber: 1)
+ }
+ if !self.cmd.isEmpty {
+ try visitor.visitSingularBytesField(value: self.cmd, fieldNumber: 2)
+ }
+ if !self.path.isEmpty {
+ try visitor.visitRepeatedStringField(value: self.path, fieldNumber: 3)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_FlightDescriptor, rhs: Arrow_Flight_Protocol_FlightDescriptor) -> Bool {
+ if lhs.type != rhs.type {return false}
+ if lhs.cmd != rhs.cmd {return false}
+ if lhs.path != rhs.path {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_FlightDescriptor.DescriptorType: SwiftProtobuf._ProtoNameProviding {
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 0: .same(proto: "UNKNOWN"),
+ 1: .same(proto: "PATH"),
+ 2: .same(proto: "CMD"),
+ ]
+}
+
+extension Arrow_Flight_Protocol_FlightInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".FlightInfo"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "schema"),
+ 2: .standard(proto: "flight_descriptor"),
+ 3: .same(proto: "endpoint"),
+ 4: .standard(proto: "total_records"),
+ 5: .standard(proto: "total_bytes"),
+ 6: .same(proto: "ordered"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularBytesField(value: &self.schema) }()
+ case 2: try { try decoder.decodeSingularMessageField(value: &self._flightDescriptor) }()
+ case 3: try { try decoder.decodeRepeatedMessageField(value: &self.endpoint) }()
+ case 4: try { try decoder.decodeSingularInt64Field(value: &self.totalRecords) }()
+ case 5: try { try decoder.decodeSingularInt64Field(value: &self.totalBytes) }()
+ case 6: try { try decoder.decodeSingularBoolField(value: &self.ordered) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every if/case branch local when no optimizations
+ // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
+ // https://github.com/apple/swift-protobuf/issues/1182
+ if !self.schema.isEmpty {
+ try visitor.visitSingularBytesField(value: self.schema, fieldNumber: 1)
+ }
+ try { if let v = self._flightDescriptor {
+ try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
+ } }()
+ if !self.endpoint.isEmpty {
+ try visitor.visitRepeatedMessageField(value: self.endpoint, fieldNumber: 3)
+ }
+ if self.totalRecords != 0 {
+ try visitor.visitSingularInt64Field(value: self.totalRecords, fieldNumber: 4)
+ }
+ if self.totalBytes != 0 {
+ try visitor.visitSingularInt64Field(value: self.totalBytes, fieldNumber: 5)
+ }
+ if self.ordered != false {
+ try visitor.visitSingularBoolField(value: self.ordered, fieldNumber: 6)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_FlightInfo, rhs: Arrow_Flight_Protocol_FlightInfo) -> Bool {
+ if lhs.schema != rhs.schema {return false}
+ if lhs._flightDescriptor != rhs._flightDescriptor {return false}
+ if lhs.endpoint != rhs.endpoint {return false}
+ if lhs.totalRecords != rhs.totalRecords {return false}
+ if lhs.totalBytes != rhs.totalBytes {return false}
+ if lhs.ordered != rhs.ordered {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_FlightEndpoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".FlightEndpoint"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "ticket"),
+ 2: .same(proto: "location"),
+ 3: .standard(proto: "expiration_time"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularMessageField(value: &self._ticket) }()
+ case 2: try { try decoder.decodeRepeatedMessageField(value: &self.location) }()
+ case 3: try { try decoder.decodeSingularMessageField(value: &self._expirationTime) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every if/case branch local when no optimizations
+ // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
+ // https://github.com/apple/swift-protobuf/issues/1182
+ try { if let v = self._ticket {
+ try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
+ } }()
+ if !self.location.isEmpty {
+ try visitor.visitRepeatedMessageField(value: self.location, fieldNumber: 2)
+ }
+ try { if let v = self._expirationTime {
+ try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
+ } }()
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_FlightEndpoint, rhs: Arrow_Flight_Protocol_FlightEndpoint) -> Bool {
+ if lhs._ticket != rhs._ticket {return false}
+ if lhs.location != rhs.location {return false}
+ if lhs._expirationTime != rhs._expirationTime {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_Location: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".Location"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "uri"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularStringField(value: &self.uri) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if !self.uri.isEmpty {
+ try visitor.visitSingularStringField(value: self.uri, fieldNumber: 1)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_Location, rhs: Arrow_Flight_Protocol_Location) -> Bool {
+ if lhs.uri != rhs.uri {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_Ticket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".Ticket"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .same(proto: "ticket"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularBytesField(value: &self.ticket) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if !self.ticket.isEmpty {
+ try visitor.visitSingularBytesField(value: self.ticket, fieldNumber: 1)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_Ticket, rhs: Arrow_Flight_Protocol_Ticket) -> Bool {
+ if lhs.ticket != rhs.ticket {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_FlightData: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".FlightData"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .standard(proto: "flight_descriptor"),
+ 2: .standard(proto: "data_header"),
+ 3: .standard(proto: "app_metadata"),
+ 1000: .standard(proto: "data_body"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularMessageField(value: &self._flightDescriptor) }()
+ case 2: try { try decoder.decodeSingularBytesField(value: &self.dataHeader) }()
+ case 3: try { try decoder.decodeSingularBytesField(value: &self.appMetadata) }()
+ case 1000: try { try decoder.decodeSingularBytesField(value: &self.dataBody) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every if/case branch local when no optimizations
+ // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
+ // https://github.com/apple/swift-protobuf/issues/1182
+ try { if let v = self._flightDescriptor {
+ try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
+ } }()
+ if !self.dataHeader.isEmpty {
+ try visitor.visitSingularBytesField(value: self.dataHeader, fieldNumber: 2)
+ }
+ if !self.appMetadata.isEmpty {
+ try visitor.visitSingularBytesField(value: self.appMetadata, fieldNumber: 3)
+ }
+ if !self.dataBody.isEmpty {
+ try visitor.visitSingularBytesField(value: self.dataBody, fieldNumber: 1000)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_FlightData, rhs: Arrow_Flight_Protocol_FlightData) -> Bool {
+ if lhs._flightDescriptor != rhs._flightDescriptor {return false}
+ if lhs.dataHeader != rhs.dataHeader {return false}
+ if lhs.appMetadata != rhs.appMetadata {return false}
+ if lhs.dataBody != rhs.dataBody {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
+
+extension Arrow_Flight_Protocol_PutResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+ static let protoMessageName: String = _protobuf_package + ".PutResult"
+ static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
+ 1: .standard(proto: "app_metadata"),
+ ]
+
+ mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+ while let fieldNumber = try decoder.nextFieldNumber() {
+ // The use of inline closures is to circumvent an issue where the compiler
+ // allocates stack space for every case branch when no optimizations are
+ // enabled. https://github.com/apple/swift-protobuf/issues/1034
+ switch fieldNumber {
+ case 1: try { try decoder.decodeSingularBytesField(value: &self.appMetadata) }()
+ default: break
+ }
+ }
+ }
+
+ func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+ if !self.appMetadata.isEmpty {
+ try visitor.visitSingularBytesField(value: self.appMetadata, fieldNumber: 1)
+ }
+ try unknownFields.traverse(visitor: &visitor)
+ }
+
+ static func ==(lhs: Arrow_Flight_Protocol_PutResult, rhs: Arrow_Flight_Protocol_PutResult) -> Bool {
+ if lhs.appMetadata != rhs.appMetadata {return false}
+ if lhs.unknownFields != rhs.unknownFields {return false}
+ return true
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightAction.swift b/ArrowFlight/Sources/ArrowFlight/FlightAction.swift
new file mode 100644
index 0000000..04e917d
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightAction.swift
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+
+public class FlightAction {
+ public let type: String
+ public let body: Data
+ init(_ action: Arrow_Flight_Protocol_Action) {
+ self.type = action.type
+ self.body = action.body
+ }
+
+ public init(_ type: String, body: Data = Data()) {
+ self.type = type;
+ self.body = body;
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_Action {
+ var flight_action = Arrow_Flight_Protocol_Action()
+ flight_action.type = self.type
+ flight_action.body = self.body
+ return flight_action
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightActionType.swift b/ArrowFlight/Sources/ArrowFlight/FlightActionType.swift
new file mode 100644
index 0000000..b3b0679
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightActionType.swift
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+public class FlightActionType {
+ public let type: String
+ public let description: String
+ init(_ actionType: Arrow_Flight_Protocol_ActionType) {
+ self.type = actionType.type
+ self.description = actionType.description_p
+
+ }
+ public init(_ type: String, description: String) {
+ self.type = type
+ self.description = description
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_ActionType {
+ var actionType = Arrow_Flight_Protocol_ActionType()
+ actionType.type = self.type
+ actionType.description_p = self.description
+ return actionType
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightClient.swift b/ArrowFlight/Sources/ArrowFlight/FlightClient.swift
new file mode 100644
index 0000000..f7b8564
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightClient.swift
@@ -0,0 +1,144 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import struct Foundation.Data
+import struct Foundation.URL
+import GRPC
+import NIOCore
+import NIOPosix
+import Arrow
+
+public class FlightClient {
+ let client: Arrow_Flight_Protocol_FlightServiceAsyncClient
+ public init(channel: GRPCChannel) {
+ client = Arrow_Flight_Protocol_FlightServiceAsyncClient(channel: channel)
+ }
+
+ public func listActions(_ closure: (FlightActionType) -> Void) async throws {
+ let listActions = client.makeListActionsCall(Arrow_Flight_Protocol_Empty())
+ for try await data in listActions.responseStream {
+ closure(FlightActionType(data))
+ }
+ }
+
+ public func listFlights(_ criteria :FlightCriteria, closure: (FlightInfo) throws -> Void) async throws {
+ let listFlights = client.makeListFlightsCall(criteria.toProtocol())
+ for try await data in listFlights.responseStream {
+ try closure(FlightInfo(data));
+ }
+ }
+
+
+ public func doAction(_ action: FlightAction, closure: (FlightResult) throws -> Void) async throws {
+ let actionResponse = client.makeDoActionCall(action.toProtocol())
+ for try await data in actionResponse.responseStream {
+ try closure(FlightResult(data));
+ }
+ }
+
+ public func getSchema(_ descriptor: FlightDescriptor) async throws -> FlightSchemaResult {
+ let schemaResultResponse = client.makeGetSchemaCall(descriptor.toProtocol())
+ return FlightSchemaResult(try await schemaResultResponse.response)
+ }
+
+ public func doGet(_ ticket: FlightTicket, readerResultClosure: (ArrowReader.ArrowReaderResult) throws -> Void) async throws {
+ let getResult = client.makeDoGetCall(ticket.toProtocol())
+ let reader = ArrowReader()
+ for try await data in getResult.responseStream {
+ switch reader.fromStream(data.dataBody) {
+ case .success(let rb):
+ try readerResultClosure(rb)
+ case .failure(let error):
+ throw error
+ }
+ }
+ }
+
+ public func doGet(_ ticket: FlightTicket, flightDataClosure: (FlightData) throws -> Void) async throws {
+ let getResult = client.makeDoGetCall(ticket.toProtocol())
+ for try await data in getResult.responseStream {
+ try flightDataClosure(FlightData(data))
+ }
+ }
+
+ public func doPut(_ recordBatchs: [RecordBatch], closure: (FlightPutResult) throws -> Void) async throws {
+ if recordBatchs.isEmpty {
+ throw ArrowFlightError.EmptyCollection
+ }
+
+ let putCall = client.makeDoPutCall()
+ let writer = ArrowWriter()
+ let writerInfo = ArrowWriter.Info(.recordbatch, schema: recordBatchs[0].schema, batches: recordBatchs)
+ switch writer.toStream(writerInfo) {
+ case .success(let data):
+ try await putCall.requestStream.send(FlightData(data).toProtocol())
+ putCall.requestStream.finish()
+ for try await response in putCall.responseStream {
+ try closure(FlightPutResult(response))
+ }
+ case .failure(let error):
+ throw error
+ }
+ }
+
+ public func doPut(flightData: FlightData, closure: (FlightPutResult) throws -> Void) async throws {
+ let putCall = client.makeDoPutCall()
+ try await putCall.requestStream.send(flightData.toProtocol())
+ putCall.requestStream.finish()
+ for try await response in putCall.responseStream {
+ try closure(FlightPutResult(response))
+ }
+ }
+
+ public func doExchange(_ recordBatchs: [RecordBatch], closure: (ArrowReader.ArrowReaderResult) throws -> Void) async throws {
+ if recordBatchs.isEmpty {
+ throw ArrowFlightError.EmptyCollection
+ }
+
+ let exchangeCall = client.makeDoExchangeCall()
+ let writer = ArrowWriter()
+ let info = ArrowWriter.Info(.recordbatch, schema: recordBatchs[0].schema, batches: recordBatchs)
+ switch writer.toStream(info) {
+ case .success(let data):
+ let request = Arrow_Flight_Protocol_FlightData.with {
+ $0.dataBody = data
+ }
+ try await exchangeCall.requestStream.send(request)
+ exchangeCall.requestStream.finish()
+ let reader = ArrowReader()
+ for try await response in exchangeCall.responseStream {
+ switch reader.fromStream(response.dataBody) {
+ case .success(let rbResult):
+ try closure(rbResult)
+ case .failure(let error):
+ throw error
+ }
+ }
+ case .failure(let error):
+ throw error
+ }
+ }
+
+ public func doExchange(fligthData: FlightData, closure: (FlightData) throws -> Void) async throws {
+ let exchangeCall = client.makeDoExchangeCall()
+ try await exchangeCall.requestStream.send(fligthData.toProtocol())
+ exchangeCall.requestStream.finish()
+ for try await response in exchangeCall.responseStream {
+ try closure(FlightData(response))
+ }
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightCriteria.swift b/ArrowFlight/Sources/ArrowFlight/FlightCriteria.swift
new file mode 100644
index 0000000..a887a22
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightCriteria.swift
@@ -0,0 +1,37 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+
+public class FlightCriteria {
+ let criteria: Arrow_Flight_Protocol_Criteria
+
+ public var expression: Data { criteria.expression }
+ public init(_ expression: Data = Data()) {
+ criteria = Arrow_Flight_Protocol_Criteria.with {
+ $0.expression = expression
+ }
+ }
+
+ init(_ criteria: Arrow_Flight_Protocol_Criteria) {
+ self.criteria = criteria
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_Criteria {
+ return criteria
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightData.swift b/ArrowFlight/Sources/ArrowFlight/FlightData.swift
new file mode 100644
index 0000000..004fb78
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightData.swift
@@ -0,0 +1,46 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+
+public class FlightData {
+ let flight_data: Arrow_Flight_Protocol_FlightData
+ public var flightDescriptor: FlightDescriptor? {
+ get { return flight_data.hasFlightDescriptor ? FlightDescriptor(flight_data.flightDescriptor) : nil }
+ }
+
+ public var dataBody: Data { flight_data.dataBody }
+
+ init(_ flight_data: Arrow_Flight_Protocol_FlightData) {
+ self.flight_data = flight_data
+ }
+
+ public init(_ dataBody: Data, flightDescriptor: FlightDescriptor? = nil) {
+ if flightDescriptor != nil {
+ self.flight_data = Arrow_Flight_Protocol_FlightData.with {
+ $0.dataBody = dataBody
+ $0.flightDescriptor = flightDescriptor!.toProtocol()
+ }
+ } else {
+ self.flight_data = Arrow_Flight_Protocol_FlightData.with {
+ $0.dataBody = dataBody
+ }
+ }
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_FlightData { self.flight_data }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightDescriptor.swift b/ArrowFlight/Sources/ArrowFlight/FlightDescriptor.swift
new file mode 100644
index 0000000..68bc91a
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightDescriptor.swift
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+
+public class FlightDescriptor {
+ public enum type {
+ case unknown
+ case path
+ case cmd
+ }
+
+ public let type: FlightDescriptor.type
+ public let cmd: Data
+ public let paths: [String]
+
+ init(_ descriptor: Arrow_Flight_Protocol_FlightDescriptor) {
+ self.type = descriptor.type == .cmd ? .cmd : .path
+ self.cmd = descriptor.cmd
+ self.paths = descriptor.path
+ }
+
+ public init(cmd: Data) {
+ self.type = .cmd
+ self.cmd = cmd
+ self.paths = [String]()
+ }
+
+ public init(paths: [String]) {
+ self.type = .path
+ self.cmd = Data()
+ self.paths = paths
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_FlightDescriptor {
+ var descriptor = Arrow_Flight_Protocol_FlightDescriptor()
+ descriptor.type = self.type == .cmd ? .cmd : .path
+ descriptor.cmd = self.cmd
+ descriptor.path = self.paths
+ return descriptor
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightEndpoint.swift b/ArrowFlight/Sources/ArrowFlight/FlightEndpoint.swift
new file mode 100644
index 0000000..7c40a2a
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightEndpoint.swift
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+public class FlightEndpoint {
+ let ticket: FlightTicket;
+ let locations: [FlightLocation]
+ init(_ endpoint: Arrow_Flight_Protocol_FlightEndpoint) {
+ self.ticket = FlightTicket(endpoint.ticket.ticket)
+ self.locations = endpoint.location.map {return FlightLocation($0)}
+ }
+
+ public init(_ ticket: FlightTicket, locations: [FlightLocation]) {
+ self.ticket = ticket
+ self.locations = locations;
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_FlightEndpoint {
+ var endpoint = Arrow_Flight_Protocol_FlightEndpoint()
+ endpoint.ticket = self.ticket.toProtocol()
+ endpoint.location = self.locations.map { $0.toProtocol() }
+ return endpoint
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightInfo.swift b/ArrowFlight/Sources/ArrowFlight/FlightInfo.swift
new file mode 100644
index 0000000..b370c00
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightInfo.swift
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+import Arrow
+
+public class FlightInfo {
+ let flight_info: Arrow_Flight_Protocol_FlightInfo
+ public var flightDescriptor: FlightDescriptor? {
+ get { return flight_info.hasFlightDescriptor ? FlightDescriptor(flight_info.flightDescriptor) : nil }
+ }
+
+ public var endpoints: [FlightEndpoint] {
+ return self.flight_info.endpoint.map { FlightEndpoint($0) }
+ }
+ public var schema: Data { flight_info.schema }
+
+ var endpoint: [Arrow_Flight_Protocol_FlightEndpoint] = []
+ init(_ flight_info: Arrow_Flight_Protocol_FlightInfo) {
+ self.flight_info = flight_info
+ }
+
+ public init(_ schema: Data, endpoints: [FlightEndpoint] = [FlightEndpoint](), descriptor: FlightDescriptor? = nil) {
+ if let localDescriptor = descriptor {
+ self.flight_info = Arrow_Flight_Protocol_FlightInfo.with {
+ $0.schema = schema
+ $0.flightDescriptor = localDescriptor.toProtocol()
+ $0.endpoint = endpoints.map { $0.toProtocol() }
+ }
+ } else {
+ self.flight_info = Arrow_Flight_Protocol_FlightInfo.with {
+ $0.schema = schema
+ $0.endpoint = endpoints.map { $0.toProtocol() }
+ }
+ }
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_FlightInfo {
+ return self.flight_info
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightLocation.swift b/ArrowFlight/Sources/ArrowFlight/FlightLocation.swift
new file mode 100644
index 0000000..b87671c
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightLocation.swift
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+
+public class FlightLocation {
+ public let uri: String
+
+ init(_ location: Arrow_Flight_Protocol_Location) {
+ self.uri = location.uri
+ }
+
+ public init(_ uri: String) {
+ self.uri = uri;
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_Location {
+ var location = Arrow_Flight_Protocol_Location()
+ location.uri = uri
+ return location
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightPutResult.swift b/ArrowFlight/Sources/ArrowFlight/FlightPutResult.swift
new file mode 100644
index 0000000..bf73c71
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightPutResult.swift
@@ -0,0 +1,35 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+
+public class FlightPutResult {
+ public let appMetadata: Data
+ public init(_ appMetadata: Data = Data()) {
+ self.appMetadata = appMetadata
+ }
+
+ init(_ putResult: Arrow_Flight_Protocol_PutResult) {
+ self.appMetadata = putResult.appMetadata
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_PutResult {
+ var putResult = Arrow_Flight_Protocol_PutResult()
+ putResult.appMetadata = self.appMetadata
+ return putResult
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightResult.swift b/ArrowFlight/Sources/ArrowFlight/FlightResult.swift
new file mode 100644
index 0000000..ba55bed
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightResult.swift
@@ -0,0 +1,35 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+
+public class FlightResult {
+ public let body: Data
+ init(_ result: Arrow_Flight_Protocol_Result) {
+ self.body = result.body
+ }
+
+ public init(_ body: Data) {
+ self.body = body
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_Result {
+ var result = Arrow_Flight_Protocol_Result()
+ result.body = self.body
+ return result
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightSchemaResult.swift b/ArrowFlight/Sources/ArrowFlight/FlightSchemaResult.swift
new file mode 100644
index 0000000..8d5323b
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightSchemaResult.swift
@@ -0,0 +1,37 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+
+public class FlightSchemaResult {
+ let schemaResult: Arrow_Flight_Protocol_SchemaResult
+
+ public var schema: Data { schemaResult.schema }
+ public init(_ schema: Data) {
+ self.schemaResult = Arrow_Flight_Protocol_SchemaResult.with {
+ $0.schema = schema
+ }
+ }
+
+ init(_ schemaResult: Arrow_Flight_Protocol_SchemaResult) {
+ self.schemaResult = schemaResult
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_SchemaResult {
+ return schemaResult
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightServer.swift b/ArrowFlight/Sources/ArrowFlight/FlightServer.swift
new file mode 100644
index 0000000..f67f612
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightServer.swift
@@ -0,0 +1,162 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+import GRPC
+import NIO
+import NIOConcurrencyHelpers
+import SwiftProtobuf
+import Arrow
+
+public enum ArrowFlightError: Error {
+ case Unknown(String?)
+ case NotImplemented(String? = nil)
+ case EmptyCollection
+ case IOError(String? = nil)
+}
+
+public func schemaToArrowStream(_ schema: ArrowSchema) throws -> Data {
+ let arrowWriter = ArrowWriter()
+ switch arrowWriter.toStream(ArrowWriter.Info(.schema, schema: schema)) {
+ case .success(let result):
+ return result
+ case .failure(let error):
+ throw error
+ }
+}
+
+public func streamToArrowSchema(_ schema: Data) throws -> ArrowSchema {
+ let schemaResult = ArrowReader().fromStream(schema)
+ switch schemaResult {
+ case .success(let result):
+ if let retSchema = result.schema {
+ return retSchema
+ }
+
+ throw ArrowFlightError.IOError("Schema not found")
+ case .failure(let error):
+ throw error
+ }
+}
+
+public protocol ArrowFlightServer : Sendable {
+ func listFlights(_ criteria: FlightCriteria, writer: FlightInfoStreamWriter) async throws
+ func getFlightInfo(_ request: FlightDescriptor) async throws -> FlightInfo
+ func getSchema(_ request: FlightDescriptor) async throws -> ArrowFlight.FlightSchemaResult
+ func listActions(_ writer: ActionTypeStreamWriter) async throws
+ func doAction(_ action: FlightAction, writer: ResultStreamWriter) async throws
+ func doGet(_ ticket: FlightTicket, writer: RecordBatchStreamWriter) async throws;
+ func doPut(_ reader: RecordBatchStreamReader, writer: PutResultDataStreamWriter) async throws
+ func doExchange(_ reader: RecordBatchStreamReader, writer: RecordBatchStreamWriter) async throws
+}
+
+public func MakeFlightServer(_ handler: ArrowFlightServer) -> CallHandlerProvider {
+ return InternalFlightServer(handler)
+}
+
+internal final class InternalFlightServer : Arrow_Flight_Protocol_FlightServiceAsyncProvider {
+ let arrowFlightServer: ArrowFlightServer?
+
+ init(_ arrowFlightServer: ArrowFlightServer?) {
+ self.arrowFlightServer = arrowFlightServer
+ }
+
+ func handshake(requestStream: GRPC.GRPCAsyncRequestStream<Arrow_Flight_Protocol_HandshakeRequest>, responseStream: GRPC.GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_HandshakeResponse>, context: GRPC.GRPCAsyncServerCallContext) async throws {
+ throw ArrowFlightError.NotImplemented()
+ }
+
+ func listFlights(request: Arrow_Flight_Protocol_Criteria, responseStream: GRPC.GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightInfo>, context: GRPC.GRPCAsyncServerCallContext) async throws {
+ if let server = arrowFlightServer {
+ let writer = FlightInfoStreamWriter(responseStream)
+ try await server.listFlights(FlightCriteria(request), writer: writer)
+ return
+ }
+
+ throw ArrowFlightError.NotImplemented()
+ }
+
+ func getFlightInfo(request: Arrow_Flight_Protocol_FlightDescriptor, context: GRPC.GRPCAsyncServerCallContext) async throws -> Arrow_Flight_Protocol_FlightInfo {
+ if let server = arrowFlightServer {
+ return try await server.getFlightInfo(FlightDescriptor(request)).toProtocol()
+ }
+
+ throw ArrowFlightError.NotImplemented()
+ }
+
+ func getSchema(request: Arrow_Flight_Protocol_FlightDescriptor, context: GRPC.GRPCAsyncServerCallContext) async throws -> Arrow_Flight_Protocol_SchemaResult {
+ if let server = arrowFlightServer {
+ return try await server.getSchema(FlightDescriptor(request)).toProtocol()
+ }
+
+ throw ArrowFlightError.NotImplemented()
+ }
+
+ func doGet(request: Arrow_Flight_Protocol_Ticket, responseStream: GRPC.GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightData>, context: GRPC.GRPCAsyncServerCallContext) async throws {
+ if let server = arrowFlightServer {
+ let writer = RecordBatchStreamWriter(responseStream)
+ let ticket = FlightTicket(request)
+ try await server.doGet(ticket, writer: writer)
+ return
+ }
+
+ throw ArrowFlightError.NotImplemented()
+ }
+
+ func doPut(requestStream: GRPC.GRPCAsyncRequestStream<Arrow_Flight_Protocol_FlightData>, responseStream: GRPC.GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_PutResult>, context: GRPC.GRPCAsyncServerCallContext) async throws {
+ if let server = arrowFlightServer {
+ let reader = RecordBatchStreamReader(requestStream)
+ let writer = PutResultDataStreamWriter(responseStream)
+ try await server.doPut(reader, writer: writer)
+ return
+ }
+
+ throw ArrowFlightError.NotImplemented()
+ }
+
+ func doExchange(requestStream: GRPC.GRPCAsyncRequestStream<Arrow_Flight_Protocol_FlightData>, responseStream: GRPC.GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightData>, context: GRPC.GRPCAsyncServerCallContext) async throws {
+ if let server = arrowFlightServer {
+ let reader = RecordBatchStreamReader(requestStream)
+ let writer = RecordBatchStreamWriter(responseStream)
+ try await server.doExchange(reader, writer: writer)
+ return
+ }
+
+ throw ArrowFlightError.NotImplemented()
+ }
+
+ func doAction(request: Arrow_Flight_Protocol_Action, responseStream: GRPC.GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_Result>, context: GRPC.GRPCAsyncServerCallContext) async throws {
+ if let server = arrowFlightServer {
+ try await server.doAction(FlightAction(request), writer: ResultStreamWriter(responseStream))
+ return
+ }
+
+ throw ArrowFlightError.NotImplemented()
+ }
+
+ func listActions(request: Arrow_Flight_Protocol_Empty, responseStream: GRPC.GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_ActionType>, context: GRPC.GRPCAsyncServerCallContext) async throws {
+ if let server = arrowFlightServer {
+ let writer = ActionTypeStreamWriter(responseStream)
+ try await server.listActions(writer)
+ return
+ }
+
+ throw ArrowFlightError.NotImplemented()
+ }
+
+ internal var interceptors: Arrow_Flight_Protocol_FlightServiceServerInterceptorFactoryProtocol? { get { return nil } }
+
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/FlightTicket.swift b/ArrowFlight/Sources/ArrowFlight/FlightTicket.swift
new file mode 100644
index 0000000..f77fc35
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/FlightTicket.swift
@@ -0,0 +1,35 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+
+public class FlightTicket {
+ public let data: Data
+ init(_ ticket: Arrow_Flight_Protocol_Ticket) {
+ self.data = ticket.ticket
+ }
+
+ public init(_ data: Data) {
+ self.data = data
+ }
+
+ func toProtocol() -> Arrow_Flight_Protocol_Ticket {
+ var ticket = Arrow_Flight_Protocol_Ticket()
+ ticket.ticket = self.data
+ return ticket
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/RecordBatchStreamReader.swift b/ArrowFlight/Sources/ArrowFlight/RecordBatchStreamReader.swift
new file mode 100644
index 0000000..a6b9ce9
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/RecordBatchStreamReader.swift
@@ -0,0 +1,67 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+import Arrow
+import GRPC
+
+public class RecordBatchStreamReader: AsyncSequence, AsyncIteratorProtocol {
+ public typealias AsyncIterator = RecordBatchStreamReader
+ public typealias Element = RecordBatch
+ let reader = ArrowReader()
+ var batches = [RecordBatch]()
+ var batchIndex = 0
+ var streamIterator: any AsyncIteratorProtocol
+ let stream: GRPC.GRPCAsyncRequestStream<Arrow_Flight_Protocol_FlightData>
+ init(_ stream: GRPC.GRPCAsyncRequestStream<Arrow_Flight_Protocol_FlightData>) {
+ self.stream = stream
+ self.streamIterator = self.stream.makeAsyncIterator()
+ }
+
+ public func next() async throws -> Arrow.RecordBatch? {
+ guard !Task.isCancelled else {
+ return nil
+ }
+
+ if batchIndex < batches.count {
+ let batch = batches[batchIndex]
+ batchIndex += 1
+ return batch
+ }
+
+ while true {
+ let flightData = try await self.streamIterator.next()
+ if flightData == nil {
+ return nil
+ }
+
+ let data = (flightData as! Arrow_Flight_Protocol_FlightData).dataBody
+ switch reader.fromStream(data) {
+ case .success(let rbResult):
+ batches = rbResult.batches
+ batchIndex = 1
+ return batches[0]
+ case .failure(let error):
+ throw error
+ }
+ }
+ }
+
+ public func makeAsyncIterator() -> RecordBatchStreamReader {
+ self
+ }
+}
diff --git a/ArrowFlight/Sources/ArrowFlight/RecordBatchStreamWriter.swift b/ArrowFlight/Sources/ArrowFlight/RecordBatchStreamWriter.swift
new file mode 100644
index 0000000..1efeba5
--- /dev/null
+++ b/ArrowFlight/Sources/ArrowFlight/RecordBatchStreamWriter.swift
@@ -0,0 +1,91 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import Foundation
+import Arrow
+import GRPC
+
+public class ActionTypeStreamWriter {
+ let stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_ActionType>
+ init(_ stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_ActionType>) {
+ self.stream = stream
+ }
+
+ public func write(_ actionType: FlightActionType) async throws {
+ try await self.stream.send(actionType.toProtocol())
+ }
+}
+
+public class ResultStreamWriter {
+ let stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_Result>
+ init(_ stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_Result>) {
+ self.stream = stream
+ }
+
+ public func write(_ result: FlightResult) async throws {
+ try await self.stream.send(result.toProtocol())
+ }
+}
+
+public class FlightInfoStreamWriter {
+ let stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightInfo>
+ init(_ stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightInfo>) {
+ self.stream = stream
+ }
+
+ public func write(_ result: FlightInfo) async throws {
+ try await self.stream.send(result.toProtocol())
+ }
+}
+
+public class PutResultDataStreamWriter {
+ let stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_PutResult>
+ init(_ stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_PutResult>) {
+ self.stream = stream
+ }
+
+ public func write(_ result: FlightPutResult) async throws {
+ try await self.stream.send(result.toProtocol())
+ }
+}
+
+public class RecordBatchStreamWriter {
+ let writer = ArrowWriter()
+ let stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightData>
+ init(_ stream: GRPCAsyncResponseStreamWriter<Arrow_Flight_Protocol_FlightData>) {
+ self.stream = stream
+ }
+
+ public func write(_ rb: RecordBatch) async throws {
+ let info = ArrowWriter.Info(.recordbatch,
+ schema: rb.schema,
+ batches: [rb]
+ )
+
+ let result = writer.toStream(info)
+ switch result {
+ case .success(let rbResult):
+ let data = Arrow_Flight_Protocol_FlightData.with {
+ $0.dataBody = rbResult
+ }
+
+ try await self.stream.send(data)
+ case .failure(let error):
+ throw error
+ }
+ }
+}
diff --git a/ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift b/ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift
new file mode 100644
index 0000000..d0db593
--- /dev/null
+++ b/ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift
@@ -0,0 +1,302 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import XCTest
+import struct Foundation.Data
+import struct Foundation.URL
+import GRPC
+import NIOCore
+import NIOPosix
+import Arrow
+
+@testable import ArrowFlight
+
+func makeSchema() -> ArrowSchema {
+ let schemaBuilder = ArrowSchema.Builder()
+ return schemaBuilder.addField("col1", type: ArrowType(ArrowType.ArrowUInt8), isNullable: true)
+ .addField("col2", type: ArrowType(ArrowType.ArrowString), isNullable: false)
+ .addField("col3", type: ArrowType(ArrowType.ArrowDate32), isNullable: false)
+ .finish()
+}
+
+func makeRecordBatch() throws -> RecordBatch {
+ let uint8Builder: NumberArrayBuilder<UInt8> = try ArrowArrayBuilders.loadNumberArrayBuilder()
+ uint8Builder.append(10)
+ uint8Builder.append(22)
+ uint8Builder.append(33)
+ uint8Builder.append(44)
+ let stringBuilder = try ArrowArrayBuilders.loadStringArrayBuilder()
+ stringBuilder.append("test10")
+ stringBuilder.append("test22")
+ stringBuilder.append("test33")
+ stringBuilder.append("test44")
+ let date32Builder = try ArrowArrayBuilders.loadDate32ArrayBuilder()
+ let date2 = Date(timeIntervalSinceReferenceDate: 86400 * 1)
+ let date1 = Date(timeIntervalSinceReferenceDate: 86400 * 5000 + 352)
+ date32Builder.append(date1)
+ date32Builder.append(date2)
+ date32Builder.append(date1)
+ date32Builder.append(date2)
+ let intHolder = ArrowArrayHolder(try uint8Builder.finish())
+ let stringHolder = ArrowArrayHolder(try stringBuilder.finish())
+ let date32Holder = ArrowArrayHolder(try date32Builder.finish())
+ let result = RecordBatch.Builder()
+ .addColumn("col1", arrowArray: intHolder)
+ .addColumn("col2", arrowArray: stringHolder)
+ .addColumn("col3", arrowArray: date32Holder)
+ .finish()
+ switch result {
+ case .success(let recordBatch):
+ return recordBatch
+ case .failure(let error):
+ throw error
+ }
+}
+
+final class MyFlightServer : ArrowFlightServer {
+ func doExchange(_ reader: ArrowFlight.RecordBatchStreamReader, writer: ArrowFlight.RecordBatchStreamWriter) async throws {
+ do {
+ for try await rb in reader {
+ XCTAssertEqual(rb.schema.fields.count, 3)
+ XCTAssertEqual(rb.length, 4)
+ }
+
+ let rb = try makeRecordBatch()
+ try await writer.write(rb)
+ } catch {
+ print("Unknown error: \(error)")
+ }
+ }
+
+ func doPut(_ reader: ArrowFlight.RecordBatchStreamReader, writer: ArrowFlight.PutResultDataStreamWriter) async throws {
+ for try await rb in reader {
+ XCTAssertEqual(rb.schema.fields.count, 3)
+ XCTAssertEqual(rb.length, 4)
+ try await writer.write(FlightPutResult())
+ }
+ }
+
+ func doGet(_ ticket: ArrowFlight.FlightTicket, writer: ArrowFlight.RecordBatchStreamWriter) async throws {
+ try await writer.write(try makeRecordBatch())
+ }
+
+ func getSchema(_ request: ArrowFlight.FlightDescriptor) async throws -> ArrowFlight.FlightSchemaResult {
+ XCTAssertEqual(String(bytes: request.cmd, encoding: .utf8)!, "schema info")
+ XCTAssertEqual(request.type, .cmd)
+ return try ArrowFlight.FlightSchemaResult(schemaToArrowStream(makeSchema()))
+ }
+
+ func getFlightInfo(_ request: ArrowFlight.FlightDescriptor) async throws -> ArrowFlight.FlightInfo {
+ return ArrowFlight.FlightInfo(Data())
+ }
+
+ func listFlights(_ criteria: ArrowFlight.FlightCriteria, writer: ArrowFlight.FlightInfoStreamWriter) async throws {
+ XCTAssertEqual(String(bytes: criteria.expression, encoding: .utf8), "flight criteria expression")
+ let flight_info = try ArrowFlight.FlightInfo(schemaToArrowStream(makeSchema()))
+ try await writer.write(flight_info)
+ }
+
+ func listActions(_ writer: ArrowFlight.ActionTypeStreamWriter) async throws {
+ try await writer.write(FlightActionType("type1", description: "desc1"))
+ try await writer.write(FlightActionType("type2", description: "desc2"))
+ }
+
+ func doAction(_ action: FlightAction, writer: ResultStreamWriter) async throws {
+ XCTAssertEqual(action.type, "test_action")
+ XCTAssertEqual(String(bytes: action.body, encoding: .utf8)!, "test_action body")
+ try await writer.write(FlightResult("test_action result".data(using: .utf8)!))
+ }
+}
+
+struct FlightServerImpl {
+ var port = 1234
+ static var server: Server?
+ static var group: MultiThreadedEventLoopGroup?
+ static func run() async throws {
+ do {
+ // Create an event loop group for the server to run on.
+ let group = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)
+ // Create a provider using the features we read.
+ let provider = ArrowFlight.MakeFlightServer(MyFlightServer())
+
+ // Start the server and print its address once it has started.
+ FlightServerImpl.server = try await Server.insecure(group: group)
+ .withServiceProviders([provider])
+ .bind(host: "localhost", port: 8088)
+ .get()
+
+ print("server started on port \(server!.channel.localAddress!.port!)")
+
+ // Wait on the server's `onClose` future to stop the program from exiting.
+ } catch {
+ print("Unknown server error: \(error)")
+ }
+ }
+}
+
+public class FlightClientTester {
+ var client: FlightClient?
+ var group: MultiThreadedEventLoopGroup?
+ var channel: GRPCChannel?
+
+ init() async throws {
+ // Load the features.
+ let group = PlatformSupport.makeEventLoopGroup(loopCount: 1)
+ let channel = try GRPCChannelPool.with(
+ target: .host("localhost", port: 8088),
+ transportSecurity: .plaintext,
+ eventLoopGroup: group
+ )
+
+ client = FlightClient(channel: channel)
+ }
+
+ deinit {
+ try? group?.syncShutdownGracefully()
+ try? channel?.close().wait()
+ }
+
+ func listActionTest() async throws {
+ var actionTypes = [FlightActionType]()
+ try await client?.listActions( { action in
+ actionTypes.append(action)
+ })
+
+ XCTAssertEqual(actionTypes.count, 2)
+ XCTAssertEqual(actionTypes[0].type, "type1")
+ XCTAssertEqual(actionTypes[0].description, "desc1")
+ XCTAssertEqual(actionTypes[1].type, "type2")
+ XCTAssertEqual(actionTypes[1].description, "desc2")
+ }
+
+ func listFlightsTest() async throws {
+ let flightCriteria = FlightCriteria("flight criteria expression".data(using: .utf8)!)
+ var num_calls = 0
+ try await client?.listFlights(flightCriteria, closure: { data in
+ num_calls += 1
+ let schema = try streamToArrowSchema(data.schema)
+ XCTAssertEqual(schema.fields.count, 3)
+ })
+
+ XCTAssertEqual(num_calls, 1)
+ }
+
+ func doActionTest() async throws {
+ let action = FlightAction("test_action", body: "test_action body".data(using: .utf8)!)
+ var actionResults = [FlightResult]()
+ try await client?.doAction(action, closure: { result in
+ actionResults.append(result)
+ })
+
+ XCTAssertEqual(actionResults.count, 1)
+ XCTAssertEqual(String(bytes:actionResults[0].body, encoding: .utf8), "test_action result")
+ }
+
+ func getSchemaTest() async throws {
+ let descriptor = FlightDescriptor(cmd: "schema info".data(using: .utf8)!)
+ let schemaResult = try await client?.getSchema(descriptor)
+ let schema = try streamToArrowSchema(schemaResult!.schema)
+ XCTAssertEqual(schema.fields.count, 3)
+ }
+
+ func doGetTest() async throws {
+ let ticket = FlightTicket("flight_ticket test".data(using: .utf8)!)
+ var num_call = 0
+ try await client?.doGet(ticket, readerResultClosure: { rb in
+ num_call += 1
+ XCTAssertEqual(rb.schema!.fields.count, 3)
+ XCTAssertEqual(rb.batches[0].length, 4)
+ })
+
+ XCTAssertEqual(num_call, 1)
+ }
+
+ func doPutTest() async throws {
+ let rb = try makeRecordBatch()
+ var num_call = 0
+ try await client?.doPut([rb], closure: { result in
+ num_call += 1
+ })
+
+ XCTAssertEqual(num_call, 1)
+ }
+
+ func doExchangeTest() async throws {
+ let rb = try makeRecordBatch()
+ var num_call = 0
+ try await client?.doExchange([rb], closure: { result in
+ num_call += 1
+ XCTAssertEqual(result.schema?.fields.count, 3)
+ XCTAssertEqual(result.batches[0].length, 4)
+ })
+
+ XCTAssertEqual(num_call, 1)
+ }
+}
+
+actor FlightServerData {
+ public var serverup = false
+ func SetServerUp(_ serverUp: Bool) {
+ self.serverup = serverUp
+ }
+
+ func IsServerUp() -> Bool {
+ return serverup
+ }
+}
+
+final class FlightTest: XCTestCase {
+ let serverData = FlightServerData()
+
+ func testFlightServer() async throws {
+ let basicTask = Task {
+ try await FlightServerImpl.run()
+ defer {
+ print("server shutting down")
+ try! FlightServerImpl.group?.syncShutdownGracefully()
+ }
+
+ await serverData.SetServerUp(true)
+ try await FlightServerImpl.server?.onClose.get()
+ return "done"
+ }
+
+ let secondTask = Task {
+ defer {
+ _ = FlightServerImpl.server?.close()
+ }
+
+ while await !serverData.IsServerUp() {
+ try await Task.sleep(nanoseconds: 1_000_000)
+ }
+
+ let clientImpl = try await FlightClientTester()
+ try await clientImpl.listActionTest()
+ try await clientImpl.listFlightsTest()
+ try await clientImpl.doActionTest()
+ try await clientImpl.getSchemaTest()
+ try await clientImpl.doGetTest()
+ try await clientImpl.doPutTest()
+ try await clientImpl.doExchangeTest()
+
+ return "done"
+ }
+
+ let _ = try await [basicTask.value, secondTask.value]
+ print("done running")
+ }
+}
diff --git a/gen-protobuffers.sh b/gen-protobuffers.sh
new file mode 100755
index 0000000..383a7a2
--- /dev/null
+++ b/gen-protobuffers.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -eu
+protoc --swift_out=./ArrowFlight/Sources/ArrowFlight --proto_path=../format Flight.proto
+protoc --grpc-swift_out=./ArrowFlight/Sources/ArrowFlight --proto_path=../format Flight.proto
+cat <<HEADER > header.swift
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+HEADER
+mv ./ArrowFlight/Sources/ArrowFlight/Flight.grpc.swift ./ArrowFlight/Sources/ArrowFlight/Flight.grpc.swift.orig
+cat header.swift ./ArrowFlight/Sources/ArrowFlight/Flight.grpc.swift.orig > ./ArrowFlight/Sources/ArrowFlight/Flight.grpc.swift
+rm ./ArrowFlight/Sources/ArrowFlight/Flight.grpc.swift.orig
+rm header.swift
\ No newline at end of file