A PostgreSQL adapter with transactions. Each call that reads or writes an owner's state runs in a
transaction of its own on it. On a transaction view (the adapter a transaction callback receives, whose own
transaction runs a callback in that same transaction) each call runs inside the caller's transaction
instead: it holds the owner's row, and after writing a deletion record the shared journal row, until the
caller commits or rolls back, and the caller's rollback undoes it.
Table prefix, clock and the host's bindings.
derivations_require_postgres_transactions for another kind of adapter or one without
transactions, and invalid_derivation_table_prefix for a malformed prefix.
Fresh authorization must also reject deleting/deleted host accounts.
Runs authorize under the owner lock; when it answers true, an inactive owner becomes active with a new
epoch.
True when authorize answered true, the owner then being active; false when it answered false,
which changes nothing.
Commit an inactive fence before disconnect, exclusion, grant-loss or deletion purge.
Marks the owner inactive with a new epoch, runs mutate in the same transaction and records an owner-wide
deletion. Nothing of the owner's is committed or delivered again until activateOwner succeeds.
Captures a ticket at the owner's current epoch, before work outside the store begins.
The ticket, or null while the owner is not active.
Execute short trusted storage work after the epoch check. This is not a content-delivery API. Source replacement uses invalidate with expected ticket.
applied with the work's value, or stale, without entering work, when the owner is inactive or
its epoch has moved past the ticket's.
Persist one whole result only if every input remains current and permitted.
The ticket must be current, context and derivation must name the ticket's tenant and owner, the record must
be personal with the earliest expiry of its dependencies, and canDeliverSourceDerivation must allow it for
context against the state readCurrent reads in this transaction. The payload is at most 1,048,576
UTF-16 code units long, and an id the owner already holds is not replaced.
Whether the result was stored.
Enqueue immediately under the lock; do not retain the argument or return a Promise.
Reads the stored result and the current state of its sources under the owner lock and, when the owner is
active and canDeliverSourceDerivation allows context, passes the payload to enqueue before the lock is
released. The payload is never returned.
What enqueue answered, or false when delivery is refused.
source_delivery_must_be_synchronous when enqueue answers anything but a boolean.
Advance the fence, purge affected sources and all whole dependent results, and mutate host state in one transaction. A supplied expected ticket is a CAS.
With expected, an inactive owner or an epoch past the ticket's answers stale without purging or entering
mutate. Without it, the invalidation always applies, also to an inactive owner, which stays inactive.
disableOwner leaves the owner inactive and needs an owner-wide invalidation. A thrown binding or mutate
rolls back the epoch, the purge and the deletion record together.
Optional Readonly expected?: SourceFenceTicketOptional Readonly disableinvalid_source_invalidation for a malformed affected, and
owner_disable_requires_owner_scope for disableOwner with a connection or source.
Expiry is enforced at read regardless; this removes stored and host-bound copies.
At most this many results go in one call, earliest expiry first: an integer from 1 to 1,000.
How many results were removed.
invalid_derivation_batch for another limit.
Operator recovery export only; never expose this across account sessions.
Answers the records after this sequence, in sequence order: 0 for the first page, then the last sequence of the page before.
Page size, an integer from 1 to 1,000.
invalid_tombstone_page for a negative or fractional sequence or another limit.
Restore is conservative: any affected owner is disabled and all of that owner's private sources/results are purged. Fresh authorized reconnect is required.
Replaying the same records again is harmless: each deletion record is kept once, by its id, and the owner stays inactive. Run it on a restored database before any read or job resumes, with every record newer than the backup.
invalid_source_tombstone, invalid_source_owner or invalid_source_invalidation for a
malformed record, before that record is applied.
Durable private provenance on PostgreSQL. All source writers use this owner fence; model/provider work stays outside it. No method logs SQL, content or exceptions.
Every method that reads or writes an owner's results runs in one transaction that first locks that owner's fence row, so commits, deliveries, invalidations and expiry for one owner are serialized, while different owners proceed independently. Writing a deletion record also locks one shared journal row, last, so the records' sequence follows commit order.
Example