Class FlowRegistry
- Namespace
- FlowOrchestrator.Core.Abstractions
- Assembly
- FlowOrchestrator.Core.dll
Immutable, process-wide registry of the code-defined IFlowDefinition instances
registered through AddFlow<TFlow>(). Built once at container resolution and read on
every step execution, retry, signal delivery and cron fire.
public sealed class FlowRegistry
- Inheritance
-
FlowRegistry
- Inherited Members
Remarks
Replaces the 1.x IFlowRepository interface and its three identical per-backend copies.
Lookups by id are O(1) against a FrozenDictionary<TKey, TValue>; the old
interface forced every hot-path caller to fetch the whole list and scan it linearly.
Registering the same flow type twice (e.g. calling AddFlow<TFlow>() twice) is harmless:
the first registration is kept. Two different flow types that share an
Id are a configuration error — runs, schedules and step jobs are keyed by
that id, so one flow would silently shadow the other — and fail at container resolution.
Constructors
FlowRegistry(IEnumerable<IFlowDefinition>)
Builds the registry from the registered flow definitions.
public FlowRegistry(IEnumerable<IFlowDefinition> flows)
Parameters
flowsIEnumerable<IFlowDefinition>The flows to index, in registration order. A repeated registration of the same flow type keeps the first occurrence.
Exceptions
- ArgumentNullException
flowsis null.- InvalidOperationException
Two different flow types share an id.
Properties
Empty
A registry with no flows; useful for hosts and tests that register none.
public static FlowRegistry Empty { get; }
Property Value
Flows
Every registered flow, in registration order, one entry per distinct id.
public IReadOnlyList<IFlowDefinition> Flows { get; }
Property Value
Methods
Find(Guid)
Returns the flow registered under flowId, or null
when no such flow is registered.
public IFlowDefinition? Find(Guid flowId)
Parameters
flowIdGuidThe flow's stable identifier.
Returns
TryGetFlow(Guid, out IFlowDefinition?)
Looks up the flow registered under flowId in O(1).
public bool TryGetFlow(Guid flowId, out IFlowDefinition? flow)
Parameters
flowIdGuidThe flow's stable identifier.
flowIFlowDefinitionThe registered definition when found; otherwise null.