Index
gateway
¶
The in-process memory gateway: sessions, grants, the six-tool surface, the audit log.
A library a conductor can host; it holds no socket and no daemon. It reaches
backends only through the memory-backend/1.1 protocol.
Classes¶
AuditLog
¶
Writer for per-session chained segments.
Source code in src/marianne/memory/gateway/audit.py
Methods:¶
append
¶
Append one record (fsynced) and return it. seal stamps segment_hash.
Source code in src/marianne/memory/gateway/audit.py
Gateway
¶
A library a conductor can host. Holds no socket; reaches backends only via the Protocol.
Source code in src/marianne/memory/gateway/gateway.py
Methods:¶
open_session
¶
open_session(*, principal, attachment_id, scope, dispatch_id, deadline_at, permissions=(), job_id=None, caps=None, access=None, ended=None)
Admit a session. A grant: reference fixes the permission ceiling (BE3.3/3.4).
Source code in src/marianne/memory/gateway/gateway.py
close_session
¶
Close a session once. A second close (or a close of a forgotten id) is a no-op.
The live-to-closed transition and the was_live read happen in one locked
section, so exactly one caller writes the sealed audit row. Returns None when
the session was already forgotten.
Source code in src/marianne/memory/gateway/gateway.py
audit_endpoint_event
¶
Record an endpoint-level event (refused attempt, cancellation) for a session.
Source code in src/marianne/memory/gateway/gateway.py
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.
Source code in src/marianne/memory/gateway/session.py
Functions:¶
verify_audit_file
¶
Recompute the chain; report the first line that is removed-after, edited or reordered.