Skip to content

Commit

Permalink
Fix naming (#4)
Browse files Browse the repository at this point in the history
Motivation:

Some names were changed in grpc/grpc-swift#2076
which we need to update here.

Modifications:

- Update names of request/response types
- Regenerate code

Result:

Compiles
  • Loading branch information
glbrntt authored Oct 1, 2024
1 parent 143ea6c commit 7f44016
Show file tree
Hide file tree
Showing 11 changed files with 318 additions and 318 deletions.
80 changes: 40 additions & 40 deletions Sources/GRPCHealthService/Generated/health.grpc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ package enum Grpc_Health_V1_Health {
]
}
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package typealias StreamingServiceProtocol = Grpc_Health_V1_HealthStreamingServiceProtocol
package typealias StreamingServiceProtocol = Grpc_Health_V1_Health_StreamingServiceProtocol
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package typealias ServiceProtocol = Grpc_Health_V1_HealthServiceProtocol
package typealias ServiceProtocol = Grpc_Health_V1_Health_ServiceProtocol
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package typealias ClientProtocol = Grpc_Health_V1_HealthClientProtocol
package typealias ClientProtocol = Grpc_Health_V1_Health_ClientProtocol
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package typealias Client = Grpc_Health_V1_HealthClient
package typealias Client = Grpc_Health_V1_Health_Client
}

extension GRPCCore.ServiceDescriptor {
Expand All @@ -72,7 +72,7 @@ extension GRPCCore.ServiceDescriptor {
/// RPCs. Its semantics are documented in
/// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package protocol Grpc_Health_V1_HealthStreamingServiceProtocol: GRPCCore.RegistrableRPCService {
package protocol Grpc_Health_V1_Health_StreamingServiceProtocol: GRPCCore.RegistrableRPCService {
/// Check gets the health of the specified service. If the requested service
/// is unknown, the call will fail with status NOT_FOUND. If the caller does
/// not specify a service name, the server should respond with its overall
Expand All @@ -83,9 +83,9 @@ package protocol Grpc_Health_V1_HealthStreamingServiceProtocol: GRPCCore.Registr
///
/// Check implementations should be idempotent and side effect free.
func check(
request: GRPCCore.ServerRequest.Stream<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.StreamingServerRequest<Grpc_Health_V1_HealthCheckRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Stream<Grpc_Health_V1_HealthCheckResponse>
) async throws -> GRPCCore.StreamingServerResponse<Grpc_Health_V1_HealthCheckResponse>

/// Performs a watch for the serving status of the requested service.
/// The server will immediately send back a message indicating the current
Expand All @@ -103,9 +103,9 @@ package protocol Grpc_Health_V1_HealthStreamingServiceProtocol: GRPCCore.Registr
/// call. If the call terminates with any other status (including OK),
/// clients should retry the call with appropriate exponential backoff.
func watch(
request: GRPCCore.ServerRequest.Stream<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.StreamingServerRequest<Grpc_Health_V1_HealthCheckRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Stream<Grpc_Health_V1_HealthCheckResponse>
) async throws -> GRPCCore.StreamingServerResponse<Grpc_Health_V1_HealthCheckResponse>
}

/// Conformance to `GRPCCore.RegistrableRPCService`.
Expand Down Expand Up @@ -142,7 +142,7 @@ extension Grpc_Health_V1_Health.StreamingServiceProtocol {
/// RPCs. Its semantics are documented in
/// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package protocol Grpc_Health_V1_HealthServiceProtocol: Grpc_Health_V1_Health.StreamingServiceProtocol {
package protocol Grpc_Health_V1_Health_ServiceProtocol: Grpc_Health_V1_Health.StreamingServiceProtocol {
/// Check gets the health of the specified service. If the requested service
/// is unknown, the call will fail with status NOT_FOUND. If the caller does
/// not specify a service name, the server should respond with its overall
Expand All @@ -153,9 +153,9 @@ package protocol Grpc_Health_V1_HealthServiceProtocol: Grpc_Health_V1_Health.Str
///
/// Check implementations should be idempotent and side effect free.
func check(
request: GRPCCore.ServerRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.ServerRequest<Grpc_Health_V1_HealthCheckRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Single<Grpc_Health_V1_HealthCheckResponse>
) async throws -> GRPCCore.ServerResponse<Grpc_Health_V1_HealthCheckResponse>

/// Performs a watch for the serving status of the requested service.
/// The server will immediately send back a message indicating the current
Expand All @@ -173,31 +173,31 @@ package protocol Grpc_Health_V1_HealthServiceProtocol: Grpc_Health_V1_Health.Str
/// call. If the call terminates with any other status (including OK),
/// clients should retry the call with appropriate exponential backoff.
func watch(
request: GRPCCore.ServerRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.ServerRequest<Grpc_Health_V1_HealthCheckRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Stream<Grpc_Health_V1_HealthCheckResponse>
) async throws -> GRPCCore.StreamingServerResponse<Grpc_Health_V1_HealthCheckResponse>
}

/// Partial conformance to `Grpc_Health_V1_HealthStreamingServiceProtocol`.
/// Partial conformance to `Grpc_Health_V1_Health_StreamingServiceProtocol`.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Grpc_Health_V1_Health.ServiceProtocol {
package func check(
request: GRPCCore.ServerRequest.Stream<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.StreamingServerRequest<Grpc_Health_V1_HealthCheckRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Stream<Grpc_Health_V1_HealthCheckResponse> {
) async throws -> GRPCCore.StreamingServerResponse<Grpc_Health_V1_HealthCheckResponse> {
let response = try await self.check(
request: GRPCCore.ServerRequest.Single(stream: request),
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return GRPCCore.ServerResponse.Stream(single: response)
return GRPCCore.StreamingServerResponse(single: response)
}

package func watch(
request: GRPCCore.ServerRequest.Stream<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.StreamingServerRequest<Grpc_Health_V1_HealthCheckRequest>,
context: GRPCCore.ServerContext
) async throws -> GRPCCore.ServerResponse.Stream<Grpc_Health_V1_HealthCheckResponse> {
) async throws -> GRPCCore.StreamingServerResponse<Grpc_Health_V1_HealthCheckResponse> {
let response = try await self.watch(
request: GRPCCore.ServerRequest.Single(stream: request),
request: GRPCCore.ServerRequest(stream: request),
context: context
)
return response
Expand All @@ -208,7 +208,7 @@ extension Grpc_Health_V1_Health.ServiceProtocol {
/// RPCs. Its semantics are documented in
/// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package protocol Grpc_Health_V1_HealthClientProtocol: Sendable {
package protocol Grpc_Health_V1_Health_ClientProtocol: Sendable {
/// Check gets the health of the specified service. If the requested service
/// is unknown, the call will fail with status NOT_FOUND. If the caller does
/// not specify a service name, the server should respond with its overall
Expand All @@ -219,11 +219,11 @@ package protocol Grpc_Health_V1_HealthClientProtocol: Sendable {
///
/// Check implementations should be idempotent and side effect free.
func check<R>(
request: GRPCCore.ClientRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.ClientRequest<Grpc_Health_V1_HealthCheckRequest>,
serializer: some GRPCCore.MessageSerializer<Grpc_Health_V1_HealthCheckRequest>,
deserializer: some GRPCCore.MessageDeserializer<Grpc_Health_V1_HealthCheckResponse>,
options: GRPCCore.CallOptions,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Health_V1_HealthCheckResponse>) async throws -> R
_ body: @Sendable @escaping (GRPCCore.ClientResponse<Grpc_Health_V1_HealthCheckResponse>) async throws -> R
) async throws -> R where R: Sendable

/// Performs a watch for the serving status of the requested service.
Expand All @@ -242,20 +242,20 @@ package protocol Grpc_Health_V1_HealthClientProtocol: Sendable {
/// call. If the call terminates with any other status (including OK),
/// clients should retry the call with appropriate exponential backoff.
func watch<R>(
request: GRPCCore.ClientRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.ClientRequest<Grpc_Health_V1_HealthCheckRequest>,
serializer: some GRPCCore.MessageSerializer<Grpc_Health_V1_HealthCheckRequest>,
deserializer: some GRPCCore.MessageDeserializer<Grpc_Health_V1_HealthCheckResponse>,
options: GRPCCore.CallOptions,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream<Grpc_Health_V1_HealthCheckResponse>) async throws -> R
_ body: @Sendable @escaping (GRPCCore.StreamingClientResponse<Grpc_Health_V1_HealthCheckResponse>) async throws -> R
) async throws -> R where R: Sendable
}

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
extension Grpc_Health_V1_Health.ClientProtocol {
package func check<R>(
request: GRPCCore.ClientRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.ClientRequest<Grpc_Health_V1_HealthCheckRequest>,
options: GRPCCore.CallOptions = .defaults,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Health_V1_HealthCheckResponse>) async throws -> R = {
_ body: @Sendable @escaping (GRPCCore.ClientResponse<Grpc_Health_V1_HealthCheckResponse>) async throws -> R = {
try $0.message
}
) async throws -> R where R: Sendable {
Expand All @@ -269,9 +269,9 @@ extension Grpc_Health_V1_Health.ClientProtocol {
}

package func watch<R>(
request: GRPCCore.ClientRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.ClientRequest<Grpc_Health_V1_HealthCheckRequest>,
options: GRPCCore.CallOptions = .defaults,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream<Grpc_Health_V1_HealthCheckResponse>) async throws -> R
_ body: @Sendable @escaping (GRPCCore.StreamingClientResponse<Grpc_Health_V1_HealthCheckResponse>) async throws -> R
) async throws -> R where R: Sendable {
try await self.watch(
request: request,
Expand All @@ -298,11 +298,11 @@ extension Grpc_Health_V1_Health.ClientProtocol {
_ message: Grpc_Health_V1_HealthCheckRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Health_V1_HealthCheckResponse>) async throws -> Result = {
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Grpc_Health_V1_HealthCheckResponse>) async throws -> Result = {
try $0.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest.Single<Grpc_Health_V1_HealthCheckRequest>(
let request = GRPCCore.ClientRequest<Grpc_Health_V1_HealthCheckRequest>(
message: message,
metadata: metadata
)
Expand Down Expand Up @@ -332,9 +332,9 @@ extension Grpc_Health_V1_Health.ClientProtocol {
_ message: Grpc_Health_V1_HealthCheckRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream<Grpc_Health_V1_HealthCheckResponse>) async throws -> Result
onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Grpc_Health_V1_HealthCheckResponse>) async throws -> Result
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest.Single<Grpc_Health_V1_HealthCheckRequest>(
let request = GRPCCore.ClientRequest<Grpc_Health_V1_HealthCheckRequest>(
message: message,
metadata: metadata
)
Expand All @@ -350,7 +350,7 @@ extension Grpc_Health_V1_Health.ClientProtocol {
/// RPCs. Its semantics are documented in
/// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
package struct Grpc_Health_V1_HealthClient: Grpc_Health_V1_Health.ClientProtocol {
package struct Grpc_Health_V1_Health_Client: Grpc_Health_V1_Health.ClientProtocol {
private let client: GRPCCore.GRPCClient

package init(wrapping client: GRPCCore.GRPCClient) {
Expand All @@ -367,11 +367,11 @@ package struct Grpc_Health_V1_HealthClient: Grpc_Health_V1_Health.ClientProtocol
///
/// Check implementations should be idempotent and side effect free.
package func check<R>(
request: GRPCCore.ClientRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.ClientRequest<Grpc_Health_V1_HealthCheckRequest>,
serializer: some GRPCCore.MessageSerializer<Grpc_Health_V1_HealthCheckRequest>,
deserializer: some GRPCCore.MessageDeserializer<Grpc_Health_V1_HealthCheckResponse>,
options: GRPCCore.CallOptions = .defaults,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Health_V1_HealthCheckResponse>) async throws -> R = {
_ body: @Sendable @escaping (GRPCCore.ClientResponse<Grpc_Health_V1_HealthCheckResponse>) async throws -> R = {
try $0.message
}
) async throws -> R where R: Sendable {
Expand Down Expand Up @@ -401,11 +401,11 @@ package struct Grpc_Health_V1_HealthClient: Grpc_Health_V1_Health.ClientProtocol
/// call. If the call terminates with any other status (including OK),
/// clients should retry the call with appropriate exponential backoff.
package func watch<R>(
request: GRPCCore.ClientRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: GRPCCore.ClientRequest<Grpc_Health_V1_HealthCheckRequest>,
serializer: some GRPCCore.MessageSerializer<Grpc_Health_V1_HealthCheckRequest>,
deserializer: some GRPCCore.MessageDeserializer<Grpc_Health_V1_HealthCheckResponse>,
options: GRPCCore.CallOptions = .defaults,
_ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream<Grpc_Health_V1_HealthCheckResponse>) async throws -> R
_ body: @Sendable @escaping (GRPCCore.StreamingClientResponse<Grpc_Health_V1_HealthCheckResponse>) async throws -> R
) async throws -> R where R: Sendable {
try await self.client.serverStreaming(
request: request,
Expand Down
14 changes: 7 additions & 7 deletions Sources/GRPCHealthService/HealthService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ internal import GRPCCore
private import Synchronization

@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
internal struct HealthService: Grpc_Health_V1_HealthServiceProtocol {
internal struct HealthService: Grpc_Health_V1_Health_ServiceProtocol {
private let state = HealthService.State()

func check(
request: ServerRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: ServerRequest<Grpc_Health_V1_HealthCheckRequest>,
context: ServerContext
) async throws -> ServerResponse.Single<Grpc_Health_V1_HealthCheckResponse> {
) async throws -> ServerResponse<Grpc_Health_V1_HealthCheckResponse> {
let service = request.message.service

guard let status = self.state.currentStatus(ofService: service) else {
Expand All @@ -34,19 +34,19 @@ internal struct HealthService: Grpc_Health_V1_HealthServiceProtocol {
var response = Grpc_Health_V1_HealthCheckResponse()
response.status = status

return ServerResponse.Single(message: response)
return ServerResponse(message: response)
}

func watch(
request: ServerRequest.Single<Grpc_Health_V1_HealthCheckRequest>,
request: ServerRequest<Grpc_Health_V1_HealthCheckRequest>,
context: ServerContext
) async -> ServerResponse.Stream<Grpc_Health_V1_HealthCheckResponse> {
) async -> StreamingServerResponse<Grpc_Health_V1_HealthCheckResponse> {
let service = request.message.service
let statuses = AsyncStream.makeStream(of: Grpc_Health_V1_HealthCheckResponse.ServingStatus.self)

self.state.addContinuation(statuses.continuation, forService: service)

return ServerResponse.Stream(of: Grpc_Health_V1_HealthCheckResponse.self) { writer in
return StreamingServerResponse(of: Grpc_Health_V1_HealthCheckResponse.self) { writer in
var response = Grpc_Health_V1_HealthCheckResponse()

for await status in statuses.stream {
Expand Down
10 changes: 5 additions & 5 deletions Sources/GRPCInterceptors/ClientTracingInterceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public struct ClientTracingInterceptor: ClientInterceptor {
/// Which key-value pairs are injected will depend on the specific tracing implementation
/// that has been configured when bootstrapping `swift-distributed-tracing` in your application.
public func intercept<Input, Output>(
request: ClientRequest.Stream<Input>,
request: StreamingClientRequest<Input>,
context: ClientContext,
next: (
ClientRequest.Stream<Input>,
StreamingClientRequest<Input>,
ClientContext
) async throws -> ClientResponse.Stream<Output>
) async throws -> ClientResponse.Stream<Output> where Input: Sendable, Output: Sendable {
) async throws -> StreamingClientResponse<Output>
) async throws -> StreamingClientResponse<Output> where Input: Sendable, Output: Sendable {
var request = request
let tracer = InstrumentationSystem.tracer
let serviceContext = ServiceContext.current ?? .topLevel
Expand Down Expand Up @@ -92,7 +92,7 @@ public struct ClientTracingInterceptor: ClientInterceptor {
}
}

var response: ClientResponse.Stream<Output>
var response: StreamingClientResponse<Output>
do {
response = try await next(request, context)
} catch {
Expand Down
8 changes: 4 additions & 4 deletions Sources/GRPCInterceptors/ServerTracingInterceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public struct ServerTracingInterceptor: ServerInterceptor {
/// Which key-value pairs are extracted and made available will depend on the specific tracing implementation
/// that has been configured when bootstrapping `swift-distributed-tracing` in your application.
public func intercept<Input, Output>(
request: ServerRequest.Stream<Input>,
request: StreamingServerRequest<Input>,
context: ServerContext,
next: @Sendable (ServerRequest.Stream<Input>, ServerContext) async throws ->
ServerResponse.Stream<Output>
) async throws -> ServerResponse.Stream<Output> where Input: Sendable, Output: Sendable {
next: @Sendable (StreamingServerRequest<Input>, ServerContext) async throws ->
StreamingServerResponse<Output>
) async throws -> StreamingServerResponse<Output> where Input: Sendable, Output: Sendable {
var serviceContext = ServiceContext.topLevel
let tracer = InstrumentationSystem.tracer

Expand Down
Loading

0 comments on commit 7f44016

Please sign in to comment.