Skip to main content

Module pool

Module pool 

Source
Expand description

The pool feature: the app side of remote inference over weirdnet-net.

  • NetDialer: a Dialer that opens agent protocol streams to peers by id.
  • LinkedNodes: a NodeSource of the inference nodes among the user’s linked devices (active certs in the weirdnet-sync roster whose node announces INFERENCE_APP), direct connections before relayed ones.
  • connect: a Pool over both, presenting this device’s certificate.
  • connect_shared (since 0.5.9): a Pool over a pool owned by another Weirdnet identity, from its PoolShare link: the share’s nodes in order (no roster discovery), dialed by peer id with the share’s addresses, presenting this device’s guest credential (encode_credential). The owner’s nodes admit it by their guest policy (serve::GuestAuth); a refusal (not-shared, guest-revoked, wrong-user from a node that does not take guests) comes back as RemoteError::Refused.

Dialing another user’s node needs nothing special: weirdnet-net streams are authenticated by the peer id (Noise), whoever its user is, and relay circuit addresses (.../p2p-circuit/p2p/<id>) in the share work as for linked devices. The peer ids in the share are what the connection checks, so take shares only from someone you trust to name the pool’s nodes (as with any link).

The pool itself (crate::remote::pool) is transport-neutral.

Re-exports§

pub use crate::remote::pool::Answer;
pub use crate::remote::pool::CatalogWatch;
pub use crate::remote::pool::EventSink;
pub use crate::remote::pool::Interrupted;
pub use crate::remote::pool::Job;
pub use crate::remote::pool::NoEvents;
pub use crate::remote::pool::NodeSource;
pub use crate::remote::pool::Pool;
pub use crate::remote::pool::PoolEvent;
pub use crate::remote::pool::PoolOptions;
pub use crate::remote::pool::Stall;
pub use crate::remote::share::PoolShare;
pub use crate::remote::share::ShareError;
pub use crate::remote::share::SharedNode;

Structs§

LinkedNodes
The inference nodes among the user’s linked devices.
NetDialer
Opens agent streams over a weirdnet-net node. Node ids are peer ids.
Presented
What a caller presented: a certificate, and its user’s public key when it sent a guest credential (encode_credential). Nothing here is checked yet.

Constants§

INFERENCE_APP
The app name inference nodes announce (Node::serve_app), so the pool can find them among the user’s linked devices. Model nodes do not announce it: apps never call them.

Functions§

channel
A Channel over a stream: length-prefixed messages (crate::remote::codec). A task drives the stream; dropping the channel closes our side, and once both sides are done the stream is dropped. Call from a Tokio runtime.
connect
A Pool over node: inference nodes among the roster’s linked devices, presenting cert (this device’s certificate) with every request.
connect_shared
A Pool over a pool another Weirdnet identity shared with this one (PoolShare): its nodes in the share’s order (failover across them as usual), dialed through node, with this device’s guest credential (user_key, the public key of this device’s user, and cert, this device’s certificate) presented with every catalog/1 and infer/2 request. No roster discovery is done for it. Errors (BadRequest) for an invalid or expired share, or a certificate that is not this node’s or not user_key’s.
decode_cert
decode_presented
Reads presented bytes: a guest credential or a bare certificate (encode_cert).
encode_cert
A certificate as presented with a request (Caller::cert_bytes, PoolOptions::cert).
encode_credential
A guest credential (since 0.5.9): this device’s certificate plus its user’s public key (protobuf), so a node of a different user can check the certificate (a NodeCert names its user only by id). Present it with requests to a shared pool (pool::connect_shared does). Public: it holds no secret.
share_dialer
A NetDialer for a shared pool: the share’s nodes with their addresses as hints. Checks that every peer id and address parses (an address for another peer is refused).
stream_limits
Stream limits for the agent protocols: weirdnet-net defaults (30 s resume window), no idle reset (a queued request can be quiet for a while; Queued keepalives come every 3 s).

Type Aliases§

RosterView
The roster as it is now (the app keeps it current from weirdnet-sync).