raftify 0.1.82

Experimental High level Raft framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use tonic::async_trait;

use crate::Result;

#[async_trait]
pub trait AbstractStateMachine: Clone + Send + Sync {
    async fn apply(&mut self, log_entry: Vec<u8>) -> Result<Vec<u8>>;
    async fn snapshot(&self) -> Result<Vec<u8>>;
    async fn restore(&mut self, snapshot: Vec<u8>) -> Result<()>;

    fn encode(&self) -> Result<Vec<u8>>;
    fn decode(bytes: &[u8]) -> Result<Self>
    where
        Self: Sized;
}