From a7a8291e2f20abda4daf102e0f5014063518323d Mon Sep 17 00:00:00 2001 From: Li Wei Date: Tue, 5 Sep 2017 12:33:31 +0800 Subject: [PATCH] DAOS-333 include: Export raft_become_follower() Move the declaration of raft_become_follower() from raft_private.h to raft.h, so that users may voluntarily give up leadership. Signed-off-by: Li Wei --- include/raft.h | 4 ++++ include/raft_private.h | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/raft.h b/include/raft.h index 53bff120..c7512175 100644 --- a/include/raft.h +++ b/include/raft.h @@ -691,6 +691,10 @@ int raft_apply_all(raft_server_t* me_); * losing it's consensus guarantees. */ void raft_become_leader(raft_server_t* me); +/** Become follower. This may be used to give up leadership. It does not change + * currentTerm. */ +void raft_become_follower(raft_server_t* me); + /** Determine if entry is voting configuration change. * @param[in] ety The entry to query. * @return 1 if this is a voting configuration change. */ diff --git a/include/raft_private.h b/include/raft_private.h index b4c2a123..08481ffd 100644 --- a/include/raft_private.h +++ b/include/raft_private.h @@ -75,8 +75,6 @@ int raft_election_start(raft_server_t* me); int raft_become_candidate(raft_server_t* me); -void raft_become_follower(raft_server_t* me); - void raft_randomize_election_timeout(raft_server_t* me_); /**