-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
type:docsDocumentation, guides, API references, examples.Documentation, guides, API references, examples.type:refactorCode restructuring without changing external behaviorCode restructuring without changing external behavior
Milestone
Description
Changes
Refactored Node::run() to eliminate scattered control flow and improve code clarity:
Before: Multiple is_learner() checks scattered throughout, mixed Learner/Voter logic
After: Strategy pattern with clear separation:
run_as_learner()- Learner-specific bootstraprun_as_voter()- Voter-specific bootstrapwarmup_with_shutdown()- Extracted common shutdown handlingstart_raft_loop()- Shutdown-aware main loop entry
Benefits
- Single point of role branching (one
is_learner()check) - Eliminates code duplication in shutdown handling
- Clear, linear bootstrap flow for each node type
- Fixes potential race: shutdown check before
raft.run() - Better reflects Raft protocol semantics (Learners don't need cluster quorum)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type:docsDocumentation, guides, API references, examples.Documentation, guides, API references, examples.type:refactorCode restructuring without changing external behaviorCode restructuring without changing external behavior
Type
Projects
Status
Done