Postgres lease acquisition and renewal for workflow runs.
The lease token is the fencing token used by the Postgres journal. Acquiring
a lease performs the roadmap's UPDATE ... RETURNING CAS: only unowned or
expired running runs can be claimed, and every successful claim receives a
fresh monotonic token from continuum_lease_token_seq.
Summary
Functions
Acquire a lease for a running or suspended run.
Acquire a lease or raise.
Build the owner string used in lease rows.
Renew a lease by owner and token.
Types
Functions
Acquire a lease for a running or suspended run.
Returns {:error, :not_acquired} when another owner still holds the lease.
Acquire a lease or raise.
@spec owner() :: binary()
Build the owner string used in lease rows.
Renew a lease by owner and token.
Returns {:error, :lost} when the row is gone or the owner/token no longer
match, which means another process acquired the fencing token.