Repository navigation
refactor: split the cluster coordinator module - #420
Merged
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ember-server/src/cluster.rsheld all ofClusterCoordinatorin about 2,800 lines. It is now a directory with oneimpl ClusterCoordinatorblock per concern:mod.rs: the struct, construction, health, and savingnodes.conf. About 360 lines.commands.rs: the CLUSTER subcommands and the slot and cross-slot checks.failover.rs: elections, votes, promotion andCLUSTER 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, andReplicationInfo.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 didMAX_VOTE_EPOCH_AHEADfor one test. Clippy is clean and the server tests pass.