[−][src]Trait lol_core::RaftApp
The abstraction for user-defined application runs on the RaftCore.
Required methods
#[must_use]pub 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,
How state machine interacts with inputs from clients.
#[must_use]pub fn apply_message<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, MakeSnapshot)>> + 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>, MakeSnapshot)>> + 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 MakeSnapshot
to make a new snapshot.
Note that the snapshot entry corresponding to the copy snapshot is not guaranteed to be made
due to possible I/O errors, etc.
#[must_use]pub 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,
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]pub 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,
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]pub 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,
[src]
&'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]pub 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,
Make a snapshot stream from a snapshot resource bound to the tag.
#[must_use]pub 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,
[src]
&'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]
pub 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,
pub fn apply_message<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
apply_index: Index
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, MakeSnapshot)>> + 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>, MakeSnapshot)>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
pub 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,
pub 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,
pub 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,
pub 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,
pub 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,