ProcessLeaseRegistry class final

Durable, advisory registry of ProcessLease records under directory (<project>/.oka_cache/processes/).

All registry errors on the write path are the caller's to surface — spawn steps treat lease failures as advisory (a failed lease write must never fail a build that otherwise succeeded).

Usage:

final registry = ProcessLeaseRegistry.forProject(projectPath);
await registry.upsert(lease);                 // atomic write-then-rename
final live = await registry.list();           // all valid records, sorted
final verdict = await registry.checkLiveness(lease);
if (verdict == LeaseLiveness.live) { /* safe to consider stopping */ }
await registry.delete(lease.id);              // remove the record

Constructors

ProcessLeaseRegistry(Directory directory, {ProcessLiveness? liveness})
Creates a registry over directory (created lazily on first write). liveness defaults to HostProcessLiveness; tests inject fakes.
ProcessLeaseRegistry.forProject(String projectPath, {ProcessLiveness? liveness})
Registry rooted at the standard project location: <projectPath>/.oka_cache/processes/.
factory

Properties

directory → Directory
The lease directory (<project>/.oka_cache/processes).
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkLiveness(ProcessLease lease) → Future<LeaseLiveness>
Liveness + identity reconciliation of one lease against the host (ADR-0018 §1/§5, the crash-recovery primitive):
delete(String id) → Future<bool>
Deletes the lease with id. Returns whether a record existed.
inspect() → Future<ProcessLeaseRegistrySnapshot>
Reads every lease without writing or printing. Valid leases and parse failures are both retained in the returned snapshot.
list() → Future<List<ProcessLease>>
All valid lease records, sorted by id. Corrupt records are skipped; inspect exposes those records as structured issues.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String id) → Future<ProcessLease?>
Reads the lease with id, or null when absent.
toString() → String
A string representation of this object.
inherited
upsert(ProcessLease lease) → Future<void>
Writes (or replaces) lease atomically: write a unique temp file, flush, rename over the target.

Operators

operator ==(Object other) → bool
The equality operator.
inherited