-
Notifications
You must be signed in to change notification settings - Fork 79
=cluster #52 Leader actions on convergence, including .removals #376
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
Changes from all commits
5a40413
c161dac
c09f301
816cdd6
0dc2073
37de2d7
08ba78e
a492a7b
099c37b
5b19aa8
71d2c95
977bb4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -267,6 +267,12 @@ public final class ActorSystem { | |
|
|
||
| /// Starts plugins after the system is fully initialized | ||
| self.settings.plugins.startAll(self) | ||
|
|
||
| self.log.info("Actor System [\(self.name)] initialized.") | ||
| if settings.cluster.enabled { | ||
| self.log.info("Actor System Settings in effect: Cluster.autoLeaderElection: \(self.settings.cluster.autoLeaderElection)") | ||
| self.log.info("Actor System Settings in effect: Cluster.downingStrategy: \(self.settings.cluster.downingStrategy)") | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kind of like this, helps a lot to realize what mode the cluster is in and what to expect of it... Open to ideas if this is too loud or nice
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe allow turning it off?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's nice. Only on system start-up so shouldn't be too noisy.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 ok, thanks! |
||
| } | ||
|
|
||
| public convenience init() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,7 +100,7 @@ extension CRDT.Replicator { | |
| self.remoteReplicators.remove(remoteReplicatorRef) | ||
|
|
||
| case .snapshot(let snapshot): | ||
| Cluster.Membership.diff(from: .empty, to: snapshot).changes.forEach { change in | ||
| Cluster.Membership._diff(from: .empty, to: snapshot).changes.forEach { change in | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found diffing to not be super correct, the "change" style APIs are the correct and well tested ones. So this will be internal kind of.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We only used it here btw from "empty" so it works fine. Will revisit it though
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| self.receiveClusterEvent(context, event: .membershipChange(change)) | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,8 @@ public struct VersionVector { | |
| // Internal state is a dictionary of replicas and their corresponding version | ||
| internal var state: [ReplicaId: Int] = [:] | ||
|
|
||
| public static let empty: VersionVector = .init() | ||
|
|
||
| public static func first(at replicaId: ReplicaId) -> Self { | ||
| .init((replicaId, 1)) | ||
| } | ||
|
|
@@ -89,6 +91,13 @@ public struct VersionVector { | |
| self.state.merge(other.state, uniquingKeysWith: max) | ||
| } | ||
|
|
||
| /// Prune any trace of the passed in replica id. | ||
| public func pruneReplica(_ replicaId: ReplicaId) -> Self { | ||
| var s = self | ||
| s.state.removeValue(forKey: replicaId) | ||
| return s | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need this since when we remove members completely from membership we need to also prune the seen tables. So a table like: when we remove B must become so we remove the entire vector that B owned, but also prune it from A's vector. |
||
|
|
||
| /// Obtain current version at the given replica. If the replica is unknown, the default version is 0. | ||
| /// | ||
| /// - Parameter replicaId: The replica whose version is being queried. | ||
|
|
||
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.
meh, auto-formatting does this
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.
Yea... since it kind of is in the "previous case" meh