blob: 254ef542992a7d7708ec2c1b25759cfe5c521c8b [file] [log] [blame]
//
// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the protocol buffer compiler.
// Source: org/apache/beam/model/fn_execution/v1/beam_provision_api.proto
//
//
// Copyright 2018, gRPC Authors All rights reserved.
//
// Licensed 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 GRPC
import NIO
import NIOConcurrencyHelpers
import SwiftProtobuf
/// A service to provide runtime provisioning information to the SDK harness
/// worker instances -- such as pipeline options, resource constraints and
/// other job metadata -- needed by an SDK harness instance to initialize.
///
/// Usage: instantiate `Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClient`, then call methods of this protocol to make API calls.
internal protocol Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientProtocol: GRPCClient {
var serviceName: String { get }
var interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol? { get }
func getProvisionInfo(
_ request: Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest,
callOptions: CallOptions?
) -> UnaryCall<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest, Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse>
}
extension Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientProtocol {
internal var serviceName: String {
return "org.apache.beam.model.fn_execution.v1.ProvisionService"
}
/// Get provision information for the SDK harness worker instance.
///
/// - Parameters:
/// - request: Request to send to GetProvisionInfo.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getProvisionInfo(
_ request: Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest,
callOptions: CallOptions? = nil
) -> UnaryCall<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest, Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse> {
return self.makeUnaryCall(
path: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientMetadata.Methods.getProvisionInfo.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetProvisionInfoInterceptors() ?? []
)
}
}
@available(*, deprecated)
extension Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClient: @unchecked Sendable {}
@available(*, deprecated, renamed: "Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceNIOClient")
internal final class Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClient: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientProtocol {
private let lock = Lock()
private var _defaultCallOptions: CallOptions
private var _interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol?
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: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol? {
get { self.lock.withLock { return self._interceptors } }
set { self.lock.withLockVoid { self._interceptors = newValue } }
}
/// Creates a client for the org.apache.beam.model.fn_execution.v1.ProvisionService 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: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol? = nil
) {
self.channel = channel
self._defaultCallOptions = defaultCallOptions
self._interceptors = interceptors
}
}
internal struct Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceNIOClient: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientProtocol {
internal var channel: GRPCChannel
internal var defaultCallOptions: CallOptions
internal var interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol?
/// Creates a client for the org.apache.beam.model.fn_execution.v1.ProvisionService 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: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol? = nil
) {
self.channel = channel
self.defaultCallOptions = defaultCallOptions
self.interceptors = interceptors
}
}
/// A service to provide runtime provisioning information to the SDK harness
/// worker instances -- such as pipeline options, resource constraints and
/// other job metadata -- needed by an SDK harness instance to initialize.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
internal protocol Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceAsyncClientProtocol: GRPCClient {
static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol? { get }
func makeGetProvisionInfoCall(
_ request: Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest, Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse>
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceAsyncClientProtocol {
internal static var serviceDescriptor: GRPCServiceDescriptor {
return Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientMetadata.serviceDescriptor
}
internal var interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol? {
return nil
}
internal func makeGetProvisionInfoCall(
_ request: Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest, Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse> {
return self.makeAsyncUnaryCall(
path: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientMetadata.Methods.getProvisionInfo.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetProvisionInfoInterceptors() ?? []
)
}
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceAsyncClientProtocol {
internal func getProvisionInfo(
_ request: Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest,
callOptions: CallOptions? = nil
) async throws -> Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse {
return try await self.performAsyncUnaryCall(
path: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientMetadata.Methods.getProvisionInfo.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetProvisionInfoInterceptors() ?? []
)
}
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
internal struct Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceAsyncClient: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceAsyncClientProtocol {
internal var channel: GRPCChannel
internal var defaultCallOptions: CallOptions
internal var interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol?
internal init(
channel: GRPCChannel,
defaultCallOptions: CallOptions = CallOptions(),
interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol? = nil
) {
self.channel = channel
self.defaultCallOptions = defaultCallOptions
self.interceptors = interceptors
}
}
internal protocol Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientInterceptorFactoryProtocol: Sendable {
/// - Returns: Interceptors to use when invoking 'getProvisionInfo'.
func makeGetProvisionInfoInterceptors() -> [ClientInterceptor<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest, Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse>]
}
internal enum Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientMetadata {
internal static let serviceDescriptor = GRPCServiceDescriptor(
name: "ProvisionService",
fullName: "org.apache.beam.model.fn_execution.v1.ProvisionService",
methods: [
Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceClientMetadata.Methods.getProvisionInfo,
]
)
internal enum Methods {
internal static let getProvisionInfo = GRPCMethodDescriptor(
name: "GetProvisionInfo",
path: "/org.apache.beam.model.fn_execution.v1.ProvisionService/GetProvisionInfo",
type: GRPCCallType.unary
)
}
}
/// A service to provide runtime provisioning information to the SDK harness
/// worker instances -- such as pipeline options, resource constraints and
/// other job metadata -- needed by an SDK harness instance to initialize.
///
/// To build a server, implement a class that conforms to this protocol.
internal protocol Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceProvider: CallHandlerProvider {
var interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceServerInterceptorFactoryProtocol? { get }
/// Get provision information for the SDK harness worker instance.
func getProvisionInfo(request: Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse>
}
extension Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceProvider {
internal var serviceName: Substring {
return Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceServerMetadata.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 "GetProvisionInfo":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest>(),
responseSerializer: ProtobufSerializer<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse>(),
interceptors: self.interceptors?.makeGetProvisionInfoInterceptors() ?? [],
userFunction: self.getProvisionInfo(request:context:)
)
default:
return nil
}
}
}
/// A service to provide runtime provisioning information to the SDK harness
/// worker instances -- such as pipeline options, resource constraints and
/// other job metadata -- needed by an SDK harness instance to initialize.
///
/// To implement a server, implement an object which conforms to this protocol.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
internal protocol Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceAsyncProvider: CallHandlerProvider, Sendable {
static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceServerInterceptorFactoryProtocol? { get }
/// Get provision information for the SDK harness worker instance.
func getProvisionInfo(
request: Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest,
context: GRPCAsyncServerCallContext
) async throws -> Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceAsyncProvider {
internal static var serviceDescriptor: GRPCServiceDescriptor {
return Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceServerMetadata.serviceDescriptor
}
internal var serviceName: Substring {
return Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceServerMetadata.serviceDescriptor.fullName[...]
}
internal var interceptors: Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceServerInterceptorFactoryProtocol? {
return nil
}
internal func handle(
method name: Substring,
context: CallHandlerContext
) -> GRPCServerHandlerProtocol? {
switch name {
case "GetProvisionInfo":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest>(),
responseSerializer: ProtobufSerializer<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse>(),
interceptors: self.interceptors?.makeGetProvisionInfoInterceptors() ?? [],
wrapping: { try await self.getProvisionInfo(request: $0, context: $1) }
)
default:
return nil
}
}
}
internal protocol Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceServerInterceptorFactoryProtocol: Sendable {
/// - Returns: Interceptors to use when handling 'getProvisionInfo'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetProvisionInfoInterceptors() -> [ServerInterceptor<Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoRequest, Org_Apache_Beam_Model_FnExecution_V1_GetProvisionInfoResponse>]
}
internal enum Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceServerMetadata {
internal static let serviceDescriptor = GRPCServiceDescriptor(
name: "ProvisionService",
fullName: "org.apache.beam.model.fn_execution.v1.ProvisionService",
methods: [
Org_Apache_Beam_Model_FnExecution_V1_ProvisionServiceServerMetadata.Methods.getProvisionInfo,
]
)
internal enum Methods {
internal static let getProvisionInfo = GRPCMethodDescriptor(
name: "GetProvisionInfo",
path: "/org.apache.beam.model.fn_execution.v1.ProvisionService/GetProvisionInfo",
type: GRPCCallType.unary
)
}
}