Expand description
BIDIR-8 (BIDIR-5’s rule): the gate over a duplex call — open, admit, re-verify on the gate’s grants generation, answer, audit. BIDIR-8 (BIDIR-5’s rule, made a library) — the gate over a duplex call.
A duplex call is params, then an input half and an output half
(BIDIR-1). DuplexGate::open decides it as the grant gate decides any
call — once, the method’s grant on its target, within the ceiling — and
takes the call’s place on its connection (CallCounter: in a server,
plexus-transport’s ConnectionCalls, one per connection, a duplex call
counted as one call). The DuplexCall it answers holds the caller and
admits each input frame without asking the gate:
| when | the gate does | refusal (error_kind) | ends the call? |
|---|---|---|---|
| open | Gate::check once | forbidden {grant, scope, roles, held_on} / unauthenticated | never opens |
| open, past the connection’s calls | count it as any call | too_many_calls {max} | never opens |
| an input frame from another connection | compare connection ids | not_this_call (to the sender) | no |
| an input frame past credit | compare seq with the credit granted | past_credit {seq, credit} | yes |
| an input frame past a ceiling its method opted into, or past what one call may hold | count items and bytes | too_much_input {limit, max} | yes |
| an input frame out of sequence | the transport compares seq with the next expected | out_of_sequence {seq, expected} | yes |
| the gate’s grants generation moves (grant, revoke, role edit, team, sign-out) | Gate::check once per call | forbidden / unauthenticated | yes, items after it dropped |
| the sign-in’s expiry | the call’s own timer: the caller proves no one | unauthenticated | yes |
| a question answered | Answerer: own connection; a person; or a grant on the target (Gate::check once per answer) | not_this_call / person_required / forbidden | no |
A frame’s admission is: the half is open, the frame is the call’s own
connection’s, the gate’s generation is the one last verified (one atomic
load), the frame is within credit and the ceiling. So a revoke reaches
every open call at the generation’s move — DuplexCall::input selects
on it, so a quiet call ends then too — and no item ever costs a gate
check. The generation is the gate’s own (Gate::generation,
plexus-auth-core): every service that keeps a gate keeps one, and moves
it with Gate::moved wherever it writes a grant.
Every typed refusal is one audit record
(AuditRecordKind::DuplexRefused),
built only when it happens and offered to a bounded AuditQueue that
never waits (DuplexGate::with_audit): an admitted frame allocates
nothing.
BIDIR-6’s call slot (super::input), keyed by (connection, subscription), feeds DuplexCall::input one InputFrame for each
{ns}.input {subscription, seq, items}. seq counts frames; credit counts
items, so a frame carries how many it holds.
Structs§
- Call
Ceiling - The gate’s terms for a duplex call (plexus-auth-core), re-exported so a caller of this module needs no second import. 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.
- Call
Place - A call’s place on its connection, held for as long as the call is open and given back when dropped — whatever the counter keeps behind it.
- CallRef
- The gate’s terms for a duplex call (plexus-auth-core), re-exported so a caller of this module needs no second import. 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).
- ConnId
- A connection, as the transport numbers it.
- Credit
Line - The credit a call has granted, shared with whoever grants it: the
transport’s pipe grants as the handler consumes, on a call that
DuplexCall::inputhas taken. - Duplex
Call - One open duplex call, holding its caller (the module docs).
- Duplex
Gate - The gate over duplex calls: a
Gate(and its grants generation, which says when to ask it again), the audit, and the clock expiry is read by. - Grants
Generation - BIDIR-8 (BIDIR-5’s finding): the grants generation — a count every
write that could change one of the gate’s answers moves
(
GrantsMove). It is the gate’s: whoever holds an answer across time (a duplex call’s caller, a watch) records the generation it was decided at and asks the gate again only when it has moved — once per move, never per item. Cheap to clone (twoArcs, one count); a read is one atomic load; a move wakes everysubscriber. - Input
Frame - One input frame as the transport hands it over: which connection sent
it, its
seq, what it holds, how many items that is, and their size on the wire.
Enums§
- Answerer
- The gate’s terms for a duplex call (plexus-auth-core), re-exported so a
caller of this module needs no second import.
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-1answerer). - Duplex
Refusal - Why the gate refused a duplex call, a frame or an answer — each typed on
the wire as an error item with its
error_kind. - Duplex
Refusal Code - The gate’s terms for a duplex call (plexus-auth-core), re-exported so a
caller of this module needs no second import.
BIDIR-8: every typed refusal the gate makes over a duplex call — its
error_kindon the wire, and thereasonof its audit record (AuditRecordKind::DuplexRefused). - Grants
Move - BIDIR-8: what moved the grants generation (
Gate::moved) — every write that could change an answer the gate gave. - Overrun
- What the transport found wrong with a frame when it arrived. It holds
nothing past the first one, so the frame says so and goes through the
same admission as any other, whenever that comes:
DuplexCall::admitrefuses it, whatever the credit has become since.
Traits§
- Call
Counter - The calls open on one connection, as whoever counts them keeps them —
plexus-transport’s
ConnectionCallsin a server (BIDIR-8: the count is the transport’s, so no service writes it). A duplex call is one call.
Type Aliases§
- Clock
- The wall clock, in unix seconds: when a sign-in expires.