refactor: share tbank-sync claim and generation lock (WealthLedger/backend#166) #187

Closed
codex-bot wants to merge 3 commits from refactor/166-tbank-sync-claim-protocol-v2 into develop
Showing only changes of commit a2b5306a4c - Show all commits
+1 -5
View File
@@ -3,17 +3,13 @@ import type { TbankSyncAttempt } from './tbank-access.service';
const NO_UPDATED_ROWS = 0; const NO_UPDATED_ROWS = 0;
// Shared owners for the tbank-sync DB claim/lock protocol (backend#166). // Shared owners for the tbank-sync DB claim/lock protocol.
// Both helpers are CAS fences: they run inside the caller's transaction and // Both helpers are CAS fences: they run inside the caller's transaction and
// keep the exact where/data shapes they replaced. Callers keep deciding // keep the exact where/data shapes they replaced. Callers keep deciding
// success from the claim count exactly as before. // success from the claim count exactly as before.
// Claims the active TbankSyncWork row: only the still-running attempt of a // Claims the active TbankSyncWork row: only the still-running attempt of a
// valid connection may transition. `data` is the state transition to apply. // valid connection may transition. `data` is the state transition to apply.
// `state` overrides the default 'running' fence (e.g. an initiator row also
// accepts 'complete'); `withoutConnectionFence` drops the
// `connection: { invalidToken: false }` guard for fences that must also fire
// on an invalidated connection.
export type ClaimOptions = { export type ClaimOptions = {
// Overrides the default 'running' fence (e.g. an initiator row also // Overrides the default 'running' fence (e.g. an initiator row also
// accepts 'complete'). // accepts 'complete').