Skip to content

Conversation

@ktoso
Copy link
Member

@ktoso ktoso commented Apr 24, 2023

Motivation:

It was not possible to implement a "real" leadership election using whatever mechanism one could dream up using the current exposed methods.

We now expose assumeLeader which makes the local assumption change, and therefore it is possible to call that method from real leadership election implementations. We should offer more of those AND document how to implement your custom one -- the example impl could be a bully implementation for example.

The test uses a dumb implementation that is only there for showcasing how to use the receptionist to discover peers in the process.

Modifications:

  • LeaderElection -> LegacyLeaderElection, because it was using NIO Futures
  • add cluster.assumeLeader
  • add a few methods to await waitToBecomeLeader and waitForLeader(atLeast:within:)

Result:

Ability to implement ANY leadership election mechanism and inform the cluster node which node should be considered the leader.

The leader decision is NOT gossiped. This is entirely up to the leader election mechanism to propagate this information.

@ktoso
Copy link
Member Author

ktoso commented Apr 24, 2023

@swift-server-bot test this please

@ktoso ktoso force-pushed the wip-custom-leadership branch from 153f11d to 7113d6e Compare April 24, 2023 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant