Skip to content

symfonic.capabilities.memory.transactions

transactions

Opening the one transaction a cycle's batch commits in.

Split from :mod:.commit, which owns the rules about who must share a domain; this owns the mechanics of entering it.

A domain is the object that owns the rollback: a connection pool, or a store that can open its own transaction. Either way it answers to transaction(), so there is one code path and no sentinel to special-case. That matters more than it looks: while the in-process domain was a shared string, two different in-memory backends resolved to the same "domain", this module snapshotted whichever one the journal had touched, and a flush through the other one sat outside the snapshot -- so a failure rolled back half a cycle.

one_transaction

one_transaction(domain: Any)

The single transaction this batch commits in.

domain is the object that owns the rollback -- a connection pool, or a store with a transaction() of its own -- already resolved by the caller (:func:~.commit.domain_of), because what owns a Postgres backend's rollback is its pool rather than the backend.

None means the cycle wrote to nothing that needs committing.

Source code in src/symfonic/capabilities/memory/transactions.py
def __init__(self, domain: Any) -> None:
    self._domain = domain
    self._open: Any = None