pub type Pusher = Endpoint<Push>;Expand description
The sending half of Push/Pull.
Aliased Type§
pub struct Pusher { /* private fields */ }Implementations§
Source§impl Pusher
impl Pusher
Sourcepub async fn connect(&self, url: &str) -> Result<(), Error>
pub async fn connect(&self, url: &str) -> Result<(), Error>
Connects to weida://host:port/path.
The address is kept: a lost connection is redialled by the runtime
under crate::RuntimeConfig::reconnect, and Pusher::events
reports it.
Sourcepub fn disconnect(&self, url: &str) -> bool
pub fn disconnect(&self, url: &str) -> bool
Forgets a dialled address; see Peer::disconnect.
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Number of connected peers.
Sourcepub fn connection_stats(&self) -> Vec<ConnectionStats>
pub fn connection_stats(&self) -> Vec<ConnectionStats>
One record per live connection, labelled by the URL as dialled; see
Peer::connection_stats.
Sourcepub fn events(&self) -> PeerEvents
pub fn events(&self) -> PeerEvents
The event stream of this pusher’s addresses; see Peer::events.
Sourcepub fn dropped(&self) -> u64
pub fn dropped(&self) -> u64
Bodies the outbox discarded; see Peer::dropped.
Sourcepub async fn open(&self, meta: TransferMeta) -> Result<OutgoingTransfer, Error>
pub async fn open(&self, meta: TransferMeta) -> Result<OutgoingTransfer, Error>
Opens a one-way transfer to the next peer, round-robin.
Use this rather than Pusher::send when the transport receipt
matters: OutgoingTransfer::finish hands back a
crate::Delivery that resolves once the peer’s transport holds every
byte. The stream is the application’s: with every peer down this
waits for the redial, and a stream on a connection that dies fails
with ConnectionLost and is not reopened by anyone but the caller.
Sourcepub async fn send(&self, body: &[u8]) -> Result<(), Error>
pub async fn send(&self, body: &[u8]) -> Result<(), Error>
Sends body as one message: the runtime owns it from this call.
Pipeline semantics: the delivery receipt is discarded, so a push costs
no round trip and reports only failures the local side already knows
about. With a live peer the body is written at once; with none it is
held in the outbox and written once a peer is back, in order, and a
full outbox applies the configured backpressure (Peer::send).
Callers who want the receipt use Pusher::open and await
crate::Delivery::delivered themselves.
Sourcepub async fn send_with(
&self,
meta: TransferMeta,
body: &[u8],
) -> Result<(), Error>
pub async fn send_with( &self, meta: TransferMeta, body: &[u8], ) -> Result<(), Error>
Like Pusher::send, with explicit metadata.