pub struct PostgresStore { /* private fields */ }Implementations§
Trait Implementations§
Source§impl WorkflowStore for PostgresStore
impl WorkflowStore for PostgresStore
async fn create_namespace(&self, name: &str) -> Result<()>
async fn list_namespaces(&self) -> Result<Vec<NamespaceRecord>>
async fn delete_namespace(&self, name: &str) -> Result<bool>
async fn get_namespace_stats(&self, namespace: &str) -> Result<NamespaceStats>
async fn create_workflow(&self, wf: &WorkflowRecord) -> Result<()>
async fn get_workflow(&self, id: &str) -> Result<Option<WorkflowRecord>>
async fn list_workflows( &self, namespace: &str, status: Option<WorkflowStatus>, workflow_type: Option<&str>, search_attrs_filter: Option<&str>, limit: i64, offset: i64, ) -> Result<Vec<WorkflowRecord>>
async fn update_workflow_status( &self, id: &str, status: WorkflowStatus, result: Option<&str>, error: Option<&str>, ) -> Result<()>
async fn claim_workflow(&self, id: &str, worker_id: &str) -> Result<bool>
Source§async fn mark_workflow_dispatchable(&self, workflow_id: &str) -> Result<()>
async fn mark_workflow_dispatchable(&self, workflow_id: &str) -> Result<()>
Mark a workflow as having new events that need a worker to replay it.
Idempotent — calling repeatedly is fine. Cleared by
claim_workflow_task.Source§async fn claim_workflow_task(
&self,
task_queue: &str,
worker_id: &str,
) -> Result<Option<WorkflowRecord>>
async fn claim_workflow_task( &self, task_queue: &str, worker_id: &str, ) -> Result<Option<WorkflowRecord>>
Atomically claim the oldest dispatchable workflow on a queue. Sets
dispatch_claimed_by and dispatch_last_heartbeat, clears
needs_dispatch. Returns the workflow record or None if nothing
is available.Source§async fn release_workflow_task(
&self,
workflow_id: &str,
worker_id: &str,
) -> Result<()>
async fn release_workflow_task( &self, workflow_id: &str, worker_id: &str, ) -> Result<()>
Release a workflow task’s dispatch lease (called when the worker
submits its commands batch). Only succeeds if
dispatch_claimed_by
matches the calling worker.Source§async fn release_stale_dispatch_leases(
&self,
now: f64,
timeout_secs: f64,
) -> Result<u64>
async fn release_stale_dispatch_leases( &self, now: f64, timeout_secs: f64, ) -> Result<u64>
Forcibly release dispatch leases whose worker hasn’t heartbeat’d
within
timeout_secs. Used by the engine’s background poller to
recover from worker crashes. Returns how many leases were released
(each becomes claimable again, with needs_dispatch=true).async fn append_event(&self, ev: &WorkflowEvent) -> Result<i64>
async fn list_events(&self, workflow_id: &str) -> Result<Vec<WorkflowEvent>>
async fn get_event_count(&self, workflow_id: &str) -> Result<i64>
async fn create_activity(&self, act: &WorkflowActivity) -> Result<i64>
Source§async fn get_activity(&self, id: i64) -> Result<Option<WorkflowActivity>>
async fn get_activity(&self, id: i64) -> Result<Option<WorkflowActivity>>
Look up an activity by its primary key.
Source§async fn get_activity_by_workflow_seq(
&self,
workflow_id: &str,
seq: i32,
) -> Result<Option<WorkflowActivity>>
async fn get_activity_by_workflow_seq( &self, workflow_id: &str, seq: i32, ) -> Result<Option<WorkflowActivity>>
Look up an activity by its workflow-relative sequence number.
Used for idempotent scheduling: the engine checks if (workflow_id, seq)
already exists before creating a new row.
async fn claim_activity( &self, task_queue: &str, worker_id: &str, ) -> Result<Option<WorkflowActivity>>
Source§async fn requeue_activity_for_retry(
&self,
id: i64,
next_attempt: i32,
next_scheduled_at: f64,
) -> Result<()>
async fn requeue_activity_for_retry( &self, id: i64, next_attempt: i32, next_scheduled_at: f64, ) -> Result<()>
Re-queue an activity for retry: clears the running state
(status→PENDING, claimed_by/started_at cleared), bumps
attempt,
and sets scheduled_at = now + backoff so the next claim_activity
won’t pick it up before the backoff elapses.async fn complete_activity( &self, id: i64, result: Option<&str>, error: Option<&str>, failed: bool, ) -> Result<()>
async fn heartbeat_activity( &self, id: i64, _details: Option<&str>, ) -> Result<()>
async fn get_timed_out_activities( &self, now: f64, ) -> Result<Vec<WorkflowActivity>>
async fn create_timer(&self, timer: &WorkflowTimer) -> Result<i64>
Source§async fn cancel_pending_activities(&self, workflow_id: &str) -> Result<u64>
async fn cancel_pending_activities(&self, workflow_id: &str) -> Result<u64>
Mark all PENDING activities of a workflow as CANCELLED so workers
that haven’t claimed them yet won’t pick them up. Returns the
number of rows affected. Does NOT touch RUNNING activities — those
will see the cancellation when they next heartbeat or complete.
Source§async fn cancel_pending_timers(&self, workflow_id: &str) -> Result<u64>
async fn cancel_pending_timers(&self, workflow_id: &str) -> Result<u64>
Mark all unfired timers of a workflow as fired without firing
(effectively removing them from the timer poller). Returns the
number of rows affected.
Source§async fn get_timer_by_workflow_seq(
&self,
workflow_id: &str,
seq: i32,
) -> Result<Option<WorkflowTimer>>
async fn get_timer_by_workflow_seq( &self, workflow_id: &str, seq: i32, ) -> Result<Option<WorkflowTimer>>
Look up an existing timer by its workflow-relative seq. Used by the
engine for idempotent ScheduleTimer (deterministic replay can call
schedule_timer for the same seq more than once on retries).
async fn fire_due_timers(&self, now: f64) -> Result<Vec<WorkflowTimer>>
async fn send_signal(&self, sig: &WorkflowSignal) -> Result<i64>
async fn consume_signals( &self, workflow_id: &str, name: &str, ) -> Result<Vec<WorkflowSignal>>
async fn create_schedule(&self, sched: &WorkflowSchedule) -> Result<()>
async fn get_schedule( &self, namespace: &str, name: &str, ) -> Result<Option<WorkflowSchedule>>
async fn list_schedules(&self, namespace: &str) -> Result<Vec<WorkflowSchedule>>
async fn update_schedule_last_run( &self, namespace: &str, name: &str, last_run_at: f64, next_run_at: f64, workflow_id: &str, ) -> Result<()>
async fn delete_schedule(&self, namespace: &str, name: &str) -> Result<bool>
Source§async fn list_archivable_workflows(
&self,
cutoff: f64,
limit: i64,
) -> Result<Vec<WorkflowRecord>>
async fn list_archivable_workflows( &self, cutoff: f64, limit: i64, ) -> Result<Vec<WorkflowRecord>>
List workflows in terminal states whose
completed_at is older than
cutoff and which haven’t been archived yet. Used by the optional
S3 archival background task to batch candidates.Source§async fn mark_archived_and_purge(
&self,
workflow_id: &str,
archive_uri: &str,
archived_at: f64,
) -> Result<()>
async fn mark_archived_and_purge( &self, workflow_id: &str, archive_uri: &str, archived_at: f64, ) -> Result<()>
Mark a workflow as archived (records
archived_at + archive_uri)
and purge its events, activities, timers, signals, and snapshots.
The workflow record itself is preserved so GET /workflows/{id}
still resolves with an archive pointer.Source§async fn upsert_search_attributes(
&self,
workflow_id: &str,
patch_json: &str,
) -> Result<()>
async fn upsert_search_attributes( &self, workflow_id: &str, patch_json: &str, ) -> Result<()>
Merge a JSON object patch into the workflow’s
search_attributes.
Keys in the patch overwrite existing keys; keys already present but
not in the patch are preserved. If the current column is NULL, the
patch becomes the new value.Source§async fn update_schedule(
&self,
namespace: &str,
name: &str,
patch: &SchedulePatch,
) -> Result<Option<WorkflowSchedule>>
async fn update_schedule( &self, namespace: &str, name: &str, patch: &SchedulePatch, ) -> Result<Option<WorkflowSchedule>>
Apply an in-place patch to a schedule. Only fields present on
patch are updated; the rest keep their current values. Returns
the updated record, or None if the schedule doesn’t exist. Read moreSource§async fn set_schedule_paused(
&self,
namespace: &str,
name: &str,
paused: bool,
) -> Result<Option<WorkflowSchedule>>
async fn set_schedule_paused( &self, namespace: &str, name: &str, paused: bool, ) -> Result<Option<WorkflowSchedule>>
Flip a schedule’s
paused flag. Returns the updated record, or
None if the schedule doesn’t exist. Read moreasync fn register_worker(&self, w: &WorkflowWorker) -> Result<()>
async fn heartbeat_worker(&self, id: &str, now: f64) -> Result<()>
async fn list_workers(&self, namespace: &str) -> Result<Vec<WorkflowWorker>>
async fn remove_dead_workers(&self, cutoff: f64) -> Result<Vec<String>>
async fn create_api_key( &self, key_hash: &str, prefix: &str, label: Option<&str>, created_at: f64, ) -> Result<()>
async fn validate_api_key(&self, key_hash: &str) -> Result<bool>
async fn list_api_keys(&self) -> Result<Vec<ApiKeyRecord>>
async fn revoke_api_key(&self, prefix: &str) -> Result<bool>
async fn list_child_workflows( &self, parent_id: &str, ) -> Result<Vec<WorkflowRecord>>
async fn create_snapshot( &self, workflow_id: &str, event_seq: i32, state_json: &str, ) -> Result<()>
async fn get_latest_snapshot( &self, workflow_id: &str, ) -> Result<Option<WorkflowSnapshot>>
async fn get_queue_stats(&self, namespace: &str) -> Result<Vec<QueueStats>>
Auto Trait Implementations§
impl Freeze for PostgresStore
impl !RefUnwindSafe for PostgresStore
impl Send for PostgresStore
impl Sync for PostgresStore
impl Unpin for PostgresStore
impl UnsafeUnpin for PostgresStore
impl !UnwindSafe for PostgresStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more