session
session
¶
Per-dispatch sessions (BE2): admitted -> active -> draining -> closed | revoked.
Classes¶
MemoryCaps
dataclass
¶
MemoryCaps(recall_cap_bytes=32768, dispatch_recall_quota_bytes=None, provenance='optional', per_call_budget_seconds=10.0, lock_timeout_seconds=10.0)
Per-session caps (spec Interfaces 1 MemoryCaps).
SessionTable
¶
Thread-safe table of sessions; legal transitions only.
Source code in src/marianne/memory/gateway/session.py
Methods:¶
admit_call
¶
Gate one call by owner flag, state, deadline and permission; the first success activates.
permission is the permission the tool needs. Every refusal leaves
call_count and the state untouched, except that an expired session
is moved to closed so it can never be used again.
Source code in src/marianne/memory/gateway/session.py
reserve_recall
¶
Atomically reserve min(cap, quota - used - reserved) bytes; 0 means none left.
With no dispatch quota nothing is reserved and cap is returned unchanged.
Source code in src/marianne/memory/gateway/session.py
settle_recall
¶
Return the whole reservation and account the bytes actually returned.
Source code in src/marianne/memory/gateway/session.py
close_if_live
¶
Close under the lock; True only for the one caller that made the transition.
Source code in src/marianne/memory/gateway/session.py
forget
¶
Drop a terminal session from the table, keeping a bounded tombstone of its id.
Source code in src/marianne/memory/gateway/session.py
revoke_for
¶
Revoke every live session of principal; returns their ids.