Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deployment targets to the package manifest #10

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ let targets: [Target] = [

let package = Package(
name: "grpc-swift-nio-transport",
platforms: [
.macOS(.v15),
.iOS(.v18),
.tvOS(.v18),
.watchOS(.v11),
.visionOS(.v2),
],
products: products,
dependencies: dependencies,
targets: targets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ private import Synchronization
/// }
/// }
/// ```
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package final class Connection: Sendable {
/// Events which can happen over the lifetime of the connection.
package enum Event: Sendable {
Expand Down Expand Up @@ -350,7 +349,6 @@ package final class Connection: Sendable {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Connection {
package struct Stream {
package typealias Inbound = NIOAsyncChannelInboundStream<RPCResponsePart>
Expand Down Expand Up @@ -412,7 +410,6 @@ extension Connection {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Connection {
private enum State: Sendable {
/// The connection is idle or connecting.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
package struct ConnectionBackoff {
package var initial: Duration
package var max: Duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ package import NIOCore
package import NIOHTTP2
internal import NIOPosix

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
package protocol HTTP2Connector: Sendable {
func establishConnection(to address: SocketAddress) async throws -> HTTP2Connection
}

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
package struct HTTP2Connection: Sendable {
/// The underlying TCP connection wrapped up for use with gRPC.
var channel: NIOAsyncChannel<ClientConnectionEvent, Void>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ private import DequeModule
package import GRPCCore
private import Synchronization

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package final class GRPCChannel: ClientTransport {
private enum Input: Sendable {
/// Close the channel, if possible.
Expand Down Expand Up @@ -225,7 +224,6 @@ package final class GRPCChannel: ClientTransport {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension GRPCChannel {
package struct Config: Sendable {
/// Configuration for HTTP/2 connections.
Expand Down Expand Up @@ -254,7 +252,6 @@ extension GRPCChannel {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension GRPCChannel {
enum MakeStreamResult {
/// A stream was created, use it.
Expand Down Expand Up @@ -347,7 +344,6 @@ extension GRPCChannel {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension GRPCChannel {
private func handleClose(in group: inout DiscardingTaskGroup) {
switch self.state.withLock({ $0.close() }) {
Expand Down Expand Up @@ -574,7 +570,6 @@ extension GRPCChannel {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension GRPCChannel {
struct StateMachine {
enum State {
Expand Down Expand Up @@ -649,7 +644,6 @@ extension GRPCChannel {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension GRPCChannel.StateMachine {
mutating func start() {
precondition(!self.running, "channel must only be started once")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
* limitations under the License.
*/

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package enum LoadBalancer: Sendable {
case roundRobin(RoundRobinLoadBalancer)
case pickFirst(PickFirstLoadBalancer)
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension LoadBalancer {
package init(_ loadBalancer: RoundRobinLoadBalancer) {
self = .roundRobin(loadBalancer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ private import Synchronization
/// }
/// }
/// ```
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package final class PickFirstLoadBalancer: Sendable {
enum Input: Sendable, Hashable {
/// Update the addresses used by the load balancer to the following endpoints.
Expand Down Expand Up @@ -165,7 +164,6 @@ package final class PickFirstLoadBalancer: Sendable {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension PickFirstLoadBalancer {
private func handleUpdateEndpoint(_ endpoint: Endpoint, in group: inout DiscardingTaskGroup) {
if endpoint.addresses.isEmpty { return }
Expand Down Expand Up @@ -266,7 +264,6 @@ extension PickFirstLoadBalancer {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension PickFirstLoadBalancer {
enum State: Sendable {
case active(Active)
Expand All @@ -279,7 +276,6 @@ extension PickFirstLoadBalancer {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension PickFirstLoadBalancer.State {
struct Active: Sendable {
var endpoint: Endpoint?
Expand Down Expand Up @@ -308,7 +304,6 @@ extension PickFirstLoadBalancer.State {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension PickFirstLoadBalancer.State.Active {
mutating func updateEndpoint(
_ endpoint: Endpoint,
Expand Down Expand Up @@ -471,7 +466,6 @@ extension PickFirstLoadBalancer.State.Active {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension PickFirstLoadBalancer.State.Closing {
mutating func updateSubchannelConnectivityState(
_ connectivityState: ConnectivityState,
Expand Down Expand Up @@ -512,7 +506,6 @@ extension PickFirstLoadBalancer.State.Closing {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension PickFirstLoadBalancer.State {
enum OnUpdateEndpoint {
case connect(Subchannel, close: Subchannel?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ private import NIOConcurrencyHelpers
/// }
/// }
/// ```
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package final class RoundRobinLoadBalancer: Sendable {
enum Input: Sendable, Hashable {
/// Update the addresses used by the load balancer to the following endpoints.
Expand Down Expand Up @@ -198,7 +197,6 @@ package final class RoundRobinLoadBalancer: Sendable {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension RoundRobinLoadBalancer {
/// Handles an update in endpoints.
///
Expand Down Expand Up @@ -340,7 +338,6 @@ extension RoundRobinLoadBalancer {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension RoundRobinLoadBalancer {
private enum State {
case active(Active)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ private import Synchronization
/// }
/// }
/// ```
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package final class Subchannel: Sendable {
package enum Event: Sendable, Hashable {
/// The connection received a GOAWAY and will close soon. No new streams
Expand Down Expand Up @@ -117,7 +116,6 @@ package final class Subchannel: Sendable {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Subchannel {
/// A stream of events which can happen to the subchannel.
package var events: AsyncStream<Event> {
Expand Down Expand Up @@ -190,7 +188,6 @@ extension Subchannel {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Subchannel {
private func handleConnectInput(in group: inout DiscardingTaskGroup) {
let connection = self.state.withLock { state in
Expand Down Expand Up @@ -368,7 +365,6 @@ extension Subchannel {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Subchannel {
/// ┌───────────────┐
/// ┌───────▶│ NOT CONNECTED │───────────shutDown─────────────┐
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

internal import DequeModule

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
struct RequestQueue {
typealias Continuation = CheckedContinuation<LoadBalancer, any Error>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ internal import GRPCCore
internal import NIOCore
internal import NIOHTTP2

@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
final class GRPCClientStreamHandler: ChannelDuplexHandler {
typealias InboundIn = HTTP2Frame.FramePayload
typealias InboundOut = RPCResponsePart
Expand Down Expand Up @@ -56,7 +55,6 @@ final class GRPCClientStreamHandler: ChannelDuplexHandler {

// - MARK: ChannelInboundHandler

@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
extension GRPCClientStreamHandler {
func channelRead(context: ChannelHandlerContext, data: NIOAny) {
self.isReading = true
Expand Down Expand Up @@ -176,7 +174,6 @@ extension GRPCClientStreamHandler {

// - MARK: ChannelOutboundHandler

@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
extension GRPCClientStreamHandler {
func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?) {
switch self.unwrapOutboundIn(data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ extension HTTP2ClientTransport.Config {
}
}

@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
public struct Keepalive: Sendable, Hashable {
/// The amount of time to wait after reading data before sending a keepalive ping.
///
Expand All @@ -72,7 +71,6 @@ extension HTTP2ClientTransport.Config {
}
}

@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
public struct Connection: Sendable, Hashable {
/// The maximum amount of time a connection may be idle before it's closed.
///
Expand Down Expand Up @@ -102,7 +100,6 @@ extension HTTP2ClientTransport.Config {
}
}

@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
public struct Backoff: Sendable, Hashable {
/// The initial duration to wait before reattempting to establish a connection.
public var initial: Duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ private import Musl
#error("The GRPCNIOTransportCore module was unable to identify your C library.")
#endif

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
/// An asynchronous non-blocking DNS resolver built on top of the libc `getaddrinfo` function.
package enum DNSResolver {
private static let dispatchQueue = DispatchQueue(
Expand Down Expand Up @@ -134,7 +133,6 @@ package enum DNSResolver {
}
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
extension DNSResolver {
/// `Error` that may be thrown based on the error code returned by `getaddrinfo`.
package struct GetAddrInfoError: Error, Hashable, CustomStringConvertible {
Expand All @@ -150,7 +148,6 @@ extension DNSResolver {
}
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
extension DNSResolver {
/// `Error` that may be thrown based on the system error encountered by `inet_ntop`.
package struct InetNetworkToPresentationError: Error, Hashable {
Expand All @@ -162,7 +159,6 @@ extension DNSResolver {
}
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
extension SocketAddress.IPv4 {
fileprivate init(_ address: sockaddr_in) throws {
let presentationAddress = try withUnsafePointer(to: address.sin_addr) { addressPtr in
Expand All @@ -177,7 +173,6 @@ extension SocketAddress.IPv4 {
}
}

@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
extension SocketAddress.IPv6 {
fileprivate init(_ address: sockaddr_in6) throws {
let presentationAddress = try withUnsafePointer(to: address.sin6_addr) { addressPtr in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ extension ResolvableTarget where Self == ResolvableTargets.DNS {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension NameResolvers {
/// A ``NameResolverFactory`` for ``ResolvableTargets/DNS`` targets.
public struct DNS: NameResolverFactory {
Expand All @@ -66,7 +65,6 @@ extension NameResolvers {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension NameResolvers.DNS {
struct Resolver: Sendable {
var target: ResolvableTargets.DNS
Expand Down Expand Up @@ -97,7 +95,6 @@ extension NameResolvers.DNS {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension NameResolvers.DNS.Resolver: AsyncSequence {
typealias Element = NameResolutionResult

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ extension ResolvableTarget where Self == ResolvableTargets.IPv4 {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension NameResolvers {
/// A ``NameResolverFactory`` for ``ResolvableTargets/IPv4`` targets.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ extension ResolvableTarget where Self == ResolvableTargets.IPv6 {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension NameResolvers {
/// A ``NameResolverFactory`` for ``ResolvableTargets/IPv6`` targets.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ extension ResolvableTarget where Self == ResolvableTargets.UnixDomainSocket {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension NameResolvers {
/// A ``NameResolverFactory`` for ``ResolvableTargets/UnixDomainSocket`` targets.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ extension ResolvableTarget where Self == ResolvableTargets.VirtualSocket {
}
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension NameResolvers {
/// A ``NameResolverFactory`` for ``ResolvableTargets/VirtualSocket`` targets.
///
Expand Down
Loading
Loading