pub struct ToRaftApp { /* private fields */ }Available on crate feature
simple only.Expand description
ToRaftApp turns an instance of RaftAppSimple into a RaftApp instance.
Implementations§
Source§impl ToRaftApp
impl ToRaftApp
pub fn new(app: impl RaftAppSimple, store: impl SnapshotRepository) -> Self
Trait Implementations§
Source§impl RaftApp for ToRaftApp
impl RaftApp for ToRaftApp
Source§fn process_read<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn process_read<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Process read request.
This operation should not change the state of the application.
Source§fn process_write<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
entry_index: Index,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, MakeSnapshot)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn process_write<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
entry_index: Index,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, MakeSnapshot)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Process write request.
This may change the state of the application. Read more
Source§fn install_snapshot<'life0, 'async_trait>(
&'life0 self,
snapshot: Option<Index>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn install_snapshot<'life0, 'async_trait>(
&'life0 self,
snapshot: Option<Index>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Special type of process_write but when the entry is a snapshot entry.
Snapshot is None when apply_index is 1 which is the most youngest snapshot.
Source§fn fold_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
old_snapshot: Option<Index>,
requests: Vec<&'life1 [u8]>,
snapshot_index: Index,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fold_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
old_snapshot: Option<Index>,
requests: Vec<&'life1 [u8]>,
snapshot_index: Index,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
This function is called from the compaction thread.
It should return new snapshot from accumulative computation with the old_snapshot and the subsequent log entries.
Source§fn save_snapshot<'life0, 'async_trait>(
&'life0 self,
st: SnapshotStream,
idx: Index,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save_snapshot<'life0, 'async_trait>(
&'life0 self,
st: SnapshotStream,
idx: Index,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Make a snapshot resource from an in-coming
SnapshotStream.Source§fn open_snapshot<'life0, 'async_trait>(
&'life0 self,
x: Index,
) -> Pin<Box<dyn Future<Output = Result<SnapshotStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open_snapshot<'life0, 'async_trait>(
&'life0 self,
x: Index,
) -> Pin<Box<dyn Future<Output = Result<SnapshotStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Open a
SnapshotStream from a snapshot resource.Auto Trait Implementations§
impl Freeze for ToRaftApp
impl !RefUnwindSafe for ToRaftApp
impl Send for ToRaftApp
impl Sync for ToRaftApp
impl Unpin for ToRaftApp
impl !UnwindSafe for ToRaftApp
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