pub struct RaftTransport { /* private fields */ }Expand description
Network transport for Raft
Implementations§
Source§impl RaftTransport
impl RaftTransport
Sourcepub fn new(
node_id: u64,
listen_addr: SocketAddr,
peer_addrs: HashMap<u64, SocketAddr>,
) -> (Self, UnboundedReceiver<Message>, UnboundedReceiver<Message>)
pub fn new( node_id: u64, listen_addr: SocketAddr, peer_addrs: HashMap<u64, SocketAddr>, ) -> (Self, UnboundedReceiver<Message>, UnboundedReceiver<Message>)
Create a new transport
Sourcepub async fn send_to_peer(&self, peer_id: u64, msg: Message) -> Result<()>
pub async fn send_to_peer(&self, peer_id: u64, msg: Message) -> Result<()>
Send a message to a specific peer
Sourcepub fn message_sender(&self) -> UnboundedSender<Message>
pub fn message_sender(&self) -> UnboundedSender<Message>
Get the message sender
Auto Trait Implementations§
impl Freeze for RaftTransport
impl !RefUnwindSafe for RaftTransport
impl Send for RaftTransport
impl Sync for RaftTransport
impl Unpin for RaftTransport
impl !UnwindSafe for RaftTransport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more