diff --git a/Sources/GRPCCodeGen/CodeGenerationRequest.swift b/Sources/GRPCCodeGen/CodeGenerationRequest.swift index 55cdb679..8e3b1515 100644 --- a/Sources/GRPCCodeGen/CodeGenerationRequest.swift +++ b/Sources/GRPCCodeGen/CodeGenerationRequest.swift @@ -82,6 +82,9 @@ public struct CodeGenerationRequest { } } +@available(*, unavailable) +extension CodeGenerationRequest: Sendable {} + @available(gRPCSwift 2.0, *) extension CodeGenerationRequest { @available(*, deprecated, renamed: "makeSerializerSnippet") @@ -123,7 +126,7 @@ extension CodeGenerationRequest { /// Represents an import: a module or a specific item from a module. @available(gRPCSwift 2.0, *) -public struct Dependency: Equatable { +public struct Dependency: Equatable, Sendable { /// If the dependency is an item, the property's value is the item representation. /// If the dependency is a module, this property is nil. public var item: Item? @@ -158,7 +161,7 @@ public struct Dependency: Equatable { } /// Represents an item imported from a module. - public struct Item: Equatable { + public struct Item: Equatable, Sendable { /// The keyword that specifies the item's kind (e.g. `func`, `struct`). public var kind: Kind @@ -171,7 +174,7 @@ public struct Dependency: Equatable { } /// Represents the imported item's kind. - public struct Kind: Equatable { + public struct Kind: Equatable, Sendable { /// Describes the keyword associated with the imported item. internal enum Value: String { case `typealias` @@ -233,7 +236,7 @@ public struct Dependency: Equatable { } /// Describes any requirement for the `@preconcurrency` attribute. - public struct PreconcurrencyRequirement: Equatable { + public struct PreconcurrencyRequirement: Equatable, Sendable { internal enum Value: Equatable { case required case notRequired @@ -265,7 +268,7 @@ public struct Dependency: Equatable { /// Represents a service described in an IDL file. @available(gRPCSwift 2.0, *) -public struct ServiceDescriptor: Hashable { +public struct ServiceDescriptor: Hashable, Sendable { /// Documentation from comments above the IDL service description. /// It is already formatted, meaning it contains "///" and new lines. public var documentation: String @@ -323,7 +326,7 @@ extension ServiceDescriptor { /// Represents a method described in an IDL file. @available(gRPCSwift 2.0, *) -public struct MethodDescriptor: Hashable { +public struct MethodDescriptor: Hashable, Sendable { /// Documentation from comments above the IDL method description. /// It is already formatted, meaning it contains "///" and new lines. public var documentation: String @@ -388,7 +391,7 @@ extension MethodDescriptor { } @available(gRPCSwift 2.0, *) -public struct ServiceName: Hashable { +public struct ServiceName: Hashable, Sendable { /// The identifying name as used in the service/method descriptors including any namespace. /// /// This value is also used to identify the service to the remote peer, usually as part of the @@ -423,7 +426,7 @@ public struct ServiceName: Hashable { } @available(gRPCSwift 2.0, *) -public struct MethodName: Hashable { +public struct MethodName: Hashable, Sendable { /// The identifying name as used in the service/method descriptors. /// /// This value is also used to identify the method to the remote peer, usually as part of the @@ -455,7 +458,7 @@ public struct MethodName: Hashable { /// Represents the name associated with a namespace, service or a method, in three different formats. @available(*, deprecated, message: "Use ServiceName/MethodName instead.") @available(gRPCSwift 2.0, *) -public struct Name: Hashable { +public struct Name: Hashable, Sendable { /// The base name is the name used for the namespace/service/method in the IDL file, so it should follow /// the specific casing of the IDL. /// diff --git a/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift b/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift index 08bdb62d..fa7ba6bb 100644 --- a/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift +++ b/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift @@ -501,7 +501,7 @@ extension ClientRPCExecutor.HedgingExecutor { } @usableFromInline - struct ScheduledState { + struct ScheduledState: Sendable { @usableFromInline var _handle: CancellableTaskHandle? @usableFromInline diff --git a/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor.swift b/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor.swift index f7e41fad..ba9be20d 100644 --- a/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor.swift +++ b/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor.swift @@ -16,7 +16,7 @@ @available(gRPCSwift 2.0, *) @usableFromInline -enum ClientRPCExecutor { +enum ClientRPCExecutor: Sendable { /// Execute the request and handle its response. /// /// - Parameters: diff --git a/Sources/GRPCCore/Call/Client/Internal/ClientStreamExecutor.swift b/Sources/GRPCCore/Call/Client/Internal/ClientStreamExecutor.swift index 67bcc0a5..688c12ad 100644 --- a/Sources/GRPCCore/Call/Client/Internal/ClientStreamExecutor.swift +++ b/Sources/GRPCCore/Call/Client/Internal/ClientStreamExecutor.swift @@ -16,7 +16,7 @@ @available(gRPCSwift 2.0, *) @usableFromInline -internal enum ClientStreamExecutor { +internal enum ClientStreamExecutor: Sendable { /// Execute a request on the stream executor. /// /// - Parameters: @@ -250,3 +250,6 @@ internal enum ClientStreamExecutor { } } } + +@available(*, unavailable) +extension ClientStreamExecutor.RawBodyPartToMessageSequence.AsyncIterator: Sendable {} diff --git a/Sources/GRPCCore/Call/Client/Internal/RetryDelaySequence.swift b/Sources/GRPCCore/Call/Client/Internal/RetryDelaySequence.swift index b9f54a91..7a23a9aa 100644 --- a/Sources/GRPCCore/Call/Client/Internal/RetryDelaySequence.swift +++ b/Sources/GRPCCore/Call/Client/Internal/RetryDelaySequence.swift @@ -27,7 +27,7 @@ public import Musl // should be @usableFromInline @available(gRPCSwift 2.0, *) @usableFromInline -struct RetryDelaySequence: Sequence { +struct RetryDelaySequence: Sequence, Sendable { @usableFromInline typealias Element = Duration @@ -45,7 +45,7 @@ struct RetryDelaySequence: Sequence { } @usableFromInline - struct Iterator: IteratorProtocol { + struct Iterator: IteratorProtocol, Sendable { @usableFromInline let policy: RetryPolicy @usableFromInline diff --git a/Sources/GRPCCore/Call/Server/Internal/ServerRPCExecutor.swift b/Sources/GRPCCore/Call/Server/Internal/ServerRPCExecutor.swift index 96c929a4..6bc8ff3c 100644 --- a/Sources/GRPCCore/Call/Server/Internal/ServerRPCExecutor.swift +++ b/Sources/GRPCCore/Call/Server/Internal/ServerRPCExecutor.swift @@ -16,7 +16,7 @@ @available(gRPCSwift 2.0, *) @usableFromInline -struct ServerRPCExecutor { +struct ServerRPCExecutor: Sendable { /// Executes an RPC using the provided handler. /// /// - Parameters: @@ -272,7 +272,7 @@ struct ServerRPCExecutor { } @usableFromInline - enum OnFirstRequestPart { + enum OnFirstRequestPart: Sendable { case process( Metadata, UnsafeTransfer, any Error>.AsyncIterator> diff --git a/Sources/GRPCCore/Coding/CompressionAlgorithm.swift b/Sources/GRPCCore/Coding/CompressionAlgorithm.swift index 9c162f6a..fb19361e 100644 --- a/Sources/GRPCCore/Coding/CompressionAlgorithm.swift +++ b/Sources/GRPCCore/Coding/CompressionAlgorithm.swift @@ -94,7 +94,7 @@ extension CompressionAlgorithmSet { } /// A sequence of ``CompressionAlgorithm`` values present in a ``CompressionAlgorithmSet``. - public struct Elements: Sequence { + public struct Elements: Sequence, Sendable { public typealias Element = CompressionAlgorithm private let algorithmSet: CompressionAlgorithmSet @@ -107,7 +107,7 @@ extension CompressionAlgorithmSet { return Iterator(algorithmSet: self.algorithmSet) } - public struct Iterator: IteratorProtocol { + public struct Iterator: IteratorProtocol, Sendable { private let algorithmSet: CompressionAlgorithmSet private var iterator: IndexingIterator<[CompressionAlgorithm.Value]> diff --git a/Sources/GRPCCore/Streaming/Internal/AsyncSequenceOfOne.swift b/Sources/GRPCCore/Streaming/Internal/AsyncSequenceOfOne.swift index f0a078c1..a33ef270 100644 --- a/Sources/GRPCCore/Streaming/Internal/AsyncSequenceOfOne.swift +++ b/Sources/GRPCCore/Streaming/Internal/AsyncSequenceOfOne.swift @@ -74,3 +74,6 @@ struct AsyncSequenceOfOne: AsyncSequence, Sen } } } + +@available(*, unavailable) +extension AsyncSequenceOfOne.AsyncIterator: Sendable {} diff --git a/Sources/GRPCCore/Streaming/Internal/BroadcastAsyncSequence.swift b/Sources/GRPCCore/Streaming/Internal/BroadcastAsyncSequence.swift index c40e0158..d326377c 100644 --- a/Sources/GRPCCore/Streaming/Internal/BroadcastAsyncSequence.swift +++ b/Sources/GRPCCore/Streaming/Internal/BroadcastAsyncSequence.swift @@ -111,6 +111,9 @@ extension BroadcastAsyncSequence { } } +@available(*, unavailable) +extension BroadcastAsyncSequence.AsyncIterator: Sendable {} + // MARK: - Continuation @available(gRPCSwift 2.0, *) @@ -1204,7 +1207,7 @@ struct _BroadcastSequenceStateMachine: Sendable { } @usableFromInline - enum OnCancelSubscription { + enum OnCancelSubscription: Sendable { case none case resume(ConsumerContinuation, Result) } @@ -1244,7 +1247,7 @@ struct _BroadcastSequenceStateMachine: Sendable { } @usableFromInline - enum OnSubscribe { + enum OnSubscribe: Sendable { case subscribed(_BroadcastSequenceStateMachine.Subscriptions.ID) } @@ -1282,7 +1285,7 @@ struct _BroadcastSequenceStateMachine: Sendable { } @usableFromInline - enum OnWaitToProduceMore { + enum OnWaitToProduceMore: Sendable { case none case resume(ProducerContinuation, Result) } @@ -1498,7 +1501,7 @@ extension _BroadcastSequenceStateMachine { } @usableFromInline - enum ElementLookup { + enum ElementLookup: Sendable { /// The element was found in the collection. case found(Element) /// The element isn't in the collection, but it could be in the future. @@ -1810,3 +1813,33 @@ extension _BroadcastSequenceStateMachine { case many([Value]) } } + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine.ConsumerContinuations: Sendable {} + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine.ProducerContinuations: Sendable {} + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine.OnInvalidateAllSubscriptions: Sendable {} + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine.OnYield: Sendable {} + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine.OnFinish: Sendable {} + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine.OnNext: Sendable {} + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine.OnNext.ReturnAndResumeProducers: Sendable {} + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine.OnSetContinuation: Sendable {} + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine.OnDropResources: Sendable {} + +@available(*, unavailable) +extension _BroadcastSequenceStateMachine._OneOrMany: Sendable {} diff --git a/Sources/GRPCCore/Streaming/Internal/UncheckedAsyncIteratorSequence.swift b/Sources/GRPCCore/Streaming/Internal/UncheckedAsyncIteratorSequence.swift index 4beae584..b40e8027 100644 --- a/Sources/GRPCCore/Streaming/Internal/UncheckedAsyncIteratorSequence.swift +++ b/Sources/GRPCCore/Streaming/Internal/UncheckedAsyncIteratorSequence.swift @@ -80,3 +80,6 @@ final class UncheckedAsyncIteratorSequence< return AsyncIterator(base: self.base) } } + +@available(*, unavailable) +extension UncheckedAsyncIteratorSequence.AsyncIterator: Sendable {}