pub trait RaftNetwork<C>: Send + Sync + 'staticwhere
    C: RaftTypeConfig,{
    // Required methods
    fn send_append_entries<'life0, 'async_trait>(
        &'life0 mut self,
        rpc: AppendEntriesRequest<C>
    ) -> Pin<Box<dyn Future<Output = Result<AppendEntriesResponse<C::NodeId>, RPCError<C::NodeId, C::Node, RaftError<C::NodeId>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_install_snapshot<'life0, 'async_trait>(
        &'life0 mut self,
        rpc: InstallSnapshotRequest<C>
    ) -> Pin<Box<dyn Future<Output = Result<InstallSnapshotResponse<C::NodeId>, RPCError<C::NodeId, C::Node, RaftError<C::NodeId, InstallSnapshotError>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_vote<'life0, 'async_trait>(
        &'life0 mut self,
        rpc: VoteRequest<C::NodeId>
    ) -> Pin<Box<dyn Future<Output = Result<VoteResponse<C::NodeId>, RPCError<C::NodeId, C::Node, RaftError<C::NodeId>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A trait defining the interface for a Raft network between cluster members.

See the network chapter of the guide for details and discussion on this trait and how to implement it.

Typically, the network implementation as such will be hidden behind a Box<T> or Arc<T> and this interface implemented on the Box<T> or Arc<T>.

A single network instance is used to connect to a single target node. The network instance is constructed by the RaftNetworkFactory.

Required Methods§

source

fn send_append_entries<'life0, 'async_trait>( &'life0 mut self, rpc: AppendEntriesRequest<C> ) -> Pin<Box<dyn Future<Output = Result<AppendEntriesResponse<C::NodeId>, RPCError<C::NodeId, C::Node, RaftError<C::NodeId>>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Send an AppendEntries RPC to the target Raft node (§5).

source

fn send_install_snapshot<'life0, 'async_trait>( &'life0 mut self, rpc: InstallSnapshotRequest<C> ) -> Pin<Box<dyn Future<Output = Result<InstallSnapshotResponse<C::NodeId>, RPCError<C::NodeId, C::Node, RaftError<C::NodeId, InstallSnapshotError>>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Send an InstallSnapshot RPC to the target Raft node (§7).

source

fn send_vote<'life0, 'async_trait>( &'life0 mut self, rpc: VoteRequest<C::NodeId> ) -> Pin<Box<dyn Future<Output = Result<VoteResponse<C::NodeId>, RPCError<C::NodeId, C::Node, RaftError<C::NodeId>>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Send a RequestVote RPC to the target Raft node (§5).

Implementors§