Skip to main content

Module duplex

Module duplex 

Source
Expand description

BIDIR-5 / BIDIR-8: the gate’s rules for a duplex call — who sends, who answers, how much, and what crosses a hop. BIDIR-5 / BIDIR-8 — the gate’s rules for a duplex call, in this crate’s terms.

A duplex call is params, then an input half and an output half (BIDIR-1). The gate decides it at open exactly as it decides any call (Gate::check: the method’s grant on its target, within the ceiling). What this module adds is what a duplex call needs beyond that, each as data a method or a service declares — no rule is written in an application:

whenthe gate doesin these terms
the call opensGate::check, once; the call holds the caller and the Reacha grant
an input frame arrivesno gate check: the frame’s connection is the call’s, the half is open, the grants generation is the one last verified, the frame is within credit and the CallCeilingInputBy::Caller, CallCeiling
the grants generation moves, a sign-out, the expirythe caller verified again, once per call; a refusal closes the input half with forbidden / unauthenticateda grant
a question is answeredAnswerer: the caller’s own connection; a person; or whoever holds a grant on the call’s targetAnswerer
a call goes into a client or a service that dialed inthat peer’s own gate, deciding for the principal on that connection — the other side of the call is a caller like any othera grant on the peer
a call crosses a hophop_identity: the hop is the principal, the caller is named for and grants nothing, the hop’s verdict is a ceiling layer; the far side decides againa ceiling

Structs§

CallCeiling
What one call may take in (BIDIR-1: “every item that flows has a limit”). Beside the transport’s per-connection call count, which counts a duplex call as one call.
CallRef
BIDIR-8: which call a refusal was about — the connection it runs on and its subscription there (the slot BIDIR-6 keys a duplex call by).

Enums§

Answerer
Who may answer a question a method asks mid-call — an output item that expects a reply (BIDIR-1 mechanism). The method declares it (#[method(answer_by = "…")], BIDIR-1 answerer).
DuplexRefusalCode
BIDIR-8: every typed refusal the gate makes over a duplex call — its error_kind on the wire, and the reason of its audit record (AuditRecordKind::DuplexRefused).
InputBy
Who may send a call’s input items. Only the caller, on the call’s own connection: an input item carries no target of its own, so there is nothing another principal could be checked against. (A wider sender is a second call, gated as one.)

Constants§

ANSWER_BY_SPELLINGS
BIDIR-8: the spellings #[method(answer_by = "…")] takes, for a refusal to name (the macro’s compile error says the same three).
DEFAULT_INPUT_WINDOW
The credit a method grants unless it says otherwise (#[method(input_window = N)], BIDIR-6).
DEFAULT_MAX_BUFFERED
The bytes one call may hold buffered unless it says otherwise (#[method(input_max_buffered = N)], BIDIR-6).
FOR_KEY
The metadata key naming whom a hop acts for (IDENTITY-2’s for; RFC 8693’s actor chain, read the other way): a list, nearest caller first. It is attribution only — it grants nothing.

Functions§

hop_identity
BIDIR-1 forward = identity: the context a call carries across a hop.
is_person
A person, as the identity’s issuer vouches: a sign-in through plexus-idp or an OIDC provider. A key, an API key or a nostr key is not (a nostr key may be a person’s, but nothing vouches it — AUTH-35 grades that).