-
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
Convert APIs to async #84
Conversation
eaca089
to
d15fc04
Compare
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.
This is ready for review.
Looking in depth now, along with apple/swift-distributed-actors#977 I think by landing both updates at the same time we can bump APIs and make them all async native etc 👍 |
Change `ping` and `pingRequest` to async and remove `onResponse` callback parameter. This change requires Swift 5.5.
Removed the embedded tests for now, way too much pain than they're worth -- until we get an async/await aware embedded NIO testing story (soon). Ticket here: Bring back embedded SWIMNIO tests, which are had without async-aware "Embedded" infra #86 |
@@ -46,7 +46,7 @@ extension SWIM { | |||
public let localSuspicionStartedAt: DispatchTime? // could be "status updated at"? | |||
|
|||
/// Create a new member. | |||
public init(peer: SWIMPeer, status: SWIM.Status, protocolPeriod: UInt64, suspicionStartedAt: DispatchTime? = nil) { | |||
public init(peer: Peer, status: SWIM.Status, protocolPeriod: UInt64, suspicionStartedAt: DispatchTime? = nil) { |
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.
Do we want to change suspicionStartedAt
to an Instant
type instead?
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.
I seem to remember instant isn't great for this but maybe I'm wrong...?
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.
I ticketified #87
Sources/SWIM/Utils/time.swift
Outdated
} | ||
|
||
/// Represents number of nanoseconds within given time unit | ||
enum PrettyTimeUnit: Int64 { |
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.
Used?
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.
removed, thanks!
case nanoseconds = 1 | ||
// @formatter:on | ||
|
||
var abbreviated: String { |
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.
Used?
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.
seems not, removing --
Sources/SWIMNIOExample/NIOPeer.swift
Outdated
self.timeout = timeout | ||
self.message = message | ||
} | ||
|
||
public var description: String { | ||
"SWIMNIOTimeoutError(timeout: \(self.timeout.prettyDescription), \(self.message))" | ||
"SWIMNIOTimeoutError(timeout: \(self.timeout), \(self.message))" |
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.
We don't want to keep prettyDescription
?
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.
Just because I didn't want to make a public extension with the pretty stuff on the Swift types, figured we shouldn't add public API on those
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.
Sorry my bad, should be fine since it is internal here
Co-authored-by: Yim Lee <[email protected]>
Change
ping
andpingRequest
to async and removeonResponse
callback parameter.This change requires Swift 5.5.
DO NOT MERGE for there are broken tests