symfonic.capabilities.memory.positional_store¶
positional_store ¶
Which stores a CORE-171 positional migration admits, and what each must offer.
A migration is planned and applied through one adapter per persistent
backend. Every adapter opens the backend's own write/forget serialization --
the in-process writer lock, the PostgreSQL lease-acquisition key and tenant
advisory lock plus a memory_nodes lock ahead of the erase-job fence, or
the Mongo tenant guard transaction -- and does all of its reading and re-keying inside it, so a
reviewed plan, its re-check and its re-key see the same rows and commit or
roll back together.
An adapter lists only candidate rows: owners that are neither native v1 keys
nor quarantine keys. Both of those start with symfonic.memory. and never
hold the v0 delimiter; a v0 path whose adopter-chosen kind spells the header
still holds it, so it stays a candidate and is never taken for quarantined.
An adapter refuses (MemoryContractError) rather than plan around state it
cannot move safely: pending rows, live consolidation leases, an erasing subtree,
owner copies that disagree, or more rows than one transaction may hold. A
rollback's rows are no longer candidates, so the session also refuses a named
moved row that a write has since staged (refuse_pending), inside the same
serialization as the re-key. erased reads, in that serialization too,
which native targets a recorded forget already erased, so a recorded forget
either precedes the plan and quarantines the row or follows the re-key and
erases it. refuse_unerasable lets a backend whose forget is bounded refuse
an apply that would leave rows no public forget erases.
PositionalRows ¶
Bases: Protocol
Open a serialized session over one tenant's rows.
apply_refusal names a privacy gate that keeps apply closed on this
backend while planning and quarantine cleanup stay open (every admitted
backend has None today).
restore_refusal names why no rollback is provable on this backend, so
rollback refuses before the session; None where the session decides.
refuse_caller_transaction refuses, before apply or rollback opens a
session, a caller transaction a forget could join between the backend's
proof and its re-key.
write=False promises no row changes, not a read-only transaction: the
Mongo session still bumps its tenant guard counter to serialize.
RowSession ¶
Bases: Protocol
Reads and writes inside one serialized backend transaction.
erased
async
¶
The native targets a forget of that key or an ancestor erased.
Refuses (MemoryContractError) when the backend cannot prove the
answer from its own durable records; no caller input overrides that.
Source code in src/symfonic/capabilities/memory/positional_store.py
refuse_pending
async
¶
Refuse (PENDING_REFUSAL) if any named (kind, id) row is pending.
refuse_unerasable
async
¶
Refuse, before apply re-keys, if no public forget could erase the result.
deleted names the quarantined edges apply deletes after the re-key.
Source code in src/symfonic/capabilities/memory/positional_store.py
refuse_unproven_restore
async
¶
Refuse unless the store proves each present (kind, id, origin, key)
row was quarantined by its own apply and no forget could cover it since.
Source code in src/symfonic/capabilities/memory/positional_store.py
StoredRow
dataclass
¶
StoredRow(kind: str, row_id: str, stored: Any, source: str | None = None, target: str | None = None, record: str | None = None)
One stored row and its raw owner; content is never carried.
kind is node, edge, vector or claim. source and
target are an edge's endpoint ids; record is a claim's record id.
adapter_for ¶
The exact admitted adapter for store, or refuse before any read.
Source code in src/symfonic/capabilities/memory/positional_store.py
is_quarantined_owner ¶
True for a quarantine key; a v0 path spelling its header is not one.
is_settled_owner ¶
True for a native or quarantined owner, which no migration moves.