59 lines
1.1 KiB
C
59 lines
1.1 KiB
C
#include "raft.h"
|
|
|
|
void raft_snapshot(const raft_state_t *s, raft_snapshot_t *snap)
|
|
{
|
|
snap->term = s->term;
|
|
snap->role = s->role;
|
|
snap->voted_for = s->voted_for;
|
|
snap->voted_for_term = s->voted_for_term;
|
|
snap->votes_granted = s->votes_granted;
|
|
snap->election_decided = s->election_decided;
|
|
}
|
|
|
|
int raft_init(raft_state_t *s, const raft_config_t *cfg)
|
|
{
|
|
(void)s;
|
|
(void)cfg;
|
|
return 0;
|
|
}
|
|
|
|
int raft_start_election(raft_state_t *s)
|
|
{
|
|
(void)s;
|
|
return 0;
|
|
}
|
|
|
|
int raft_on_vote_request(raft_state_t *s, int from_idx, uint64_t term,
|
|
uint64_t *reply_term)
|
|
{
|
|
(void)s;
|
|
(void)from_idx;
|
|
(void)term;
|
|
(void)reply_term;
|
|
return 0;
|
|
}
|
|
|
|
int raft_on_vote_reply(raft_state_t *s, int from_idx, int granted, uint64_t term)
|
|
{
|
|
(void)s;
|
|
(void)from_idx;
|
|
(void)granted;
|
|
(void)term;
|
|
return 0;
|
|
}
|
|
|
|
void raft_on_election_timeout(raft_state_t *s)
|
|
{
|
|
(void)s;
|
|
}
|
|
|
|
void raft_on_leader_lost(raft_state_t *s)
|
|
{
|
|
(void)s;
|
|
}
|
|
|
|
int raft_check_and_start_election(raft_state_t *s)
|
|
{
|
|
(void)s;
|
|
return 0;
|
|
}
|