Struct raftstore::store::fsm::peer::PeerFsm[][src]

pub struct PeerFsm<EK, ER> where
    EK: KvEngine,
    ER: RaftEngine
{ pub peer: Peer<EK, ER>, tick_registry: PeerTicks, missing_ticks: usize, hibernate_state: HibernateState, stopped: bool, has_ready: bool, mailbox: Option<BasicMailbox<PeerFsm<EK, ER>>>, pub receiver: Receiver<PeerMsg<EK>>, skip_split_count: usize, skip_gc_raft_log_ticks: usize, batch_req_builder: BatchRaftCmdRequestBuilder<EK>, }

Fields

peer: Peer<EK, ER>tick_registry: PeerTicks

A registry for all scheduled ticks. This can avoid scheduling ticks twice accidentally.

missing_ticks: usize

Ticks for speed up campaign in chaos state.

Followers will keep ticking in Idle mode to measure how many ticks have been skipped. Once it becomes chaos, those skipped ticks will be ticked so that it can campaign quickly instead of waiting an election timeout.

This will be reset to 0 once it receives any messages from leader.

hibernate_state: HibernateStatestopped: boolhas_ready: boolmailbox: Option<BasicMailbox<PeerFsm<EK, ER>>>receiver: Receiver<PeerMsg<EK>>skip_split_count: usize

when snapshot is generating or sending, skip split check at most REGION_SPLIT_SKIT_MAX_COUNT times.

skip_gc_raft_log_ticks: usize

Sometimes applied raft logs won’t be compacted in time, because less compact means less sync-log in apply threads. Stale logs will be deleted if the skip time reaches this skip_gc_raft_log_ticks.

batch_req_builder: BatchRaftCmdRequestBuilder<EK>

Implementations

impl<EK, ER> PeerFsm<EK, ER> where
    EK: KvEngine,
    ER: RaftEngine
[src]

pub fn create(
    store_id: u64,
    cfg: &Config,
    sched: Scheduler<RegionTask<EK::Snapshot>>,
    engines: Engines<EK, ER>,
    region: &Region
) -> Result<(LooseBoundedSender<PeerMsg<EK>>, Box<PeerFsm<EK, ER>>)>
[src]

pub fn replicate(
    store_id: u64,
    cfg: &Config,
    sched: Scheduler<RegionTask<EK::Snapshot>>,
    engines: Engines<EK, ER>,
    region_id: u64,
    peer: Peer
) -> Result<(LooseBoundedSender<PeerMsg<EK>>, Box<PeerFsm<EK, ER>>)>
[src]

pub fn region_id(&self) -> u64[src]

pub fn get_peer(&self) -> &Peer<EK, ER>[src]

pub fn peer_id(&self) -> u64[src]

pub fn stop(&mut self)[src]

pub fn set_pending_merge_state(&mut self, state: MergeState)[src]

pub fn schedule_applying_snapshot(&mut self)[src]

Trait Implementations

impl<EK: KvEngine, ER: RaftEngine> AbstractPeer for PeerFsm<EK, ER>[src]

impl<EK, ER> Drop for PeerFsm<EK, ER> where
    EK: KvEngine,
    ER: RaftEngine
[src]

impl<EK, ER> Fsm for PeerFsm<EK, ER> where
    EK: KvEngine,
    ER: RaftEngine
[src]

type Message = PeerMsg<EK>

fn set_mailbox(&mut self, mailbox: Cow<'_, BasicMailbox<Self>>) where
    Self: Sized
[src]

Set a mailbox to Fsm, which should be used to send message to itself.

fn take_mailbox(&mut self) -> Option<BasicMailbox<Self>> where
    Self: Sized
[src]

Take the mailbox from Fsm. Implementation should ensure there will be no reference to mailbox after calling this method.

impl<EK, ER, T> HandlerBuilder<PeerFsm<EK, ER>, StoreFsm<EK>> for RaftPollerBuilder<EK, ER, T> where
    EK: KvEngine + 'static,
    ER: RaftEngine + 'static,
    T: Transport + 'static, 
[src]

type Handler = RaftPoller<EK, ER, T>

impl<EK: KvEngine, ER: RaftEngine, T: Transport> PollHandler<PeerFsm<EK, ER>, StoreFsm<EK>> for RaftPoller<EK, ER, T>[src]

Auto Trait Implementations

impl<EK, ER> !RefUnwindSafe for PeerFsm<EK, ER>

impl<EK, ER> Send for PeerFsm<EK, ER>

impl<EK, ER> !Sync for PeerFsm<EK, ER>

impl<EK, ER> Unpin for PeerFsm<EK, ER> where
    ER: Unpin,
    <EK as KvEngine>::Snapshot: Unpin

impl<EK, ER> !UnwindSafe for PeerFsm<EK, ER>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<V, W> ConvertFrom<W> for V where
    W: ConvertTo<V>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]