diff --git a/Package.swift b/Package.swift index ddcba0a..b218ded 100644 --- a/Package.swift +++ b/Package.swift @@ -4,6 +4,7 @@ import PackageDescription var globalSwiftSettings: [PackageDescription.SwiftSetting] = [] #if swift(>=5.7) + #if canImport(Foundation) if ProcessInfo.processInfo.environment["CI"] != nil { globalSwiftSettings.append(.unsafeFlags(["-Xfrontend", "-strict-concurrency=complete"])) /* @@ -11,7 +12,7 @@ var globalSwiftSettings: [PackageDescription.SwiftSetting] = [] Set `strict-concurrency` to `targeted` to enforce Sendable and actor-isolation checks in your code. This explicitly verifies that `Sendable` constraints are met when you mark one of your types as `Sendable`. - + This mode is essentially a bit of a hybrid between the behavior that's intended in Swift 6, and the default in Swift 5.7. Use this mode to have a bit of checking on your code that uses Swift concurrency without too many warnings and / or errors in @@ -21,6 +22,7 @@ var globalSwiftSettings: [PackageDescription.SwiftSetting] = [] constraints, essentially as they will work in Swift 6. */ } + #endif #endif let package = Package( diff --git a/Sources/CRDT/GenericCRDTs/GCounter.swift b/Sources/CRDT/GenericCRDTs/GCounter.swift index 75f407c..b345631 100644 --- a/Sources/CRDT/GenericCRDTs/GCounter.swift +++ b/Sources/CRDT/GenericCRDTs/GCounter.swift @@ -9,7 +9,7 @@ /// by Marc Shapiro, Nuno Preguiça, Carlos Baquero, and Marek Zawirski (2011). public struct GCounter { private var _storage: UInt - internal let selfId: ActorID + let selfId: ActorID /// The counter's value. public var value: UInt { diff --git a/Sources/CRDT/GenericCRDTs/GSet.swift b/Sources/CRDT/GenericCRDTs/GSet.swift index 6e97fce..887b21a 100644 --- a/Sources/CRDT/GenericCRDTs/GSet.swift +++ b/Sources/CRDT/GenericCRDTs/GSet.swift @@ -9,7 +9,7 @@ /// by Marc Shapiro, Nuno Preguiça, Carlos Baquero, and Marek Zawirski (2011). public struct GSet { private var _storage: Set - internal var currentTimestamp: LamportTimestamp + var currentTimestamp: LamportTimestamp /// The set of values. public var values: Set { diff --git a/Sources/CRDT/GenericCRDTs/LWWRegister.swift b/Sources/CRDT/GenericCRDTs/LWWRegister.swift index c18eddc..9ba5c1d 100644 --- a/Sources/CRDT/GenericCRDTs/LWWRegister.swift +++ b/Sources/CRDT/GenericCRDTs/LWWRegister.swift @@ -15,8 +15,8 @@ import Foundation public struct LWWRegister { /// A struct that represents the state of an LWWRegister public struct Metadata { - internal var value: T - internal var clockId: WallclockTimestamp + var value: T + var clockId: WallclockTimestamp init(value: T, id: ActorID, timestamp: TimeInterval = Date().timeIntervalSinceReferenceDate) { self.value = value @@ -37,7 +37,7 @@ public struct LWWRegister { } private var _storage: Metadata - internal let selfId: ActorID + let selfId: ActorID /// The value of the register. public var value: T { diff --git a/Sources/CRDT/GenericCRDTs/List.swift b/Sources/CRDT/GenericCRDTs/List.swift index 3d8e2a0..980e2fb 100644 --- a/Sources/CRDT/GenericCRDTs/List.swift +++ b/Sources/CRDT/GenericCRDTs/List.swift @@ -100,9 +100,9 @@ public struct List - internal var activeValues: [Metadata] = [] - internal var tombstones: [Metadata] = [] + var currentTimestamp: LamportTimestamp + var activeValues: [Metadata] = [] + var tombstones: [Metadata] = [] /// The values of the list. public var values: [T] { activeValues.map(\.value) } diff --git a/Sources/CRDT/GenericCRDTs/ORMap.swift b/Sources/CRDT/GenericCRDTs/ORMap.swift index 00fa153..341984a 100644 --- a/Sources/CRDT/GenericCRDTs/ORMap.swift +++ b/Sources/CRDT/GenericCRDTs/ORMap.swift @@ -10,7 +10,7 @@ /// Annette Bieniusa, Marek Zawirski, Nuno Preguiça, Marc Shapiro, Carlos Baquero, Valter Balegas, and Sérgio Duarte (2012). /// arXiv:[1210.3368](https://arxiv.org/abs/1210.3368). public struct ORMap { - internal struct Metadata: CustomStringConvertible { + struct Metadata: CustomStringConvertible { var isDeleted: Bool var lamportTimestamp: LamportTimestamp var value: VALUE @@ -25,8 +25,8 @@ public struct ORMap - internal var metadataByDictKey: [KEY: Metadata] + var currentTimestamp: LamportTimestamp + var metadataByDictKey: [KEY: Metadata] /// Creates a new grow-only set.. /// - Parameters: diff --git a/Sources/CRDT/GenericCRDTs/ORSet.swift b/Sources/CRDT/GenericCRDTs/ORSet.swift index 133e690..492c6a5 100644 --- a/Sources/CRDT/GenericCRDTs/ORSet.swift +++ b/Sources/CRDT/GenericCRDTs/ORSet.swift @@ -11,7 +11,7 @@ /// Annette Bieniusa, Marek Zawirski, Nuno Preguiça, Marc Shapiro, Carlos Baquero, Valter Balegas, and Sérgio Duarte (2012). /// arXiv:[1210.3368](https://arxiv.org/abs/1210.3368) public struct ORSet { - internal struct Metadata: CustomStringConvertible { + struct Metadata: CustomStringConvertible { var isDeleted: Bool var lamportTimestamp: LamportTimestamp var description: String { @@ -24,8 +24,8 @@ public struct ORSet { } } - internal var currentTimestamp: LamportTimestamp - internal var metadataByValue: [T: Metadata] + var currentTimestamp: LamportTimestamp + var metadataByValue: [T: Metadata] /// Creates a new grow-only set.. /// - Parameters: diff --git a/Sources/CRDT/GenericCRDTs/PNCounter.swift b/Sources/CRDT/GenericCRDTs/PNCounter.swift index b34a87d..af513b5 100644 --- a/Sources/CRDT/GenericCRDTs/PNCounter.swift +++ b/Sources/CRDT/GenericCRDTs/PNCounter.swift @@ -8,9 +8,9 @@ /// [A comprehensive study of Convergent and Commutative Replicated Data Types](https://hal.inria.fr/inria-00555588/document)” /// by Marc Shapiro, Nuno Preguiça, Carlos Baquero, and Marek Zawirski (2011). public struct PNCounter { - internal var pos_value: UInt - internal var neg_value: UInt - internal let selfId: ActorID + var pos_value: UInt + var neg_value: UInt + let selfId: ActorID /// The counter's value. public var value: Int { diff --git a/Sources/CRDT/LamportTimestamp.swift b/Sources/CRDT/LamportTimestamp.swift index e70e447..995d00b 100644 --- a/Sources/CRDT/LamportTimestamp.swift +++ b/Sources/CRDT/LamportTimestamp.swift @@ -8,8 +8,8 @@ /// where the clock value is identical. These scenarios happen when two independent CRDTs update internal values /// "at the same time". public struct LamportTimestamp: Identifiable, PartiallyOrderable { - internal var clock: UInt64 = 0 - internal var actorId: ActorID + var clock: UInt64 = 0 + var actorId: ActorID /// A stable, unique identity for the Lamport timestamp. public var id: String { diff --git a/Sources/CRDT/WallclockTimestamp.swift b/Sources/CRDT/WallclockTimestamp.swift index 55a0156..8f961ae 100644 --- a/Sources/CRDT/WallclockTimestamp.swift +++ b/Sources/CRDT/WallclockTimestamp.swift @@ -10,8 +10,8 @@ import Foundation /// where the clock value is identical. These scenarios happen when two independent CRDTs update internal values /// "at the same time". public struct WallclockTimestamp: Identifiable, PartiallyOrderable { - internal var clock: TimeInterval - internal var actorId: ActorID + var clock: TimeInterval + var actorId: ActorID /// A stable, unique identity for the wallclock timestamp. public var id: String { diff --git a/Tests/CRDTTests/ORMapTests.swift b/Tests/CRDTTests/ORMapTests.swift index abb1999..47668f6 100644 --- a/Tests/CRDTTests/ORMapTests.swift +++ b/Tests/CRDTTests/ORMapTests.swift @@ -1,5 +1,5 @@ // -// ORSetTests.swift +// ORMapTests.swift // @testable import CRDT