Trait State

Source
pub trait State<Cmd> {
    type Output;
    type Error;

    // Required methods
    fn process(
        &self,
        command: &[(Node, Cmd)],
    ) -> Result<Self::Output, Self::Error>;
    fn tick(&self) -> Result<Vec<(Node, Cmd)>, Self::Error>;
}

Required Associated Types§

Required Methods§

Source

fn process(&self, command: &[(Node, Cmd)]) -> Result<Self::Output, Self::Error>

Note: This method takes reference, not mutable, to self; this allows for easier composition of state.

Source

fn tick(&self) -> Result<Vec<(Node, Cmd)>, Self::Error>

Implementors§

Source§

impl<Cmd, Req, T> State<Cmd> for Raft<Req, Cmd, T>
where Req: State<Cmd, Output = Vec<Packet<Cmd>>, Error = Failure> + State<T, Output = Cmd, Error = Failure>,

Source§

impl<Cmd: Serialize + DeserializeOwned + Clone, Ser: Serializer> State<Req<Cmd>> for FineGrained<Cmd, Ser>