RegistryInterface
in
Registry interface
A keyed store of WorkerRecords. Each worker writes only its own record, so implementations need no locking, lease or atomic-claim protocol - this is deliberately a much simpler contract than AdapterInterface.
Tags
Table of Contents
Methods
- all() : array<string|int, mixed>
- Fetch every stored record, keyed by worker ID
- delete() : void
- Remove a record. A no-op if the ID isn't there.
- prune() : int
- Remove every record whose heartbeat is older than the given number of seconds, returning how many were removed
- read() : WorkerRecord|null
- Fetch a record by ID, or null if it isn't there
- write() : void
- Store a record, replacing any existing record with the same ID
Methods
all()
Fetch every stored record, keyed by worker ID
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed>delete()
Remove a record. A no-op if the ID isn't there.
public
delete(string $id) : void
Parameters
- $id : string
prune()
Remove every record whose heartbeat is older than the given number of seconds, returning how many were removed
public
prune(int $olderThanSeconds) : int
Parameters
- $olderThanSeconds : int
Return values
intread()
Fetch a record by ID, or null if it isn't there
public
read(string $id) : WorkerRecord|null
Parameters
- $id : string
Return values
WorkerRecord|nullwrite()
Store a record, replacing any existing record with the same ID
public
write(WorkerRecord $record) : void
Parameters
- $record : WorkerRecord