InMemoryWorkflowStore class
Simple in-memory WorkflowStore used for tests and examples.
Not safe for production as state is lost on process exit.
- Implemented types
Constructors
- InMemoryWorkflowStore({WorkflowClock clock = const SystemWorkflowClock()})
-
Creates an in-memory workflow store using the provided
clock.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancel(
String runId, {String? reason}) → Future< void> -
Cancels a run and records an optional cancellation
reason.override -
claimRun(
String runId, {required String ownerId, Duration leaseDuration = const Duration(seconds: 30)}) → Future< bool> -
Attempts to claim a run for execution with a lease.
override
-
createRun(
{required String workflow, required Map< String, Object?> params, String? runId, String? parentRunId, Duration? ttl, WorkflowCancellationPolicy? cancellationPolicy}) → Future<String> -
Creates a new workflow run and returns its generated id.
override
-
dueRuns(
DateTime now, {int limit = 256}) → Future< List< String> > -
Returns run ids that are due to execute at
now.override -
get(
String runId) → Future< RunState?> -
Returns the run state with an updated step cursor, if present.
override
-
listRunnableRuns(
{DateTime? now, int limit = 50, int offset = 0}) → Future< List< String> > -
Lists runnable runs, excluding those already leased.
override
-
listRuns(
{String? workflow, WorkflowStatus? status, int limit = 50, int offset = 0}) → Future< List< RunState> > -
Lists workflow runs ordered by creation time.
override
-
listSteps(
String runId) → Future< List< WorkflowStepEntry> > -
Lists stored step entries for a run.
override
-
listWatchers(
String topic, {int limit = 256}) → Future< List< WorkflowWatcher> > -
Lists outstanding watchers for
topic(primarily for operator tooling). The metadata helps CLIs and dashboards explain why a run is waiting.override -
markCompleted(
String runId, Object? result) → Future< void> -
Marks a run as completed and stores the final result.
override
-
markFailed(
String runId, Object error, StackTrace stack, {bool terminal = false}) → Future< void> -
Marks the run as failed and records
errorandstack.override -
markResumed(
String runId, {Map< String, Object?> ? data}) → Future<void> -
Marks a run as resumed, optionally merging resume data.
override
-
markRunning(
String runId, {String? stepName}) → Future< void> -
Marks a run as actively executing at
stepName.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readStep<
T> (String runId, String stepName) → Future< T?> -
Reads a stored step value for the given run.
override
-
registerWatcher(
String runId, String stepName, String topic, {DateTime? deadline, Map< String, Object?> ? data}) → Future<void> -
Registers a durable watcher for
topicso the runtime can resumestepNamewhen an event is emitted.override -
releaseRun(
String runId, {required String ownerId}) → Future< void> -
Releases the workflow run lease if the owner matches.
override
-
renewRunLease(
String runId, {required String ownerId, Duration leaseDuration = const Duration(seconds: 30)}) → Future< bool> -
Renews the lease for
runIdwhen owned byownerId.override -
resolveWatchers(
String topic, Map< String, Object?> payload, {int limit = 256}) → Future<List< WorkflowWatcherResolution> > -
Resolves watchers listening on
topic, persistingpayloadand marking runs ready to resume atomically. Returns the resolved watchers so the runtime can enqueue follow-up work.override -
rewindToStep(
String runId, String stepName) → Future< void> -
Rewinds a run to the specified
stepName.override -
runsWaitingOn(
String topic, {int limit = 256}) → Future< List< String> > -
Lists runs waiting on a specific event
topic.override -
saveStep<
T> (String runId, String stepName, T value) → Future< void> -
Persists a step value and updates the run timestamp.
override
-
suspendOnTopic(
String runId, String stepName, String topic, {DateTime? deadline, Map< String, Object?> ? data}) → Future<void> -
Suspends
runIdwhile awaiting an event withtopic.override -
suspendUntil(
String runId, String stepName, DateTime when, {Map< String, Object?> ? data}) → Future<void> -
Suspends
runIduntil the givenwhen.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited