PostgresWorkflowStore class

PostgreSQL-backed WorkflowStore implementation.

Properties

hashCode int
The hash code for this object.
no setterinherited
namespace String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schema String
final

Methods

cancel(String runId, {String? reason}) Future<void>
Transitions the run to WorkflowStatus.cancelled.
close() Future<void>
createRun({required String workflow, required Map<String, Object?> params, String? parentRunId, Duration? ttl, WorkflowCancellationPolicy? cancellationPolicy}) Future<String>
dueRuns(DateTime now, {int limit = 256}) Future<List<String>>
Returns run identifiers whose wake-up time is at or before now.
get(String runId) Future<RunState?>
listRuns({String? workflow, WorkflowStatus? status, int limit = 50}) Future<List<RunState>>
Returns recent runs filtered by workflow and/or status.
listSteps(String runId) Future<List<WorkflowStepEntry>>
Returns persisted step results for inspection/debugging.
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.
markCompleted(String runId, Object? result) Future<void>
markFailed(String runId, Object error, StackTrace stack, {bool terminal = false}) Future<void>
markResumed(String runId, {Map<String, Object?>? data}) Future<void>
Clears suspension metadata when the run is ready to execute again.
markRunning(String runId, {String? stepName}) Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readStep<T>(String runId, String stepName) Future<T?>
registerWatcher(String runId, String stepName, String topic, {DateTime? deadline, Map<String, Object?>? data}) Future<void>
Registers a durable watcher for topic so the runtime can resume stepName when an event is emitted.
resolveWatchers(String topic, Map<String, Object?> payload, {int limit = 256}) Future<List<WorkflowWatcherResolution>>
Resolves watchers listening on topic, persisting payload and marking runs ready to resume atomically. Returns the resolved watchers so the runtime can enqueue follow-up work.
rewindToStep(String runId, String stepName) Future<void>
Rewinds a run so the given stepName (and subsequent steps) will execute again on the next resume.
runsWaitingOn(String topic, {int limit = 256}) Future<List<String>>
Returns run identifiers currently suspended on topic.
saveStep<T>(String runId, String stepName, T value) Future<void>
Saves a checkpoint for stepName and refreshes the run heartbeat.
suspendOnTopic(String runId, String stepName, String topic, {DateTime? deadline, Map<String, Object?>? data}) Future<void>
Suspends runId while awaiting an event with topic.
suspendUntil(String runId, String stepName, DateTime when, {Map<String, Object?>? data}) Future<void>
Suspends runId until the given when.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

connect(String uri, {String schema = 'public', String namespace = 'stem', String? applicationName, TlsConfig? tls, Uuid? uuid, WorkflowClock clock = const SystemWorkflowClock()}) Future<PostgresWorkflowStore>
Connects to a PostgreSQL database and ensures the workflow tables exist.