[−][src]Struct raft4rs::raft::Raft
Fields
id: u64
applied: AtomicU64
store: RaftLog
replicas: RwLock<Vec<u64>>
resolver: RSL
Implementations
impl Raft
[src]
pub async fn new(
id: u64,
start_index: u64,
conf: Arc<Config>,
replicas: Vec<u64>,
resolver: RSL,
sm: SM
) -> RaftResult<Arc<Self>>
[src]
id: u64,
start_index: u64,
conf: Arc<Config>,
replicas: Vec<u64>,
resolver: RSL,
sm: SM
) -> RaftResult<Arc<Self>>
id is raft id: it unique in diff raft group start_index: to add member when raft group exists . set it for playback log not remove self it first to load it by disk , if not exists use by your set, if you unknow how to set , set it 0 conf is raft config replicas all members in raft group . resolver to find addr by node_id callback for app
pub async fn notify<'_>(self: &'_ Raft)
[src]
pub async fn execute<'_>(
self: &'_ Arc<Raft>,
cmd: Vec<u8>,
forward_leader: bool
) -> RaftResult<Vec<u8>>
[src]
self: &'_ Arc<Raft>,
cmd: Vec<u8>,
forward_leader: bool
) -> RaftResult<Vec<u8>>
pub async fn submit<'_>(
self: &'_ Arc<Raft>,
cmd: Vec<u8>,
forward_leader: bool
) -> RaftResult<()>
[src]
self: &'_ Arc<Raft>,
cmd: Vec<u8>,
forward_leader: bool
) -> RaftResult<()>
pub async fn add_member<'_>(self: &'_ Arc<Raft>, node_id: u64) -> RaftResult<()>
[src]
pub async fn remove_member<'_>(
self: &'_ Arc<Raft>,
node_id: u64
) -> RaftResult<()>
[src]
self: &'_ Arc<Raft>,
node_id: u64
) -> RaftResult<()>
pub async fn apply<'_, '_>(
self: &'_ Arc<Raft>,
entry: &'_ Entry
) -> RaftResult<()>
[src]
self: &'_ Arc<Raft>,
entry: &'_ Entry
) -> RaftResult<()>
pub fn get_resolver(&self) -> &RSL
[src]
pub async fn heartbeat<'_>(
&'_ self,
term: u64,
leader: u64,
committed: u64,
applied: u64
) -> RaftResult<()>
[src]
&'_ self,
term: u64,
leader: u64,
committed: u64,
applied: u64
) -> RaftResult<()>
pub async fn vote<'_>(
&'_ self,
leader: u64,
term: u64,
committed: u64
) -> RaftResult<()>
[src]
&'_ self,
leader: u64,
term: u64,
committed: u64
) -> RaftResult<()>
pub async fn leader_change<'_>(
&'_ self,
term: u64,
index: u64,
leader: u64
) -> RaftResult<()>
[src]
&'_ self,
term: u64,
index: u64,
leader: u64
) -> RaftResult<()>
pub async fn is_follower<'_>(&'_ self) -> bool
[src]
pub async fn is_leader<'_>(&'_ self) -> bool
[src]
pub fn leader(&self) -> u64
[src]
pub async fn is_candidate<'_>(&'_ self) -> bool
[src]
pub async fn get_state<'_>(&'_ self) -> RaftState
[src]
pub fn is_stoped(&self) -> bool
[src]
pub async fn update_apply<'_>(&'_ self, term: u64, index: u64) -> RaftResult<()>
[src]
pub async fn info<'_>(&'_ self) -> RaftInfo
[src]
impl Raft
[src]
pub async fn try_to_leader<'_>(self: &'_ Arc<Raft>) -> RaftResult<bool>
[src]
pub async fn to_follower<'_>(&'_ self)
[src]
impl Raft
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Raft
impl Send for Raft
impl Sync for Raft
impl Unpin for Raft
impl !UnwindSafe for Raft
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,