-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concurrency update #99
base: main
Are you sure you want to change the base?
Conversation
Sources/SWIM/SWIM.swift
Outdated
public enum GossipPayload<Peer: SWIMPeer>: Sendable { | ||
public struct GossipPayload<Peer: SWIMPeer>: Codable, Sendable { | ||
/// Explicit case to signal "no gossip payload" | ||
/// | ||
/// Effectively equivalent to an empty `.membership([])` case. | ||
case none | ||
/// Gossip information about a few select members. | ||
case membership([SWIM.Member<Peer>]) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As .none
basically an Optional, I've decided to change GossipPayload
from enum to struct having only members. All other parts of code should use Optional<GossipPayload<Peer>>
or basically GossipPayload<Peer>>?
as a more visible and Swifty way.
@ktoso I will create a draft PR, so it will be easier for me to return to this topic from time to time and not to forget. Basically it's already working at that stage, but I've been updating all the errors and warning reactively, so not much thought in it. :) |
cdc7588
to
99fe662
Compare
We now have CI again so let's give this a review tomorrow and merge maybe :) |
If you'd run
that will resolve many of the conflicts i think |
lot's of conflicts, will probably have a good time resolving |
Motivation
Library being written even before async/await. So now, even though it supports it partly, with upcoming Swift 6 release and strict concurrency we should update it.
Plan
First steps after looking at the state of library, should be straightforward (in a way):
Will assume, that when finished library will be compatible with Swift 6. But here comes a bit different question—could code and design be even more clear having async/await, actors and etc. To answer this question, as a next steps I want to remove EventLoop and Promises in
SWIMNIOExample
and see how it works. Based on that experience would be interesting to check if any design updates even needed.