RunCancellationRegistry
AgentPrism.Core.dllAn in-memory implementation of IRunCancellationRegistry.
public sealed class RunCancellationRegistry : IRunCancellationRegistryInheritance
Section titled “Inheritance”object ← RunCancellationRegistry
Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
Section titled “Constructors”RunCancellationRegistry()
Section titled “ RunCancellationRegistry()”public RunCancellationRegistry()Properties
Section titled “Properties”ActiveCount
Section titled “ ActiveCount”The number of runs in progress on this instance. For diagnostics and tests.
public int ActiveCount { get; }Property Value
Section titled “Property Value”ActiveRunIds
Section titled “ ActiveRunIds”The identifiers of the runs currently in progress on this instance.
public IReadOnlyCollection<Guid> ActiveRunIds { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”RunHeartbeatWriter uses this list to write heartbeats only for runs
THIS process is actually executing. Another instance marking a Running row as
“alive” by mistake would defeat the entire purpose of reconciliation.
Methods
Section titled “Methods”Register(Guid, Guid, string?, CancellationTokenSource)
Section titled “ Register(Guid, Guid, string?, CancellationTokenSource)”Writes a running run into the registry.
public IDisposable Register(Guid runId, Guid rootRunId, string? tenantId, CancellationTokenSource source)Parameters
Section titled “Parameters”runId Guid
The run’s identifier.
rootRunId Guid
The identifier of the run at the root of the tree. Equals
runId
for the root.
tenantId string?
The run’s tenant.
source CancellationTokenSource
The source that triggers the run’s cancellation. Ownership stays with the caller; this method does not dispose it.
Returns
Section titled “Returns”The object to dispose to remove the record from the registry.
TryCancel(Guid, string?)
Section titled “ TryCancel(Guid, string?)”Requests a run’s cancellation. If it is the tree root, child runs are also cancelled.
public bool TryCancel(Guid runId, string? tenantId)Parameters
Section titled “Parameters”runId Guid
The identifier of the run whose cancellation is requested.
tenantId string?
The requesting tenant. If it does not match the record’s tenant, the request is ignored.
Returns
Section titled “Returns”true if the cancellation request reached a record.