From c8457ce61adc6a3b9e6223ca147f5196f99e22cc Mon Sep 17 00:00:00 2001 From: Konrad `ktoso` Malawski Date: Sat, 29 Jan 2022 10:23:46 +0900 Subject: [PATCH] Revert "make Baggage Sendable (#17)" (#23) This reverts commit 23440233b8484f156cbe11e2f48f2e44b9878275. --- .gitignore | 2 -- Sources/InstrumentationBaggage/Baggage.swift | 12 +++--------- .../InstrumentationBaggage/BaggageKey.swift | 6 +++--- docker/docker-compose.2004.54.yaml | 18 ------------------ docker/docker-compose.2004.55.yaml | 18 ------------------ docker/docker-compose.2004.main.yaml | 17 ----------------- 6 files changed, 6 insertions(+), 67 deletions(-) delete mode 100644 docker/docker-compose.2004.54.yaml delete mode 100644 docker/docker-compose.2004.55.yaml delete mode 100644 docker/docker-compose.2004.main.yaml diff --git a/.gitignore b/.gitignore index 1c7cab1..efd5d78 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,3 @@ Package.resolved /*.xcodeproj xcuserdata/ .swiftpm -.vscode/ -.history diff --git a/Sources/InstrumentationBaggage/Baggage.swift b/Sources/InstrumentationBaggage/Baggage.swift index 474bd4f..267e56a 100644 --- a/Sources/InstrumentationBaggage/Baggage.swift +++ b/Sources/InstrumentationBaggage/Baggage.swift @@ -13,12 +13,6 @@ // //===----------------------------------------------------------------------===// -#if swift(>=5.5) && canImport(_Concurrency) -public typealias _Baggage_Sendable = Swift.Sendable -#else -public typealias _Baggage_Sendable = Any -#endif - /// A `Baggage` is a heterogeneous storage type with value semantics for keyed values in a type-safe fashion. /// /// Its values are uniquely identified via `BaggageKey`s (by type identity). These keys also dictate the type of @@ -71,8 +65,8 @@ public typealias _Baggage_Sendable = Any /// `Baggage` does not expose more functions on purpose to prevent abuse and treating it as too much of an /// arbitrary value smuggling container, but only make it convenient for tracing and instrumentation systems which need /// to access either specific or all items carried inside a baggage. -public struct Baggage: _Baggage_Sendable { - private var _storage = [AnyBaggageKey: _Baggage_Sendable]() +public struct Baggage { + private var _storage = [AnyBaggageKey: Any]() /// Internal on purpose, please use `Baggage.TODO` or `Baggage.topLevel` to create an "empty" baggage, /// which carries more meaning to other developers why an empty baggage was used. @@ -157,7 +151,7 @@ extension Baggage { /// Carried automatically by a "to do" baggage. /// It can be used to track where a baggage originated and which "to do" baggage must be fixed into a real one to avoid this. -public struct TODOLocation: _Baggage_Sendable { +public struct TODOLocation { /// Source file location where the to-do `Baggage` was created public let file: String /// Source line location where the to-do `Baggage` was created diff --git a/Sources/InstrumentationBaggage/BaggageKey.swift b/Sources/InstrumentationBaggage/BaggageKey.swift index 7f01205..2e2d8f2 100644 --- a/Sources/InstrumentationBaggage/BaggageKey.swift +++ b/Sources/InstrumentationBaggage/BaggageKey.swift @@ -39,9 +39,9 @@ /// } /// /// This pattern allows library authors fine-grained control over which values may be set, and which only get by end-users. -public protocol BaggageKey: _Baggage_Sendable { +public protocol BaggageKey { /// The type of value uniquely identified by this key. - associatedtype Value: _Baggage_Sendable + associatedtype Value /// The human-readable name of this key. /// This name will be used instead of the type name when a value is printed. @@ -62,7 +62,7 @@ extension BaggageKey { } /// A type-erased `BaggageKey` used when iterating through the `Baggage` using its `forEach` method. -public struct AnyBaggageKey: _Baggage_Sendable { +public struct AnyBaggageKey { /// The key's type represented erased to an `Any.Type`. public let keyType: Any.Type diff --git a/docker/docker-compose.2004.54.yaml b/docker/docker-compose.2004.54.yaml deleted file mode 100644 index 868c738..0000000 --- a/docker/docker-compose.2004.54.yaml +++ /dev/null @@ -1,18 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-distributed-tracing-baggage:20.04-5.4 - build: - args: - ubuntu_version: "focal" - swift_version: "5.4" - - test: - image: swift-distributed-tracing-baggage:20.04-5.4 - environment: [] - #- SANITIZER_ARG=--sanitize=thread - - shell: - image: swift-distributed-tracing-baggage:20.04-5.4 \ No newline at end of file diff --git a/docker/docker-compose.2004.55.yaml b/docker/docker-compose.2004.55.yaml deleted file mode 100644 index 15e51e2..0000000 --- a/docker/docker-compose.2004.55.yaml +++ /dev/null @@ -1,18 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-distributed-tracing-baggage:20.04-5.5 - build: - args: - ubuntu_version: "focal" - swift_version: "5.5" - - test: - image: swift-distributed-tracing-baggage:20.04-5.5 - environment: [] - #- SANITIZER_ARG=--sanitize=thread - - shell: - image: swift-distributed-tracing-baggage:20.04-5.5 diff --git a/docker/docker-compose.2004.main.yaml b/docker/docker-compose.2004.main.yaml deleted file mode 100644 index c138963..0000000 --- a/docker/docker-compose.2004.main.yaml +++ /dev/null @@ -1,17 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-distributed-tracing-baggage:20.04-main - build: - args: - base_image: "swiftlang/swift:nightly-main-focal" - - - test: - image: swift-distributed-tracing-baggage:20.04-main - environment: [] - #- SANITIZER_ARG=--sanitize=thread - shell: - image: swift-distributed-tracing-baggage:20.04-main \ No newline at end of file