Skip to main content

Module lease

Module lease 

Source
Expand description

Where the leases of delegated tasks are kept (ADR 0020).

A lease is granted on the replica that runs the task and renewed by a GetTask that may land on any replica, so its deadline lives where every replica can see it. InMemoryLeaseStore serves one process; PostgresLeaseStore (the postgres feature) serves replicas sharing a database.

Structs§

InMemoryLeaseStore
Leases kept in memory, shared by every handler holding a clone.
PostgresLeaseStore
Leases in a PostgreSQL table, a2a_leases, created if absent.

Traits§

LeaseStore
Where leases are kept: a time to live and a deadline per task, keyed by tenant ("" without one) and task id.

Functions§

deadline_lapsed
Whether a lease ending at deadline_ms has lapsed at now_ms: it holds through its deadline’s millisecond, so a renewal that lands on it is not too late.
now_unix_ms
Milliseconds since the Unix epoch, now.

Type Aliases§

LapsedLeases
What LeaseStore::lapsed_many answers: whether each lease that exists has lapsed, by (tenant, task).