pub struct HpcStateMachine<C, S>{ /* private fields */ }Expand description
The generic Raft state machine wrapping an application state.
Implementations§
Source§impl<C, S> HpcStateMachine<C, S>where
C: RaftTypeConfig<Entry = Entry<C>, SnapshotData = Cursor<Vec<u8>>>,
S: StateMachineState<C>,
LogId<C>: Serialize + DeserializeOwned,
StoredMembership<C>: Serialize + DeserializeOwned,
impl<C, S> HpcStateMachine<C, S>where
C: RaftTypeConfig<Entry = Entry<C>, SnapshotData = Cursor<Vec<u8>>>,
S: StateMachineState<C>,
LogId<C>: Serialize + DeserializeOwned,
StoredMembership<C>: Serialize + DeserializeOwned,
Trait Implementations§
Source§impl<C, S> RaftStateMachine<C> for HpcStateMachine<C, S>where
C: RaftTypeConfig<Entry = Entry<C>, SnapshotData = Cursor<Vec<u8>>>,
S: StateMachineState<C>,
LogId<C>: Serialize + DeserializeOwned,
StoredMembership<C>: Serialize + DeserializeOwned + Clone,
impl<C, S> RaftStateMachine<C> for HpcStateMachine<C, S>where
C: RaftTypeConfig<Entry = Entry<C>, SnapshotData = Cursor<Vec<u8>>>,
S: StateMachineState<C>,
LogId<C>: Serialize + DeserializeOwned,
StoredMembership<C>: Serialize + DeserializeOwned + Clone,
Source§type SnapshotBuilder = HpcSnapshotBuilder<C, S>
type SnapshotBuilder = HpcSnapshotBuilder<C, S>
Snapshot builder type.
Source§async fn applied_state(
&mut self,
) -> Result<(Option<LogId<C>>, StoredMembership<C>), Error>
async fn applied_state( &mut self, ) -> Result<(Option<LogId<C>>, StoredMembership<C>), Error>
Returns the last applied log id which is recorded in state machine, and the last applied
membership config. Read more
Source§async fn apply<Strm>(&mut self, entries: Strm) -> Result<(), Error>
async fn apply<Strm>(&mut self, entries: Strm) -> Result<(), Error>
Apply the given payload of entries to the state machine. Read more
Source§async fn get_snapshot_builder(&mut self) -> Self::SnapshotBuilder
async fn get_snapshot_builder(&mut self) -> Self::SnapshotBuilder
Get the snapshot builder for the state machine. Read more
Source§async fn begin_receiving_snapshot(&mut self) -> Result<Cursor<Vec<u8>>, Error>
async fn begin_receiving_snapshot(&mut self) -> Result<Cursor<Vec<u8>>, Error>
Create a new blank snapshot, returning a writable handle to the snapshot object. Read more
Source§async fn install_snapshot(
&mut self,
meta: &SnapshotMeta<C>,
snapshot: Cursor<Vec<u8>>,
) -> Result<(), Error>
async fn install_snapshot( &mut self, meta: &SnapshotMeta<C>, snapshot: Cursor<Vec<u8>>, ) -> Result<(), Error>
Install a snapshot which has finished streaming from the leader. Read more
Source§async fn get_current_snapshot(&mut self) -> Result<Option<Snapshot<C>>, Error>
async fn get_current_snapshot(&mut self) -> Result<Option<Snapshot<C>>, Error>
Get a readable handle to the current snapshot. Read more
Source§fn try_create_snapshot_builder(
&mut self,
force: bool,
) -> impl Future<Output = Option<Self::SnapshotBuilder>> + Send
fn try_create_snapshot_builder( &mut self, force: bool, ) -> impl Future<Output = Option<Self::SnapshotBuilder>> + Send
Try to create a snapshot builder for the state machine. Read more
Auto Trait Implementations§
impl<C, S> Freeze for HpcStateMachine<C, S>
impl<C, S> !RefUnwindSafe for HpcStateMachine<C, S>
impl<C, S> Send for HpcStateMachine<C, S>
impl<C, S> Sync for HpcStateMachine<C, S>
impl<C, S> Unpin for HpcStateMachine<C, S>
impl<C, S> UnsafeUnpin for HpcStateMachine<C, S>
impl<C, S> !UnwindSafe for HpcStateMachine<C, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request