[−][src]Trait lol_core::RaftApp
the abstraction for user-defined application runs on the RaftCore.
Required methods
#[must_use]fn process_message<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
request: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
how state machine interacts with inputs from clients.
#[must_use]fn apply_message<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Option<SnapshotTag>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
request: &'life1 [u8],
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Option<SnapshotTag>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
almost same as process_message but is called in log application path. this function may return new "copy snapshot" as a copy of the state after application.
#[must_use]fn install_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
snapshot: Option<&'life1 SnapshotTag>,
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
snapshot: Option<&'life1 SnapshotTag>,
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
special type of apply_message but when the entry is snapshot entry. snapshot is None happens iff apply_index is 1 which is the most initial snapshot.
#[must_use]fn fold_snapshot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
old_snapshot: Option<&'life1 SnapshotTag>,
requests: Vec<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<SnapshotTag>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
&'life0 self,
old_snapshot: Option<&'life1 SnapshotTag>,
requests: Vec<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<SnapshotTag>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
this function is called from compaction threads. it should return new snapshot from accumulative compution with the old_snapshot and the subsequent log entries.
#[must_use]fn from_snapshot_stream<'life0, 'async_trait>(
&'life0 self,
st: SnapshotStream,
snapshot_index: Index
) -> Pin<Box<dyn Future<Output = Result<SnapshotTag>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
st: SnapshotStream,
snapshot_index: Index
) -> Pin<Box<dyn Future<Output = Result<SnapshotTag>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
make a snapshot resource and returns the tag.
#[must_use]fn to_snapshot_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
x: &'life1 SnapshotTag
) -> Pin<Box<dyn Future<Output = SnapshotStream> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
x: &'life1 SnapshotTag
) -> Pin<Box<dyn Future<Output = SnapshotStream> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
make a snapshot stream from a snapshot resource bound to the tag.
#[must_use]fn delete_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
x: &'life1 SnapshotTag
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
x: &'life1 SnapshotTag
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
delete a snapshot resource bound to the tag.
Implementors
impl<A: RaftAppCompat> RaftApp for ToRaftApp<A>
[src]
fn process_message<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
request: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn apply_message<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Option<SnapshotTag>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
request: &'life1 [u8],
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Option<SnapshotTag>)>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn install_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
snapshot: Option<&'life1 SnapshotTag>,
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
snapshot: Option<&'life1 SnapshotTag>,
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn fold_snapshot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
old_snapshot: Option<&'life1 SnapshotTag>,
requests: Vec<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<SnapshotTag>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
old_snapshot: Option<&'life1 SnapshotTag>,
requests: Vec<&'life2 [u8]>
) -> Pin<Box<dyn Future<Output = Result<SnapshotTag>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn from_snapshot_stream<'life0, 'async_trait>(
&'life0 self,
st: SnapshotStream,
__arg2: Index
) -> Pin<Box<dyn Future<Output = Result<SnapshotTag>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
st: SnapshotStream,
__arg2: Index
) -> Pin<Box<dyn Future<Output = Result<SnapshotTag>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn to_snapshot_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
x: &'life1 SnapshotTag
) -> Pin<Box<dyn Future<Output = SnapshotStream> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
x: &'life1 SnapshotTag
) -> Pin<Box<dyn Future<Output = SnapshotStream> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete_resource<'life0, 'life1, 'async_trait>(
&'life0 self,
__arg1: &'life1 SnapshotTag
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
__arg1: &'life1 SnapshotTag
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,