Skip to content
Tracon

IWorkflowDefinitionStore

Namespace Tracon · Assembly Tracon.Abstractions.dll

The 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 IWorkflowDefinitionStore

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.

DeleteAsync(string, string, CancellationToken)

Section titled “ DeleteAsync(string, string, CancellationToken)”

Deletes the definition.

ValueTask<bool> DeleteAsync(string tenantId, string name, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

name string

The workflow name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<bool>

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)

tenantId string

The tenant identifier.

name string

The workflow name.

cancellationToken CancellationToken

The cancellation token.

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)

tenantId string

The tenant identifier.

name string

The workflow name.

version int

The version number.

cancellationToken CancellationToken

The cancellation token.

ValueTask<WorkflowDefinition?>

The definition as it was saved at that version, with its Version and UpdatedAt set; null if that version does not exist.

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.

Lists all of a tenant’s definitions, by name.

ValueTask<IReadOnlyList<WorkflowDefinition>> ListAsync(string tenantId, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

cancellationToken CancellationToken

The cancellation token.

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)

tenantId string

The tenant identifier.

name string

The workflow name.

cancellationToken CancellationToken

The cancellation token.

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)

tenantId string

The tenant identifier.

name string

The workflow name.

version int

The version number to roll back to.

cancellationToken CancellationToken

The cancellation token.

ValueTask<WorkflowDefinition>

The definition saved as the new version.

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.

TraconException

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)

tenantId string

The tenant identifier.

definition WorkflowDefinition

The definition to save.

cancellationToken CancellationToken

The cancellation token.

ValueTask<WorkflowDefinition>

The definition with its version number assigned.