@@ -26,16 +26,16 @@ final class BenchmarkService: Grpc_Testing_BenchmarkService.ServiceProtocol {
26
26
/// One request followed by one response.
27
27
/// The server returns a client payload with the size requested by the client.
28
28
func unaryCall(
29
- request: ServerRequest . Single < Grpc_Testing_SimpleRequest > ,
29
+ request: ServerRequest < Grpc_Testing_SimpleRequest > ,
30
30
context: ServerContext
31
- ) async throws -> ServerResponse . Single < Grpc_Testing_SimpleResponse > {
31
+ ) async throws -> ServerResponse < Grpc_Testing_SimpleResponse > {
32
32
// Throw an error if the status is not `ok`. Otherwise, an `ok` status is automatically sent
33
33
// if the request is successful.
34
34
if request. message. responseStatus. isInitialized {
35
35
try self . checkOkStatus ( request. message. responseStatus)
36
36
}
37
37
38
- return ServerResponse . Single (
38
+ return ServerResponse (
39
39
message: . with {
40
40
$0. payload = Grpc_Testing_Payload . with {
41
41
$0. body = Data ( count: Int ( request. message. responseSize) )
@@ -47,10 +47,10 @@ final class BenchmarkService: Grpc_Testing_BenchmarkService.ServiceProtocol {
47
47
/// Repeated sequence of one request followed by one response.
48
48
/// The server returns a payload with the size requested by the client for each received message.
49
49
func streamingCall(
50
- request: ServerRequest . Stream < Grpc_Testing_SimpleRequest > ,
50
+ request: StreamingServerRequest < Grpc_Testing_SimpleRequest > ,
51
51
context: ServerContext
52
- ) async throws -> ServerResponse . Stream < Grpc_Testing_SimpleResponse > {
53
- return ServerResponse . Stream { writer in
52
+ ) async throws -> StreamingServerResponse < Grpc_Testing_SimpleResponse > {
53
+ return StreamingServerResponse { writer in
54
54
for try await message in request. messages {
55
55
if message. responseStatus. isInitialized {
56
56
try self . checkOkStatus ( message. responseStatus)
@@ -72,9 +72,9 @@ final class BenchmarkService: Grpc_Testing_BenchmarkService.ServiceProtocol {
72
72
/// Single-sided unbounded streaming from client to server.
73
73
/// The server returns a payload with the size requested by the client once the client does WritesDone.
74
74
func streamingFromClient(
75
- request: ServerRequest . Stream < Grpc_Testing_SimpleRequest > ,
75
+ request: StreamingServerRequest < Grpc_Testing_SimpleRequest > ,
76
76
context: ServerContext
77
- ) async throws -> ServerResponse . Single < Grpc_Testing_SimpleResponse > {
77
+ ) async throws -> ServerResponse < Grpc_Testing_SimpleResponse > {
78
78
var responseSize = 0
79
79
for try await message in request. messages {
80
80
if message. responseStatus. isInitialized {
@@ -83,7 +83,7 @@ final class BenchmarkService: Grpc_Testing_BenchmarkService.ServiceProtocol {
83
83
responseSize = Int ( message. responseSize)
84
84
}
85
85
86
- return ServerResponse . Single (
86
+ return ServerResponse (
87
87
message: . with {
88
88
$0. payload = . with {
89
89
$0. body = Data ( count: responseSize)
@@ -95,9 +95,9 @@ final class BenchmarkService: Grpc_Testing_BenchmarkService.ServiceProtocol {
95
95
/// Single-sided unbounded streaming from server to client.
96
96
/// The server repeatedly returns a payload with the size requested by the client.
97
97
func streamingFromServer(
98
- request: ServerRequest . Single < Grpc_Testing_SimpleRequest > ,
98
+ request: ServerRequest < Grpc_Testing_SimpleRequest > ,
99
99
context: ServerContext
100
- ) async throws -> ServerResponse . Stream < Grpc_Testing_SimpleResponse > {
100
+ ) async throws -> StreamingServerResponse < Grpc_Testing_SimpleResponse > {
101
101
if request. message. responseStatus. isInitialized {
102
102
try self . checkOkStatus ( request. message. responseStatus)
103
103
}
@@ -108,7 +108,7 @@ final class BenchmarkService: Grpc_Testing_BenchmarkService.ServiceProtocol {
108
108
}
109
109
}
110
110
111
- return ServerResponse . Stream { writer in
111
+ return StreamingServerResponse { writer in
112
112
while self . working. load ( ordering: . relaxed) {
113
113
try await writer. write ( response)
114
114
}
@@ -119,9 +119,9 @@ final class BenchmarkService: Grpc_Testing_BenchmarkService.ServiceProtocol {
119
119
/// Two-sided unbounded streaming between server to client.
120
120
/// Both sides send the content of their own choice to the other.
121
121
func streamingBothWays(
122
- request: ServerRequest . Stream < Grpc_Testing_SimpleRequest > ,
122
+ request: StreamingServerRequest < Grpc_Testing_SimpleRequest > ,
123
123
context: ServerContext
124
- ) async throws -> ServerResponse . Stream < Grpc_Testing_SimpleResponse > {
124
+ ) async throws -> StreamingServerResponse < Grpc_Testing_SimpleResponse > {
125
125
// The 100 size is used by the other implementations as well.
126
126
// We are using the same canned response size for all responses
127
127
// as it is allowed by the spec.
@@ -150,7 +150,7 @@ final class BenchmarkService: Grpc_Testing_BenchmarkService.ServiceProtocol {
150
150
// Marks if the inbound streaming is ongoing or finished.
151
151
let inbound = InboundStreamingSignal ( )
152
152
153
- return ServerResponse . Stream { writer in
153
+ return StreamingServerResponse { writer in
154
154
try await withThrowingTaskGroup ( of: Void . self) { group in
155
155
group. addTask {
156
156
for try await message in request. messages {
0 commit comments