Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: setup Leader state and impl on_leader() #32

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
leader timeout
toidiu committed Jan 23, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit eabfb612fb559aed36b61affbe0b880f37b43b24
7 changes: 5 additions & 2 deletions src/mode/leader.rs
Original file line number Diff line number Diff line change
@@ -76,8 +76,11 @@ impl Leader {
}
}

pub fn on_timeout<IO: ServerIO>(&mut self, _context: &mut Context<IO>) {
todo!()
pub fn on_timeout<IO: ServerIO>(&mut self, context: &mut Context<IO>) {
//% Compliance:
//% Upon election: send initial empty AppendEntries RPCs (heartbeat) to each server; repeat
//% during idle periods to prevent election timeouts (§5.2)
self.send_heartbeat(context);
}

pub fn on_recv<IO: ServerIO>(&mut self, _rpc: crate::rpc::Rpc, _context: &mut Context<IO>) {