Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Implement access control for baggage items via key properties #1

Closed
wants to merge 42 commits into from

Conversation

ktoso
Copy link
Member

@ktoso ktoso commented Oct 7, 2020

Access control for baggage items.

This is the low level piece to resolve apple/swift-service-context#2

slashmo and others added 30 commits June 25, 2020 11:15
* Writeup about context passing style guideline

Polished version of what we had in slashmo/gsoc-swift-tracing#12

* Update README.md

Co-authored-by: Moritz Lang <[email protected]>

* Update README.md

Co-authored-by: Moritz Lang <[email protected]>

* Update README.md

Co-authored-by: Moritz Lang <[email protected]>

* Update README.md

Co-authored-by: Moritz Lang <[email protected]>

* Update README.md

Co-authored-by: Moritz Lang <[email protected]>

* Update README.md

Co-authored-by: Moritz Lang <[email protected]>

* Update README.md

Co-authored-by: Moritz Lang <[email protected]>
slight formatting fix for readme
* Add license header validation script

* Add naming validation script
=readme bolden the primary usage style
Add installation instructions 📖
+simple benchmarks to have a gut feeling how mutating and the CoW cos…
WIP #7: on holding baggage in framework protocols
Update instalation instructions for 0.2.0 📖
* adding SSWG meeting notes

* Update README.md

* Update README.md

Co-authored-by: Moritz Lang <[email protected]>

Co-authored-by: Moritz Lang <[email protected]>
Small updates in context passing guidelines
Prefix Benchmark targets to avoid name clashes
@ktoso ktoso self-assigned this Oct 7, 2020
Copy link
Collaborator

@slashmo slashmo left a comment

Choose a reason for hiding this comment

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

LGTM 👌

@@ -185,6 +185,7 @@ extension Baggage {
return self._storage.count
}

/// Returns true if the baggage has no items stored.
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍


public enum ForEachAccessType: Int, Hashable {
/// Access all accessible values (i.e. `public` and `publicExceptLogging` values; `private` values are skipped)
case allPublic = 8
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense to add a comment on why you chose 8 here? I'm guessing it's to have a bit of headroom when adding more cases in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

okey will do -- it's pretty sneaky, it matches up with the values used in the Access enum but "inverse"

Yes 8 because to leave space for other values if ever necessary

}

extension Baggage {
public typealias AccessPolicy = BaggageAccessPolicy
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is an interesting pattern to work around not being able to nest types in protocols, also noticed you added this for Baggage.Key 👀👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I do this often actually. Not everyone loves it, but for those two types it's nice since it's all Baggage.[complete] then :)


extension AnyBaggageKey: CustomStringConvertible {
public var description: String {
return "AnyBaggageKey(\(self.name), access: \(self.access))"
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@ktoso ktoso closed this Oct 14, 2020
@ktoso ktoso deleted the access-control branch October 14, 2020 03:11
@ktoso ktoso restored the access-control branch October 14, 2020 03:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Access control per baggage item key
3 participants