pub struct Pool { /* private fields */ }Expand description
A node’s station links. Cloning it shares the pool; the pool closes when
Pool::close is called or its last handle is dropped.
Implementations§
Source§impl Pool
impl Pool
Sourcepub async fn call(&self, c: Call) -> Result<Value, PoolError>
pub async fn call(&self, c: Call) -> Result<Value, PoolError>
Calls a procedure at a provider that serves it, as macula 12 calls
one. A provider’s ERROR comes back as
PoolError::Link(LinkError::Provider { .. }); when no candidate
answers, PoolError::NoProvider names each one tried.
Sourcepub async fn providers(
&self,
realm: &[u8; 32],
procedure: &str,
) -> Result<Vec<Provider>, PoolError>
pub async fn providers( &self, realm: &[u8; 32], procedure: &str, ) -> Result<Vec<Provider>, PoolError>
Every provider whose advertisement of procedure in realm the
realm’s pinned key authorizes, with the station each serves from,
freshest first.
Sourcepub async fn open_stream(&self, c: StreamCall) -> Result<Stream, PoolError>
pub async fn open_stream(&self, c: StreamCall) -> Result<Stream, PoolError>
Opens a streaming session at a provider of the procedure, reached as
Pool::call reaches one. The stream is open once its STREAM_OPEN
is sent; a provider’s or station’s refusal arrives on its first recv.
Sourcepub async fn station_target(
&self,
station: &[u8; 32],
) -> Result<Target, PoolError>
pub async fn station_target( &self, station: &[u8; 32], ) -> Result<Target, PoolError>
Where station is dialed, from the station_endpoint record the
station signed itself; one another key signed is refused.
Sourcepub async fn link_to(&self, station: &[u8; 32]) -> Result<Link, PoolError>
pub async fn link_to(&self, station: &[u8; 32]) -> Result<Link, PoolError>
A link to station: one the pool holds, or a direct link it dials to
the address in the station’s own endpoint record, pinned by its
node_id, within the default call timeout. A direct link that does not
come up on its first dial is not kept.
Sourcepub async fn find_record(&self, key: &[u8; 32]) -> Result<Verified, PoolError>
pub async fn find_record(&self, key: &[u8; 32]) -> Result<Verified, PoolError>
The record under key, verified, from the first link that answers.
Sourcepub async fn find_records(
&self,
key: &[u8; 32],
) -> Result<(Vec<Verified>, usize), PoolError>
pub async fn find_records( &self, key: &[u8; 32], ) -> Result<(Vec<Verified>, usize), PoolError>
The records under key that verify, and how many did not, from the
first link that answers.
Sourcepub async fn find_records_by_type(
&self,
t: RecordType,
) -> Result<(Vec<Verified>, usize), PoolError>
pub async fn find_records_by_type( &self, t: RecordType, ) -> Result<(Vec<Verified>, usize), PoolError>
The records of type t that verify, and how many did not, from the
first link that answers.
Source§impl Pool
impl Pool
Source§impl Pool
impl Pool
Sourcepub async fn connect(seeds: Vec<Seed>, opts: Opts) -> Result<Pool, PoolError>
pub async fn connect(seeds: Vec<Seed>, opts: Opts) -> Result<Pool, PoolError>
Checks seeds and opts, dials every seed, and returns once one link
is up, or PoolError::NoLink with each link’s last error when the
connect timeout passes first. Links not yet up keep dialing.
Sourcepub fn status(&self) -> Vec<LinkStatus>
pub fn status(&self) -> Vec<LinkStatus>
Every link the pool holds, seeds first.