Table of Contents

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

worker Worker

The 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

id Guid

The worker's ID.

Returns

bool

true if the worker exists; otherwise, false.

Get(Guid)

Gets a worker by ID.

public Worker? Get(Guid id)

Parameters

id Guid

The worker's ID.

Returns

Worker

The worker, or null if 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

id Guid

The ID of the worker to remove.

worker Worker

When the method returns, contains the removed worker if found; otherwise, null.

Returns

bool

true if the worker was removed; otherwise, false.