pub struct NetworkSender<TMessage> { /* private fields */ }
Expand description

NetworkSender is the generic interface from upper network applications to the lower network layer. It provides the full API for network applications, including sending direct-send messages, sending rpc requests, as well as dialing or disconnecting from peers and updating the list of accepted public keys.

NetworkSender is in fact a thin wrapper around a PeerManagerRequestSender, which in turn is a thin wrapper on aptos_channel::Sender<(PeerId, ProtocolId), PeerManagerRequest>, mostly focused on providing a more ergonomic API. However, network applications will usually provide their own thin wrapper around NetworkSender that narrows the API to the specific interface they need. For instance, mempool only requires direct-send functionality so its MempoolNetworkSender only exposes a send_to function.

Provide Protobuf wrapper over [peer_manager::PeerManagerRequestSender]

Implementations

Request that a given Peer be dialed at the provided NetworkAddress and synchronously wait for the request to be performed.

Request that a given Peer be disconnected and synchronously wait for the request to be performed.

Send a protobuf message to a single recipient. Provides a wrapper over [peer_manager::PeerManagerRequestSender::send_to].

Send a protobuf message to a many recipients. Provides a wrapper over [peer_manager::PeerManagerRequestSender::send_to_many].

Send a protobuf rpc request to a single recipient while handling serialization and deserialization of the request and response respectively. Assumes that the request and response both have the same message type.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more