Expand description
Opaque rendezvous tokens for actor reference exchange.
A token is a capability to contact a rendezvous actor. The creator can hand the token out through any external mechanism; holders can join and exchange typed actor references with the creator.
The protocol has three roles:
- The creator calls
createwith its own typed ref, a privatePortRef<Joined<J>>that receives join notifications, andOptions.createspawns a supervised child rendezvous actor and returns a serializableToken<C, J>that points at that child. - The token holder calls
Token::joinwith its typed ref and a privatePortRef<JoinResult<C>>. The call only sends a join request; the outcome is delivered asynchronously on that result port. - The rendezvous actor delivers
Joined<J>to the creator andJoinResult<C>to the joiner. WithPolicy::Multi, every join is accepted while the rendezvous actor is alive. WithPolicy::Once, the first join is accepted, and later joins receiveJoinResult::Rejected.
Tokens serialize as a single base64-encoded compact JSON string. The JSON
payload includes the rendezvous actor ref and the type URIs for C, J,
and RendezvousLike<C, J>, so deserialization rejects tokens used with
incompatible peer types. std::fmt::Display prints the canonical token,
followed by #, followed by the compact JSON payload for inspection.
FromStr accepts either the canonical token or this display form; the
suffix after # is informational and ignored.
Structs§
- Join
- Request sent to a rendezvous actor by a token holder.
- Joined
- Notification delivered to the token creator when a peer joins.
- Options
- Token join options.
- Rendezvous
Like - The generated behavior struct.
- Token
- Opaque rendezvous token.
Enums§
- Join
Result - Result delivered to a joiner after it attempts to join.
- Policy
- Token join policy.
Traits§
- Join
Client - The custom client trait for this message type.
- Join
Handler - The custom handler trait for this message type.
- Token
Peer - Type that can be exchanged through a rendezvous token.
Functions§
- create
- Create a rendezvous token owned by
this.