Skip to content

Commit 5dba280

Browse files
committed
Add deprecation warnings
Motivation: v2 has moved to a new repo, grpc-swift-2. That's not all that discoverable. Modifications: - Deprecate commonly used high-level types with a link to a forums post explaining the move. Result: Users are notified about the move
1 parent 36e1ad1 commit 5dba280

File tree

7 files changed

+11
-0
lines changed

7 files changed

+11
-0
lines changed

Sources/GRPCCore/Call/Server/RegistrableRPCService.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
/// ``RPCRouter/registerHandler(forMethod:deserializer:serializer:handler:)`` for each method
2424
/// you want to register with the router.
2525
@available(gRPCSwift 2.0, *)
26+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
2627
public protocol RegistrableRPCService: Sendable {
2728
/// Registers methods to server with the provided ``RPCRouter``.
2829
///

Sources/GRPCCore/GRPCClient.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ private import Synchronization
5555
/// additional resources that need their lifecycles managed you should consider using [Swift Service
5656
/// Lifecycle](https://github.com/swift-server/swift-service-lifecycle).
5757
@available(gRPCSwift 2.0, *)
58+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
5859
public final class GRPCClient<Transport: ClientTransport>: Sendable {
5960
/// The transport which provides a bidirectional communication channel with the server.
6061
private let transport: Transport
@@ -399,6 +400,7 @@ public final class GRPCClient<Transport: ClientTransport>: Sendable {
399400
/// - handleClient: A closure which is called with the client. When the closure returns, the
400401
/// client is shutdown gracefully.
401402
@available(gRPCSwift 2.0, *)
403+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
402404
public func withGRPCClient<Transport: ClientTransport, Result: Sendable>(
403405
transport: Transport,
404406
interceptors: [any ClientInterceptor] = [],
@@ -428,6 +430,7 @@ public func withGRPCClient<Transport: ClientTransport, Result: Sendable>(
428430
/// client is shutdown gracefully.
429431
/// - Returns: The result of the `handleClient` closure.
430432
@available(gRPCSwift 2.0, *)
433+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
431434
public func withGRPCClient<Transport: ClientTransport, Result: Sendable>(
432435
transport: Transport,
433436
interceptorPipeline: [ConditionalInterceptor<any ClientInterceptor>],

Sources/GRPCCore/GRPCServer.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ private import Synchronization
7676
/// Lifecycle](https://github.com/swift-server/swift-service-lifecycle) and the
7777
/// `GRPCServiceLifecycle` module provided by [gRPC Swift Extras](https://github.com/grpc/grpc-swift-extras).
7878
@available(gRPCSwift 2.0, *)
79+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
7980
public final class GRPCServer<Transport: ServerTransport>: Sendable {
8081
typealias Stream = RPCStream<Transport.Inbound, Transport.Outbound>
8182

@@ -259,6 +260,7 @@ public final class GRPCServer<Transport: ServerTransport>: Sendable {
259260
/// server is shutdown gracefully.
260261
/// - Returns: The result of the `handleServer` closure.
261262
@available(gRPCSwift 2.0, *)
263+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
262264
public func withGRPCServer<Transport: ServerTransport, Result: Sendable>(
263265
transport: Transport,
264266
services: [any RegistrableRPCService],
@@ -291,6 +293,7 @@ public func withGRPCServer<Transport: ServerTransport, Result: Sendable>(
291293
/// server is shutdown gracefully.
292294
/// - Returns: The result of the `handleServer` closure.
293295
@available(gRPCSwift 2.0, *)
296+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
294297
public func withGRPCServer<Transport: ServerTransport, Result: Sendable>(
295298
transport: Transport,
296299
services: [any RegistrableRPCService],

Sources/GRPCCore/Metadata.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
/// the "-bin" suffix may have string values (rather than binary). These are deserialized automatically when
8181
/// using ``subscript(binaryValues:)``.
8282
@available(gRPCSwift 2.0, *)
83+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
8384
public struct Metadata: Sendable, Hashable {
8485

8586
/// A metadata value. It can either be a simple string, or binary data.

Sources/GRPCCore/Transport/ClientTransport.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
/// transport built on top of SwiftNIO in the https://github.com/grpc/grpc-swift-nio-transport
2727
/// package.
2828
@available(gRPCSwift 2.0, *)
29+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
2930
public protocol ClientTransport<Bytes>: Sendable {
3031
/// The bag-of-bytes type used by the transport.
3132
associatedtype Bytes: GRPCContiguousBytes & Sendable

Sources/GRPCCore/Transport/ServerTransport.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
/// transport built on top of SwiftNIO in the https://github.com/grpc/grpc-swift-nio-transport
2424
/// package.
2525
@available(gRPCSwift 2.0, *)
26+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
2627
public protocol ServerTransport<Bytes>: Sendable {
2728
/// The bag-of-bytes type used by the transport.
2829
associatedtype Bytes: GRPCContiguousBytes & Sendable

Sources/GRPCInProcessTransport/InProcessTransport.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
public import GRPCCore
1818

1919
@available(gRPCSwift 2.0, *)
20+
@available(*, deprecated, message: "See https://forums.swift.org/t/80177")
2021
public struct InProcessTransport: Sendable {
2122
public let server: Self.Server
2223
public let client: Self.Client

0 commit comments

Comments
 (0)