Skip to content

refactor: split the cluster coordinator module - #420

Merged
kacy merged 1 commit into
mainfrom
refactor/split-cluster
Sep 24, 2026
Merged

kacy merged 1 commit into
mainfrom
refactor/split-cluster

Conversation

@kacy

@kacy kacy commented Sep 24, 2026

Copy link
Copy Markdown
Owner

ember-server/src/cluster.rs held all of ClusterCoordinator in about 2,800 lines. It is now a directory with one impl ClusterCoordinator block per concern:

  • mod.rs: the struct, construction, health, and saving nodes.conf. About 360 lines.
  • commands.rs: the CLUSTER subcommands and the slot and cross-slot checks.
  • failover.rs: elections, votes, promotion and CLUSTER FAILOVER, with the election constants.
  • gossip.rs: the gossip socket, direct sends, slot broadcasts and the event loop.
  • raft.rs: attaching Raft and applying its committed state.
  • replication.rs: the replication server and client, and ReplicationInfo.
  • tests.rs: the unit tests, unchanged.

The code moved unchanged. Methods that were private, and are called from another part of the module or from the tests, became pub(super), as did MAX_VOTE_EPOCH_AHEAD for one test. Clippy is clean and the server tests pass.

The server's cluster.rs was about 2,800 lines. The coordinator's methods
now live in cluster/ by concern: commands, failover, gossip, raft and
replication, with the struct, construction and config saving in mod.rs
and the tests in tests.rs. No code changed; private methods that other
parts of the module call became pub(super).
@kacy
kacy merged commit 1770088 into main Sep 24, 2026
12 checks passed
@kacy
kacy deleted the refactor/split-cluster branch September 24, 2026 21:33
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