Skip to content

Commit

Permalink
Refactoring the test and adding comments
Browse files Browse the repository at this point in the history
  • Loading branch information
andreev-io committed Aug 21, 2021
1 parent 2645fe1 commit 6bf7889
Show file tree
Hide file tree
Showing 4 changed files with 759 additions and 282 deletions.
3 changes: 2 additions & 1 deletion little_raft/src/replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ where
}

fn process_message(&mut self, message: Message<T>) {
match self.state {
match self.state {
State::Leader => self.process_message_as_leader(message),
State::Candidate => self.process_message_as_candidate(message),
State::Follower => self.process_message_as_follower(message),
Expand Down Expand Up @@ -441,6 +441,7 @@ where
vote_granted: true,
},
);
self.voted_for = Some(from_id);
} else {
// If the criteria are not met, do not grant the vote.
self.cluster.lock().unwrap().send_message(
Expand Down
281 changes: 0 additions & 281 deletions little_raft/tests/raft.rs

This file was deleted.

Loading

0 comments on commit 6bf7889

Please sign in to comment.