Interface ISingletonWork
- Namespace
- Stratara.Abstractions.Singleton
- Assembly
- Stratara.Abstractions.dll
A unit of work that runs once per cluster, on a period: an outbox drain, a flush, a recovery sweep. The host registers an implementation and the execution model runs it in one place in the cluster, identified by Name, while the cluster agrees on its membership, and no lock is needed to make that so; two runs on one silo never overlap. A silo the cluster has declared dead may still be running the work until it learns of the declaration, while another silo has already taken it over, so a run should tolerate an overlapping run elsewhere — claim what it processes with a compare-and-set, or be idempotent.
public interface ISingletonWork
- Extension Methods
Properties
Name
The name that identifies the work across the cluster.
string Name { get; }
Property Value
Period
How often the work runs. A run that takes longer than the period delays the next one; it is never doubled.
TimeSpan Period { get; }
Property Value
Methods
RunAsync(CancellationToken)
Runs the work once. Resolved from a fresh scope for every run, so it may take scoped dependencies.
Task RunAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancelled when the host running the work shuts down.
Returns
- Task
A task that completes when the run has ended.