Skip to main content

Module lease

Module lease 

Source
Expand description

Runtime lease supervision for multi-instance services.

A runtime lease protects process-level singleton groups such as schedulers, cleanup loops, outbox dispatchers, and other background producers that must run on only one service instance at a time. It is intentionally separate from task-row processing leases: task leases protect one persisted work item, while runtime leases decide which process is allowed to start a whole worker group.

The storage backend is abstracted by RuntimeLeaseStore. Database-backed services can use the store provided by aster_forge_db; tests and other deployments can provide their own implementation. The supervisor remains conservative: if renewal fails or ownership is lost, it cancels the leased workload before trying to acquire the lease again.

Structs§

RuntimeLeaseClaim
Acquisition request passed to a runtime lease store.
RuntimeLeaseConfig
Runtime lease settings for one singleton worker group.
RuntimeLeaseOwner
Current owner observed when a lease is held by another process.

Enums§

RuntimeLeaseAcquire
Result of one acquisition attempt.

Constants§

DEFAULT_RUNTIME_LEASE_RETRY_INTERVAL
Minimum retry interval used when a caller provides a zero duration.
DEFAULT_RUNTIME_LEASE_TTL
Minimum lease TTL used when a caller provides a zero duration.

Traits§

RuntimeLeaseStore
Store contract used by runtime lease supervisors.

Functions§

new_runtime_lease_owner_id
Generates a process-unique runtime lease owner ID.
run_runtime_lease_supervisor
Runs one singleton worker group behind a runtime lease.