.NET API
IWorkflowDefinitionStore
Tracon.Abstractions.dllThe store for workflow definitions stored in the database. Every save produces a new version, old versions are not deleted, and a rollback writes an old version’s content back as a new one.
public interface IWorkflowDefinitionStoreRemarks
Section titled “Remarks”A version number is an identity, not a counter. Deleting a
definition does not delete its history, and saving the same name again continues the
numbering from the highest version ever written. A number therefore always names
the same content: a run that recorded version 3 of narrated can be resumed
with exactly that content, even after the workflow was deleted and created again.
(An agent definition keeps the numbering the same way, but not the history: deleting it
deletes its versions, and the next save continues from the highest number the name had.)
Tenant behavior — EXPLICIT tenant. Every member takes the tenant
as a parameter and never reads ITenantContext: the store is also called from
the workflow execution pipeline, where there is no HTTP context.
Methods
Section titled “Methods”DeleteAsync(string, string, CancellationToken)
Section titled “ DeleteAsync(string, string, CancellationToken)”Deletes the definition.
ValueTask<bool> DeleteAsync(string tenantId, string name, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
name string
The workflow name.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”true if the delete happened.
GetAsync(string, string, CancellationToken)
Section titled “ GetAsync(string, string, CancellationToken)”Fetches the definition with the given name.
ValueTask<WorkflowDefinition?> GetAsync(string tenantId, string name, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
name string
The workflow name.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<WorkflowDefinition?>
The definition; null if it does not exist.
GetVersionAsync(string, string, int, CancellationToken)
Section titled “ GetVersionAsync(string, string, int, CancellationToken)”Fetches one version of a definition.
ValueTask<WorkflowDefinition?> GetVersionAsync(string tenantId, string name, int version, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
name string
The workflow name.
version int
The version number.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<WorkflowDefinition?>
The definition as it was saved at that version, with its Version and
UpdatedAt set; null if that version does not exist.
Remarks
Section titled “Remarks”The history outlives the definition: a version of a workflow that was deleted is still returned. A caller that needs the workflow to exist asks IWorkflowDefinitionStore.GetAsync first.
ListAsync(string, CancellationToken)
Section titled “ ListAsync(string, CancellationToken)”Lists all of a tenant’s definitions, by name.
ValueTask<IReadOnlyList<WorkflowDefinition>> ListAsync(string tenantId, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<WorkflowDefinition>>
The definitions.
ListVersionsAsync(string, string, CancellationToken)
Section titled “ ListVersionsAsync(string, string, CancellationToken)”Lists every version of a definition, from newest to oldest.
ValueTask<IReadOnlyList<WorkflowDefinition>> ListVersionsAsync(string tenantId, string name, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
name string
The workflow name.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<WorkflowDefinition>>
Full snapshots, not deltas; empty when the name was never saved.
RollbackAsync(string, string, int, CancellationToken)
Section titled “ RollbackAsync(string, string, int, CancellationToken)”Makes the given version current. A rollback does not delete or move anything: it saves the version’s content as a new version.
ValueTask<WorkflowDefinition> RollbackAsync(string tenantId, string name, int version, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
name string
The workflow name.
version int
The version number to roll back to.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The definition saved as the new version.
Remarks
Section titled “Remarks”The store does not judge whether the content is still valid: a function the version names may have been unregistered since. The caller validates it the way a save is validated before it calls this. When the workflow was deleted, the rollback creates it again and the numbering continues.
Exceptions
Section titled “Exceptions”That version does not exist.
SaveAsync(string, WorkflowDefinition, CancellationToken)
Section titled “ SaveAsync(string, WorkflowDefinition, CancellationToken)”Saves the definition. The incoming WorkflowDefinition.Version
value is ignored; the store determines the version number.
ValueTask<WorkflowDefinition> SaveAsync(string tenantId, WorkflowDefinition definition, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”tenantId string
The tenant identifier.
definition WorkflowDefinition
The definition to save.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The definition with its version number assigned.