Skip to main content

Requester

Type Alias Requester 

Source
pub type Requester = Endpoint<Req>;
Expand description

The requesting half of Req/Rep.

Aliased Type§

pub struct Requester { /* private fields */ }

Implementations§

Source§

impl Requester

Source

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 Requester::events reports it.

Source

pub fn disconnect(&self, url: &str) -> bool

Forgets a dialled address; see Peer::disconnect.

Source

pub fn peer_count(&self) -> usize

Number of connected peers.

Source

pub fn events(&self) -> PeerEvents

The event stream of this requester’s addresses; see Peer::events.

Source

pub async fn open( &self, meta: TransferMeta, ) -> Result<(OutgoingTransfer, ReplyStream), Error>

Opens one exchange: a request stream and its reply half.

Both halves belong to the same bidirectional QUIC stream, so no correlation identifier is needed and none is sent.

Source

pub async fn request(&self, body: &[u8]) -> Result<IncomingTransfer, Error>

Sends body as one request and returns the reply stream.

Convenience over Requester::open for small payloads; it never materializes the reply. The delivery receipt is discarded: a reply is a stronger answer than a transport acknowledgement, and waiting for both would only add a round trip.

Source

pub async fn request_with( &self, meta: TransferMeta, body: &[u8], ) -> Result<IncomingTransfer, Error>

Like Requester::request, with explicit metadata.