Skip to content
Open
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
2 changes: 1 addition & 1 deletion Sources/ClientRuntime/Client/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// SPDX-License-Identifier: Apache-2.0
//
public protocol Client {
public protocol Client: Sendable {
associatedtype Config: ClientConfiguration
init(config: Config)
}
2 changes: 1 addition & 1 deletion Sources/ClientRuntime/Config/ClientConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
// SPDX-License-Identifier: Apache-2.0
//

public protocol ClientConfiguration {
public protocol ClientConfiguration: Sendable {
init() async throws
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Glibc
import Darwin
#endif

public class CRTClientEngine: HTTPClient {
public class CRTClientEngine: HTTPClient, @unchecked Sendable {
public static let noOpCrtClientEngineTelemetry = HttpTelemetry(
httpScope: "CRTClientEngine",
telemetryProvider: DefaultTelemetry.provider
Expand Down Expand Up @@ -171,7 +171,7 @@ public class CRTClientEngine: HTTPClient {

public typealias StreamContinuation = CheckedContinuation<HTTPResponse, Error>
private let telemetry: HttpTelemetry
private var logger: LogAgent
private let logger: LogAgent
private let serialExecutor: SerialExecutor
private let CONTENT_LENGTH_HEADER = "Content-Length"
private let AWS_COMMON_RUNTIME = "AwsCommonRuntime"
Expand Down
2 changes: 1 addition & 1 deletion Sources/ClientRuntime/Networking/Http/SdkHttpClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import class SmithyHTTPAPI.HTTPRequest
import class SmithyHTTPAPI.HTTPResponse

/// this class will implement Handler per new middleware implementation
public class SdkHttpClient: ExecuteRequest {
public class SdkHttpClient: ExecuteRequest, @unchecked Sendable {

let engine: HTTPClient

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import class SmithyStreams.BufferedStream
/// for details about allowable modes of networking on the Apple Watch platform.)
///
/// On Linux platforms, we recommend using the CRT-based HTTP client for its configurability and performance.
public final class URLSessionHTTPClient: HTTPClient {
public final class URLSessionHTTPClient: HTTPClient, @unchecked Sendable {
public static let noOpURLSessionHTTPClientTelemetry = HttpTelemetry(
httpScope: "URLSessionHTTPClient",
telemetryProvider: DefaultTelemetry.provider
Expand Down Expand Up @@ -406,7 +406,7 @@ public final class URLSessionHTTPClient: HTTPClient {
private let telemetry: HttpTelemetry

/// The logger for this HTTP client.
private var logger: LogAgent
private let logger: LogAgent

/// The TLS options for this HTTP client.
private let tlsConfiguration: URLSessionTLSOptions?
Expand Down
2 changes: 1 addition & 1 deletion Sources/SmithyHTTPAPI/HTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

/// The interface for a client that can be used to perform SDK operations over HTTP.
public protocol HTTPClient {
public protocol HTTPClient: Sendable {

/// Executes an HTTP request to perform an SDK operation.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/SmithyHTTPClientAPI/HttpClientConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import struct Foundation.TimeInterval
import enum Smithy.URIScheme
import struct SmithyHTTPAPI.Headers

public class HTTPClientConfiguration {
public class HTTPClientConfiguration: @unchecked Sendable {

/// The timeout for establishing a connection, in seconds.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/SmithyHTTPClientAPI/TLSConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* All settings are optional.
* Not specifying them will use the SDK defaults
*/
public protocol TLSConfiguration {
public protocol TLSConfiguration: Sendable {

// Optional path to a PEM certificate
var certificate: String? { get set }
Expand Down
2 changes: 1 addition & 1 deletion Sources/SmithyIdentity/AWSCredentialIdentityResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import struct Smithy.Attributes
import protocol SmithyIdentityAPI.IdentityResolver

/// A type that can provide credentials for authenticating with an AWS service
public protocol AWSCredentialIdentityResolver: IdentityResolver where IdentityT == AWSCredentialIdentity {}
public protocol AWSCredentialIdentityResolver: IdentityResolver, Sendable where IdentityT == AWSCredentialIdentity {}

public extension AWSCredentialIdentityResolver {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ import protocol SmithyIdentityAPI.IdentityResolver

/// The type that resolves a bearer token identity for authenticating with a service.
/// All concrete implementations for bearer token identity resolver must conform to this protocol.
public protocol BearerTokenIdentityResolver: IdentityResolver where IdentityT == BearerTokenIdentity {}
public protocol BearerTokenIdentityResolver: IdentityResolver, Sendable where IdentityT == BearerTokenIdentity {}
2 changes: 1 addition & 1 deletion Sources/SmithySwiftNIO/SwiftNIOHTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class SwiftNIOHTTPClient: SmithyHTTPAPI.HTTPClient {
private let telemetry: SmithyHTTPClientAPI.HttpTelemetry

/// Logger for HTTP-related events.
private var logger: LogAgent
private let logger: LogAgent

/// Creates a new `SwiftNIOHTTPClient`.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/SmithyTestUtil/ProtocolTestClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import class SmithyHTTPAPI.HTTPRequest
import class SmithyHTTPAPI.HTTPResponse
import ClientRuntime

public class ProtocolTestClient {
public final class ProtocolTestClient {
public init() {}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class EndpointResolverGenerator(
}
}
writer.write("")
writer.write("extension DefaultEndpointResolver: EndpointResolver {}")
writer.write("extension DefaultEndpointResolver: EndpointResolver where Params == EndpointParams {}")
}

private fun renderStaticResolver(writer: SwiftWriter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ open class HttpProtocolServiceClient(

fun render(serviceSymbol: Symbol) {
writer.openBlock(
"${ctx.settings.visibility} class \$L: \$N {",
"${ctx.settings.visibility} final class \$L: \$N, Sendable {",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my note on the other PR, rather than mark Sendable here (and on every generated client) I think we can just specify that ClientRuntime.Client conforms to Sendable

"}",
serviceSymbol.name,
clientProtocolSymbol,
Expand Down Expand Up @@ -119,7 +119,7 @@ open class HttpProtocolServiceClient(
.joinToString(" & ")

writer.openBlock(
"public class \$LConfiguration: \$L {",
"public final class \$LConfiguration: \$L, @unchecked Sendable {",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also see my note on the other PR, even after applying final this type is not Sendable (checked or unchecked)

"}",
serviceConfig.clientName.toUpperCamelCase(),
clientConfigurationProtocols,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class HttpProtocolClientGeneratorTests {
val contents = getFileContents(context.manifest, "Sources/RestJson/RestJsonProtocolClient.swift")
contents.shouldSyntacticSanityCheck()
val expected = """
public class RestJsonProtocolClient: ClientRuntime.Client {
public final class RestJsonProtocolClient: ClientRuntime.Client, Sendable {
public static let clientName = "RestJsonProtocolClient"
public static let version = "2019-12-16"
let client: ClientRuntime.SdkHttpClient
Expand All @@ -38,7 +38,7 @@ public class RestJsonProtocolClient: ClientRuntime.Client {

extension RestJsonProtocolClient {

public class RestJsonProtocolClientConfiguration: ClientRuntime.DefaultClientConfiguration & ClientRuntime.DefaultHttpClientConfiguration {
public final class RestJsonProtocolClientConfiguration: ClientRuntime.DefaultClientConfiguration & ClientRuntime.DefaultHttpClientConfiguration, @unchecked Sendable {
public var telemetryProvider: ClientRuntime.TelemetryProvider
public var retryStrategyOptions: SmithyRetriesAPI.RetryStrategyOptions
public var clientLogMode: ClientRuntime.ClientLogMode
Expand Down
Loading