Class WorkerRegistry
- Namespace
- Virtufin.WorkManager.Runtime
- Assembly
- Virtufin.WorkManager.dll
Registry for managing worker instances.
public sealed class WorkerRegistry
- Inheritance
-
WorkerRegistry
- Inherited Members
Methods
Add(Worker)
Adds a worker to the registry.
public void Add(Worker worker)
Parameters
workerWorkerThe worker to add.
Exceptions
- InvalidOperationException
Thrown if a worker with the same ID already exists.
Exists(Guid)
Checks if a worker with the given ID exists.
public bool Exists(Guid id)
Parameters
idGuidThe worker's ID.
Returns
- bool
trueif the worker exists; otherwise,false.
Get(Guid)
Gets a worker by ID.
public Worker? Get(Guid id)
Parameters
idGuidThe worker's ID.
Returns
- Worker
The worker, or
nullif not found.
GetAll()
Gets all registered workers.
public IReadOnlyList<Worker> GetAll()
Returns
- IReadOnlyList<Worker>
A read-only list of all workers.
Remove(Guid, out Worker?)
Removes a worker from the registry.
public bool Remove(Guid id, out Worker? worker)
Parameters
idGuidThe ID of the worker to remove.
workerWorkerWhen the method returns, contains the removed worker if found; otherwise,
null.
Returns
- bool
trueif the worker was removed; otherwise,false.