Skip to content

Commit 1fd34e7

Browse files
authored
Restructure in-process transport (#2071)
Motivation: To create a connected pair of `ServerTransport` and `ClientTransport`, users need to call `InProcessTransport.makePair(serviceConfig:)` which returns a tuple. The spelling of this API can be more intuitive and simple. Modifications: - Restructure `InProcessTransport` to include two properties: `server` (the `ServerTransport`) and `client` (the `ClientTransport`), and an `init(serviceConfig:)` that pairs these properties. - Add missing GRPCInProcessTransport dependency to GRPCCore test target. Result: The spelling of the `InProcessTransport` API will be better.
1 parent 4e21120 commit 1fd34e7

13 files changed

+481
-480
lines changed

Sources/GRPCCore/GRPCClient.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ private import Synchronization
6565
/// )
6666
///
6767
/// // Finally create a transport and instantiate the client, adding an interceptor.
68-
/// let inProcessServerTransport = InProcessServerTransport()
69-
/// let inProcessClientTransport = InProcessClientTransport(serverTransport: inProcessServerTransport)
68+
/// let inProcessTransport = InProcessTransport()
7069
///
7170
/// let client = GRPCClient(
72-
/// transport: inProcessClientTransport,
71+
/// transport: inProcessTransport.client,
7372
/// interceptors: [StatsRecordingClientInterceptor()],
7473
/// configuration: configuration
7574
/// )

Sources/GRPCCore/GRPCServer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private import Synchronization
3535
///
3636
/// ```swift
3737
/// // Create and an in-process transport.
38-
/// let inProcessTransport = InProcessServerTransport()
38+
/// let inProcessTransport = InProcessTransport()
3939
///
4040
/// // Create the 'Greeter' and 'Echo' services.
4141
/// let greeter = GreeterService()
@@ -46,7 +46,7 @@ private import Synchronization
4646
///
4747
/// // Finally create the server.
4848
/// let server = GRPCServer(
49-
/// transport: inProcessTransport,
49+
/// transport: inProcessTransport.server,
5050
/// services: [greeter, echo],
5151
/// interceptors: [statsRecorder]
5252
/// )

Sources/GRPCInProcessTransport/InProcessClientTransport.swift

Lines changed: 0 additions & 353 deletions
This file was deleted.

0 commit comments

Comments
 (0)