Expand description
NEST-7: the primitive — an activation returns an activation. NEST-7 — the primitive: an activation returns an activation.
A peer is an activation found by name, in this process or across the
network; the caller cannot tell which. An activation returns one from a
#[plexus_macros::peer] method:
ⓘ
#[plexus_macros::peer(list = "integrations")]
async fn integration(&self, name: &str) -> Result<Box<dyn forge::ForgePeer>, PeerError>; // typed
#[plexus_macros::peer(list = "dendrites", search = "find")]
async fn dendrite(&self, name: &str) -> Result<Box<dyn Peer>, PeerError>; // untypedPeeris the erased activation (dyn Activationcannot be written:Activationhas an associated type). EveryActivation + ChildRouteris one (the blanket impl below),RemoteChildincluded.Interfaceis a peer’s shape, named and content-addressed: the IR of what it serves, its hash, and each method’s own hash; two peers with one hash serve one shape, andInterface::satisfiesis the shape check.PeerErroris why a peer could not be returned, typed on the wire as an error item whoseerror_kindis the variant (not_grafted,shape_mismatch, …), never “method not found”.- A contract (a bodiless activation every method of which answers
Result<T, E>) is a typed slot’s interface: the macro emitstrait ForgePeer: Forge + Peer, itsContract(the interface and theStampits client was generated from), andForgePeerfor the client over aPeerTransport, which checks the backend’s interface against the stamp — equal, go; it stillsatisfiesthe stamp, saydriftonce and go; elsePeerError::ShapeMismatch— and again whenever an item’splexus_hashmoves.
Structs§
- Drift
- The backend’s interface moved but still serves every method the stamp has: said once.
- Interface
- A peer’s shape, named and content-addressed: what
<ns>.iranswers for it, its hash, and each method’s own hash. Two interfaces with one hash serve one shape (descriptions, grants and the name aside). - Peer
Router - A peer as a child router: what a
#[peer]slot hands routing. Calls go to the peer’scall; its own peers are its children. - Peer
Slot - A
#[peer]slot as routing holds it: reached as<parent>.<slot>, its children are the peers the slot’s function returns by name — a typed slot’s checked against its interface first (ShapeMismatchby interface hash).<parent>.<slot>.<name>.<method>is a peer’s method. - Peer
Transport - A transport for a contract’s client that checks the backend against the
client’s
Stamp: the backend’s interface is asked once (and again when an item’splexus_hashmoves); every item is watched for that. - Router
Peer - A child router (what routing holds) as a peer.
- Stamp
- What a generated client was built against: the interface’s name, the backend crate’s version, the interface hash and each method’s hash.
Enums§
- Peer
Error - Why a peer could not be returned — each failure typed, on the wire as an
error item whose
error_kindis the variant’s snake_case name, its fields beside it.
Traits§
- Contract
- A contract’s shape, as a typed slot names it: implemented by the macro for
dyn ForgePeer(a contract’s peer trait). - Peer
- What a peer is: an activation, erased —
dyn Activationcannot be written (the associatedMethodstype), so this is the object-safe form. EveryActivation + ChildRouteris one.