Skip to content

Commit 5f14bb9

Browse files
authored
Address warnings under -strict-concurrency=complete compiler flag. (#18)
Address warnings under -strict-concurrency=complete compiler flag.
1 parent 5e602c4 commit 5f14bb9

23 files changed

+75
-78
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ All or a subset of the rows from a partition can be retrieved using a query-
176176
enum TestPolymorphicOperationReturnType: PolymorphicOperationReturnType {
177177
typealias AttributesType = StandardPrimaryKeyAttributes
178178

179-
static var types: [(Codable.Type, PolymorphicOperationReturnOption<StandardPrimaryKeyAttributes, Self>)] = [
179+
static let types: [(Codable.Type, PolymorphicOperationReturnOption<StandardPrimaryKeyAttributes, Self>)] = [
180180
(TypeA.self, .init( {.typeA($0)} )),
181181
(TypeB.self, .init( {.typeB($0)} )),
182182
]
@@ -728,8 +728,8 @@ public struct MyTimeToLiveAttributes: TimeToLiveAttributes {
728728
If the `Codable` type is used for a row type also conforms to the `CustomRowTypeIdentifier`, the *rowTypeIdentifier* property of this type will be used as the RowType recorded in the database row.
729729

730730
```swift
731-
struct TypeB: Codable, CustomRowTypeIdentifier {
732-
static var rowTypeIdentifier: String? = "TypeBCustom"
731+
struct TypeB: SCodable, CustomRowTypeIdentifier {
732+
static let rowTypeIdentifier: String? = "TypeBCustom"
733733

734734
let thirdly: String
735735
let fourthly: String

Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+monomorphicGetItems.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public extension AWSDynamoDBCompositePrimaryKeyTable {
4242
monitors the unprocessed items returned in the response from DynamoDB and uses an exponential backoff algorithm to retry those items using
4343
the same retry configuration as the underlying DynamoDB client.
4444
*/
45-
private class MonomorphicGetItemsRetriable<AttributesType: PrimaryKeyAttributes, ItemType: Codable> {
45+
private class MonomorphicGetItemsRetriable<AttributesType: PrimaryKeyAttributes, ItemType: Sendable & Codable> {
4646
typealias OutputType = [CompositePrimaryKey<AttributesType>: TypedDatabaseItem<AttributesType, ItemType>]
4747

4848
let dynamodb: AWSDynamoDB.DynamoDBClient

Sources/DynamoDBTables/CompositePrimaryKey.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import Foundation
2828

29-
public protocol PrimaryKeyAttributes {
29+
public protocol PrimaryKeyAttributes: Sendable {
3030
static var partitionKeyAttributeName: String { get }
3131
static var sortKeyAttributeName: String { get }
3232
static var indexName: String? { get }
@@ -66,7 +66,7 @@ struct DynamoDBAttributesTypeCodingKey: CodingKey {
6666
}
6767
}
6868

69-
public struct CompositePrimaryKey<AttributesType: PrimaryKeyAttributes>: Codable, CustomStringConvertible, Hashable {
69+
public struct CompositePrimaryKey<AttributesType: PrimaryKeyAttributes>: Sendable, Codable, CustomStringConvertible, Hashable {
7070
public var description: String {
7171
"CompositePrimaryKey(partitionKey: \(self.partitionKey), sortKey: \(self.sortKey))"
7272
}

Sources/DynamoDBTables/DynamoDBCompositePrimaryKeyTable+clobberVersionedItemWithHistoricalRow.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public extension DynamoDBCompositePrimaryKeyTable {
4444
version number.
4545
- completion: completion handler providing an error that was thrown or nil
4646
*/
47-
func clobberVersionedItemWithHistoricalRow<AttributesType: PrimaryKeyAttributes, ItemType: Codable>(
47+
func clobberVersionedItemWithHistoricalRow<AttributesType: PrimaryKeyAttributes, ItemType: Sendable & Codable>(
4848
forPrimaryKey partitionKey: String,
4949
andHistoricalKey historicalKey: String,
5050
item: ItemType,

Sources/DynamoDBTables/DynamoDBCompositePrimaryKeyTable+conditionallyUpdateItem.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public extension DynamoDBCompositePrimaryKeyTable {
4343
withRetries: the number of times to attempt to retry the update before failing.
4444
updatedPayloadProvider: the provider that will return updated payloads.
4545
*/
46-
func conditionallyUpdateItem<AttributesType, ItemType: Codable>(
46+
func conditionallyUpdateItem<AttributesType, ItemType: Sendable & Codable>(
4747
forKey key: CompositePrimaryKey<AttributesType>,
4848
withRetries retries: Int = 10,
4949
updatedPayloadProvider: @escaping (ItemType) async throws -> ItemType) async throws
@@ -60,7 +60,7 @@ public extension DynamoDBCompositePrimaryKeyTable {
6060

6161
// Explicitly specify an overload with sync updatedPayloadProvider
6262
// to avoid the compiler matching a call site with such a provider with the EventLoopFuture-returning overload.
63-
func conditionallyUpdateItem<AttributesType, ItemType: Codable>(
63+
func conditionallyUpdateItem<AttributesType, ItemType: Sendable & Codable>(
6464
forKey key: CompositePrimaryKey<AttributesType>,
6565
withRetries retries: Int = 10,
6666
updatedPayloadProvider: @escaping (ItemType) throws -> ItemType) async throws

Sources/DynamoDBTables/DynamoDBCompositePrimaryKeyTable.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public extension Swift.Error {
7070
/**
7171
Enumeration of the types of conditions that can be specified for an attribute.
7272
*/
73-
public enum AttributeCondition {
73+
public enum AttributeCondition: Sendable {
7474
case equals(String)
7575
case lessThan(String)
7676
case lessThanOrEqual(String)
@@ -80,7 +80,7 @@ public enum AttributeCondition {
8080
case beginsWith(String)
8181
}
8282

83-
public enum WriteEntry<AttributesType: PrimaryKeyAttributes, ItemType: Codable> {
83+
public enum WriteEntry<AttributesType: PrimaryKeyAttributes, ItemType: Sendable & Codable>: Sendable {
8484
case update(new: TypedDatabaseItem<AttributesType, ItemType>, existing: TypedDatabaseItem<AttributesType, ItemType>)
8585
case insert(new: TypedDatabaseItem<AttributesType, ItemType>)
8686
case deleteAtKey(key: CompositePrimaryKey<AttributesType>)

Sources/DynamoDBTables/InMemoryDynamoDBCompositePrimaryKeyTable.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
// DynamoDBTables
2626
//
2727

28-
import AWSDynamoDB
28+
@preconcurrency import AWSDynamoDB
2929
import Foundation
3030

31-
public protocol PolymorphicOperationReturnTypeConvertable {
31+
public protocol PolymorphicOperationReturnTypeConvertable: Sendable {
3232
var createDate: Foundation.Date { get }
3333
var rowStatus: RowStatus { get }
3434

@@ -41,7 +41,7 @@ extension TypedDatabaseItem: PolymorphicOperationReturnTypeConvertable {
4141
}
4242
}
4343

44-
public typealias ExecuteItemFilterType = (String, String, String, PolymorphicOperationReturnTypeConvertable)
44+
public typealias ExecuteItemFilterType = @Sendable (String, String, String, PolymorphicOperationReturnTypeConvertable)
4545
-> Bool
4646

4747
public protocol InMemoryTransactionDelegate {

Sources/DynamoDBTables/InMemoryDynamoDBCompositePrimaryKeysProjection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ import Foundation
3131
public struct InMemoryDynamoDBCompositePrimaryKeysProjection: DynamoDBCompositePrimaryKeysProjection {
3232
let keysWrapper: InMemoryDynamoDBCompositePrimaryKeysProjectionStore
3333

34-
public init(keys: [Any] = []) {
34+
public init(keys: [Sendable] = []) {
3535
self.keysWrapper = InMemoryDynamoDBCompositePrimaryKeysProjectionStore(keys: keys)
3636
}
3737

3838
init(keysWrapper: InMemoryDynamoDBCompositePrimaryKeysProjectionStore) {
3939
self.keysWrapper = keysWrapper
4040
}
4141

42-
public var keys: [Any] {
42+
public var keys: [Sendable] {
4343
get async {
4444
await self.keysWrapper.keys
4545
}

Sources/DynamoDBTables/InMemoryDynamoDBCompositePrimaryKeysProjectionStore.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ import Foundation
3131
// MARK: - Store implementation
3232

3333
actor InMemoryDynamoDBCompositePrimaryKeysProjectionStore {
34-
public var keys: [Any] = []
34+
public var keys: [Sendable] = []
3535

36-
public init(keys: [Any] = []) {
36+
public init(keys: [Sendable] = []) {
3737
self.keys = keys
3838
}
3939

Sources/DynamoDBTables/PolymorphicOperationReturnType.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,27 @@ public protocol BatchCapableReturnType {
3333
func getItemKey() -> CompositePrimaryKey<AttributesType>
3434
}
3535

36-
public protocol PolymorphicOperationReturnType {
36+
public protocol PolymorphicOperationReturnType: Sendable {
3737
associatedtype AttributesType: PrimaryKeyAttributes
3838

3939
static var types: [(Codable.Type, PolymorphicOperationReturnOption<AttributesType, Self>)] { get }
4040
}
4141

42-
public struct PolymorphicOperationReturnOption<AttributesType: PrimaryKeyAttributes, ReturnType> {
43-
private let decodingPayloadHandler: (Decoder) throws -> ReturnType
44-
private let typeConvertingPayloadHander: (Any) throws -> ReturnType
42+
public struct PolymorphicOperationReturnOption<AttributesType: PrimaryKeyAttributes, ReturnType>: Sendable {
43+
private let decodingPayloadHandler: @Sendable (Decoder) throws -> ReturnType
44+
private let typeConvertingPayloadHander: @Sendable (Any) throws -> ReturnType
4545

4646
public init<RowType: Codable>(
47-
_ payloadHandler: @escaping (TypedDatabaseItem<AttributesType, RowType>) -> ReturnType)
47+
_ payloadHandler: @escaping @Sendable (TypedDatabaseItem<AttributesType, RowType>) -> ReturnType)
4848
{
49+
@Sendable
4950
func newDecodingPayloadHandler(decoder: Decoder) throws -> ReturnType {
5051
let typedDatabaseItem: TypedDatabaseItem<AttributesType, RowType> = try TypedDatabaseItem(from: decoder)
5152

5253
return payloadHandler(typedDatabaseItem)
5354
}
5455

56+
@Sendable
5557
func newTypeConvertingPayloadHandler(input: Any) throws -> ReturnType {
5658
guard let typedDatabaseItem = input as? TypedDatabaseItem<AttributesType, RowType> else {
5759
let description = "Expected to use item type \(TypedDatabaseItem<AttributesType, RowType>.self)."

0 commit comments

Comments
 (0)