pub mod client;
pub mod command;
mod commit_handler;
pub mod config;
mod election;
mod errors;
mod event;
mod maybe_clone_oneshot;
mod membership;
mod network;
mod purge;
mod raft;
mod raft_context;
mod raft_role;
mod replication;
mod state_machine_handler;
mod timer;
mod type_config;
mod utils;
pub mod storage;
#[cfg(feature = "watch")]
pub mod watch;
pub use client::*;
pub use command::*;
pub use config::*;
pub use errors::*;
pub use storage::*;
#[cfg(feature = "watch")]
pub use watch::*;
pub use membership::Membership;
pub use network::Transport;
pub use purge::PurgeExecutor;
pub use raft::{LeaderInfo, Raft, SignalParams};
pub use state_machine_handler::{SnapshotPolicy, StateMachineHandler};
pub use type_config::TypeConfig;
#[doc(hidden)]
pub use commit_handler::*;
#[doc(hidden)]
pub use election::*;
#[doc(hidden)]
pub use event::*;
#[doc(hidden)]
pub use maybe_clone_oneshot::*;
#[doc(hidden)]
pub use membership::*;
#[doc(hidden)]
pub use network::*;
#[doc(hidden)]
pub use purge::*;
#[doc(hidden)]
pub use raft_context::*;
#[doc(hidden)]
pub use raft_role::*;
#[doc(hidden)]
pub use replication::*;
#[doc(hidden)]
pub use state_machine_handler::*;
#[doc(hidden)]
pub use type_config::*;
#[doc(hidden)]
pub use utils::*;
pub(crate) use timer::*;
#[cfg(test)]
mod command_test;
#[cfg(test)]
mod maybe_clone_oneshot_test;
#[cfg(test)]
mod errors_test;
#[cfg(test)]
mod raft_oneshot_test;
#[cfg(any(test, feature = "__test_support"))]
#[doc(hidden)]
pub mod test_utils;
#[cfg(any(test, feature = "__test_support"))]
pub use test_utils::*;
pub(crate) fn if_higher_term_found(
my_current_term: u64,
term: u64,
is_learner: bool,
) -> bool {
if !is_learner && my_current_term < term {
tracing::warn!("my_current_term: {} < term: {} ?", my_current_term, term);
return true;
}
false
}
#[tracing::instrument]
pub(crate) fn is_target_log_more_recent(
my_last_log_index: u64,
my_last_log_term: u64,
target_last_log_index: u64,
target_last_log_term: u64,
) -> bool {
(target_last_log_term > my_last_log_term)
|| (target_last_log_term == my_last_log_term && target_last_log_index >= my_last_log_index)
}