Struct network::peer_manager::PeerManagerRequestSender [−][src]
pub struct PeerManagerRequestSender { /* fields omitted */ }Expand description
Convenience wrapper which makes it easy to issue communication requests and await the responses from PeerManager.
Implementations
Construct a new PeerManagerRequestSender with a raw channel::Sender
pub fn send_to(
&self,
peer_id: PeerId,
protocol_id: ProtocolId,
mdata: Bytes
) -> Result<(), PeerManagerError>
pub fn send_to(
&self,
peer_id: PeerId,
protocol_id: ProtocolId,
mdata: Bytes
) -> Result<(), PeerManagerError>
Send a fire-and-forget direct-send message to remote peer.
The function returns when the message has been enqueued on the network actor’s event queue. It therefore makes no reliable delivery guarantees. An error is returned if the event queue is unexpectedly shutdown.
pub fn send_to_many(
&self,
recipients: impl Iterator<Item = PeerId>,
protocol_id: ProtocolId,
mdata: Bytes
) -> Result<(), PeerManagerError>
pub fn send_to_many(
&self,
recipients: impl Iterator<Item = PeerId>,
protocol_id: ProtocolId,
mdata: Bytes
) -> Result<(), PeerManagerError>
Send the same message to many recipients using the direct-send protocol.
This method is an optimization so that we can avoid serializing and
copying the same message many times when we want to sent a single message
to many peers. Note that the Bytes the messages is serialized into is a
ref-counted byte buffer, so we can avoid excess copies as all direct-sends
will share the same underlying byte buffer.
The function returns when all send requests have been enqueued on the network actor’s event queue. It therefore makes no reliable delivery guarantees. An error is returned if the event queue is unexpectedly shutdown.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PeerManagerRequestSender
impl Send for PeerManagerRequestSender
impl Sync for PeerManagerRequestSender
impl Unpin for PeerManagerRequestSender
impl UnwindSafe for PeerManagerRequestSender
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
type Output = T
type Output = T
Should always be Self