pub trait WorkflowStore: Send + Sync {
Show 29 methods
// Required methods
fn set_tenant_policy(
&self,
tenant_id: WorkflowTenantId,
policy: WorkflowTenantPolicy,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>;
fn set_tenant_budget_policy(
&self,
tenant_id: WorkflowTenantId,
policy: WorkflowTenantBudgetPolicy,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>;
fn list_tenant_budgets(
&self,
after: Option<WorkflowTenantId>,
limit: WorkflowTenantListLimit,
) -> WorkflowStoreFuture<'_, Result<Vec<WorkflowTenantId>, WorkflowStoreError>>;
fn inspect_tenant_budget(
&self,
tenant_id: WorkflowTenantId,
) -> WorkflowStoreFuture<'_, Result<WorkflowTenantBudgetSnapshot, WorkflowStoreError>>;
fn list_tenant_budget_audit(
&self,
tenant_id: WorkflowTenantId,
after: Option<WorkflowBudgetAuditCursor>,
limit: WorkflowBudgetAuditLimit,
) -> WorkflowStoreFuture<'_, Result<Vec<WorkflowBudgetAuditEvent>, WorkflowStoreError>>;
fn compact_tenant_budget_audit(
&self,
tenant_id: WorkflowTenantId,
through: WorkflowBudgetAuditCursor,
) -> WorkflowStoreFuture<'_, Result<u64, WorkflowStoreError>>;
fn load_or_create_tenant_budget_audit_projection(
&self,
tenant_id: WorkflowTenantId,
projection_id: WorkflowBudgetAuditProjectionId,
) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetAuditCursor, WorkflowStoreError>>;
fn advance_tenant_budget_audit_projection(
&self,
tenant_id: WorkflowTenantId,
projection_id: WorkflowBudgetAuditProjectionId,
expected: WorkflowBudgetAuditCursor,
next: WorkflowBudgetAuditCursor,
) -> WorkflowStoreFuture<'_, Result<bool, WorkflowStoreError>>;
fn claim_tenant_budget_audit_projection(
&self,
tenant_id: WorkflowTenantId,
projection_id: WorkflowBudgetAuditProjectionId,
owner: WorkerId,
lease: LeaseDuration,
) -> WorkflowStoreFuture<'_, Result<Option<WorkflowBudgetAuditProjectionLease>, WorkflowStoreError>>;
fn heartbeat_tenant_budget_audit_projection(
&self,
lease: WorkflowBudgetAuditProjectionLease,
extension: LeaseDuration,
) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetAuditProjectionLease, WorkflowStoreError>>;
fn advance_tenant_budget_audit_projection_lease(
&self,
lease: WorkflowBudgetAuditProjectionLease,
next: WorkflowBudgetAuditCursor,
) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetAuditProjectionLease, WorkflowStoreError>>;
fn release_tenant_budget_audit_projection(
&self,
lease: WorkflowBudgetAuditProjectionLease,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>;
fn reserve_budget(
&self,
lease: WorkflowLease,
workflow_limit: Budget,
baseline: Usage,
) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetReservationOutcome, WorkflowStoreError>>;
fn settle_budget(
&self,
lease: WorkflowLease,
cumulative: Usage,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>;
fn enqueue(
&self,
task: WorkflowTask,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>;
fn claim(
&self,
worker: WorkerId,
lease: LeaseDuration,
) -> WorkflowStoreFuture<'_, Result<Option<ClaimedWorkflow>, WorkflowStoreError>>;
fn heartbeat(
&self,
lease: WorkflowLease,
extension: LeaseDuration,
) -> WorkflowStoreFuture<'_, Result<WorkflowLease, WorkflowStoreError>>;
fn finish(
&self,
lease: WorkflowLease,
disposition: WorkflowDisposition,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>;
fn publish_signal(
&self,
tenant_id: WorkflowTenantId,
signal: WorkflowSignal,
) -> WorkflowStoreFuture<'_, Result<WorkflowSignalOutcome, WorkflowStoreError>>;
fn cancel(
&self,
tenant_id: WorkflowTenantId,
checkpoint_id: CheckpointId,
) -> WorkflowStoreFuture<'_, Result<WorkflowCancelOutcome, WorkflowStoreError>>;
fn inspect_signal(
&self,
tenant_id: WorkflowTenantId,
signal_id: WorkflowSignalId,
) -> WorkflowStoreFuture<'_, Result<WorkflowSignalSnapshot, WorkflowStoreError>>;
fn compact_signals(
&self,
tenant_id: WorkflowTenantId,
retention: WorkflowSignalRetention,
) -> WorkflowStoreFuture<'_, Result<u64, WorkflowStoreError>>;
fn inspect(
&self,
tenant_id: WorkflowTenantId,
checkpoint_id: CheckpointId,
) -> WorkflowStoreFuture<'_, Result<WorkflowTaskSnapshot, WorkflowStoreError>>;
fn list_checkpoint_history(
&self,
tenant_id: WorkflowTenantId,
checkpoint_id: CheckpointId,
after_revision: Option<u64>,
limit: WorkflowCheckpointHistoryLimit,
) -> WorkflowStoreFuture<'_, Result<Vec<WorkflowCheckpointRevision>, WorkflowStoreError>>;
fn load_checkpoint_revision(
&self,
tenant_id: WorkflowTenantId,
checkpoint_id: CheckpointId,
revision: u64,
) -> WorkflowStoreFuture<'_, Result<WorkflowCheckpointRevision, WorkflowStoreError>>;
fn fork_workflow(
&self,
tenant_id: WorkflowTenantId,
command: WorkflowForkCommand,
) -> WorkflowStoreFuture<'_, Result<WorkflowForkOutcome, WorkflowStoreError>>;
fn load_checkpoint(
&self,
lease: WorkflowLease,
) -> WorkflowStoreFuture<'_, Result<Checkpoint, CheckpointError>>;
fn compare_and_swap_checkpoint(
&self,
lease: WorkflowLease,
checkpoint: Checkpoint,
expected_revision: Option<u64>,
) -> WorkflowStoreFuture<'_, Result<(), CheckpointError>>;
// Provided method
fn decide_interrupt(
&self,
tenant_id: WorkflowTenantId,
command: WorkflowInterruptCommand,
) -> WorkflowStoreFuture<'_, Result<WorkflowInterruptDecisionOutcome, WorkflowStoreError>> { ... }
}Expand description
Asynchronous distributed workflow task-control boundary.
Implementations must use a store-authoritative clock for claim expiration. Every ownership-sensitive mutation must compare both worker identity and fencing token.
Required Methods§
Sourcefn set_tenant_policy(
&self,
tenant_id: WorkflowTenantId,
policy: WorkflowTenantPolicy,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
fn set_tenant_policy( &self, tenant_id: WorkflowTenantId, policy: WorkflowTenantPolicy, ) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
Creates or replaces one tenant’s admission policy.
Sourcefn set_tenant_budget_policy(
&self,
tenant_id: WorkflowTenantId,
policy: WorkflowTenantBudgetPolicy,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
fn set_tenant_budget_policy( &self, tenant_id: WorkflowTenantId, policy: WorkflowTenantBudgetPolicy, ) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
Creates or replaces one tenant’s persistent aggregate budget policy.
Sourcefn list_tenant_budgets(
&self,
after: Option<WorkflowTenantId>,
limit: WorkflowTenantListLimit,
) -> WorkflowStoreFuture<'_, Result<Vec<WorkflowTenantId>, WorkflowStoreError>>
fn list_tenant_budgets( &self, after: Option<WorkflowTenantId>, limit: WorkflowTenantListLimit, ) -> WorkflowStoreFuture<'_, Result<Vec<WorkflowTenantId>, WorkflowStoreError>>
Discovers budget-enabled tenants in stable identity order.
Sourcefn inspect_tenant_budget(
&self,
tenant_id: WorkflowTenantId,
) -> WorkflowStoreFuture<'_, Result<WorkflowTenantBudgetSnapshot, WorkflowStoreError>>
fn inspect_tenant_budget( &self, tenant_id: WorkflowTenantId, ) -> WorkflowStoreFuture<'_, Result<WorkflowTenantBudgetSnapshot, WorkflowStoreError>>
Reads a tenant budget after reclaiming expired reservations.
Sourcefn list_tenant_budget_audit(
&self,
tenant_id: WorkflowTenantId,
after: Option<WorkflowBudgetAuditCursor>,
limit: WorkflowBudgetAuditLimit,
) -> WorkflowStoreFuture<'_, Result<Vec<WorkflowBudgetAuditEvent>, WorkflowStoreError>>
fn list_tenant_budget_audit( &self, tenant_id: WorkflowTenantId, after: Option<WorkflowBudgetAuditCursor>, limit: WorkflowBudgetAuditLimit, ) -> WorkflowStoreFuture<'_, Result<Vec<WorkflowBudgetAuditEvent>, WorkflowStoreError>>
Reads durable budget decisions strictly after an optional cursor.
Sourcefn compact_tenant_budget_audit(
&self,
tenant_id: WorkflowTenantId,
through: WorkflowBudgetAuditCursor,
) -> WorkflowStoreFuture<'_, Result<u64, WorkflowStoreError>>
fn compact_tenant_budget_audit( &self, tenant_id: WorkflowTenantId, through: WorkflowBudgetAuditCursor, ) -> WorkflowStoreFuture<'_, Result<u64, WorkflowStoreError>>
Deletes tenant audit facts at or before an explicitly acknowledged cursor.
Sourcefn load_or_create_tenant_budget_audit_projection(
&self,
tenant_id: WorkflowTenantId,
projection_id: WorkflowBudgetAuditProjectionId,
) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetAuditCursor, WorkflowStoreError>>
fn load_or_create_tenant_budget_audit_projection( &self, tenant_id: WorkflowTenantId, projection_id: WorkflowBudgetAuditProjectionId, ) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetAuditCursor, WorkflowStoreError>>
Loads or atomically registers one named consumer at cursor zero.
Sourcefn advance_tenant_budget_audit_projection(
&self,
tenant_id: WorkflowTenantId,
projection_id: WorkflowBudgetAuditProjectionId,
expected: WorkflowBudgetAuditCursor,
next: WorkflowBudgetAuditCursor,
) -> WorkflowStoreFuture<'_, Result<bool, WorkflowStoreError>>
fn advance_tenant_budget_audit_projection( &self, tenant_id: WorkflowTenantId, projection_id: WorkflowBudgetAuditProjectionId, expected: WorkflowBudgetAuditCursor, next: WorkflowBudgetAuditCursor, ) -> WorkflowStoreFuture<'_, Result<bool, WorkflowStoreError>>
Monotonically advances a projection cursor using compare-and-set.
Returns false when another projector changed the cursor after
expected was loaded.
Sourcefn claim_tenant_budget_audit_projection(
&self,
tenant_id: WorkflowTenantId,
projection_id: WorkflowBudgetAuditProjectionId,
owner: WorkerId,
lease: LeaseDuration,
) -> WorkflowStoreFuture<'_, Result<Option<WorkflowBudgetAuditProjectionLease>, WorkflowStoreError>>
fn claim_tenant_budget_audit_projection( &self, tenant_id: WorkflowTenantId, projection_id: WorkflowBudgetAuditProjectionId, owner: WorkerId, lease: LeaseDuration, ) -> WorkflowStoreFuture<'_, Result<Option<WorkflowBudgetAuditProjectionLease>, WorkflowStoreError>>
Exclusively claims an idle or expired named audit projection.
Sourcefn heartbeat_tenant_budget_audit_projection(
&self,
lease: WorkflowBudgetAuditProjectionLease,
extension: LeaseDuration,
) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetAuditProjectionLease, WorkflowStoreError>>
fn heartbeat_tenant_budget_audit_projection( &self, lease: WorkflowBudgetAuditProjectionLease, extension: LeaseDuration, ) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetAuditProjectionLease, WorkflowStoreError>>
Extends an active projection lease under its current fencing token.
Sourcefn advance_tenant_budget_audit_projection_lease(
&self,
lease: WorkflowBudgetAuditProjectionLease,
next: WorkflowBudgetAuditCursor,
) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetAuditProjectionLease, WorkflowStoreError>>
fn advance_tenant_budget_audit_projection_lease( &self, lease: WorkflowBudgetAuditProjectionLease, next: WorkflowBudgetAuditCursor, ) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetAuditProjectionLease, WorkflowStoreError>>
Advances a projection cursor only while its fenced lease remains active.
Sourcefn release_tenant_budget_audit_projection(
&self,
lease: WorkflowBudgetAuditProjectionLease,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
fn release_tenant_budget_audit_projection( &self, lease: WorkflowBudgetAuditProjectionLease, ) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
Releases a currently fenced projection without changing its cursor.
Sourcefn reserve_budget(
&self,
lease: WorkflowLease,
workflow_limit: Budget,
baseline: Usage,
) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetReservationOutcome, WorkflowStoreError>>
fn reserve_budget( &self, lease: WorkflowLease, workflow_limit: Budget, baseline: Usage, ) -> WorkflowStoreFuture<'_, Result<WorkflowBudgetReservationOutcome, WorkflowStoreError>>
Idempotently reserves the remaining workflow envelope under a lease.
Sourcefn settle_budget(
&self,
lease: WorkflowLease,
cumulative: Usage,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
fn settle_budget( &self, lease: WorkflowLease, cumulative: Usage, ) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
Commits observed cumulative usage and releases unused reservation.
Sourcefn enqueue(
&self,
task: WorkflowTask,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
fn enqueue( &self, task: WorkflowTask, ) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
Enqueues a task exactly once.
Sourcefn claim(
&self,
worker: WorkerId,
lease: LeaseDuration,
) -> WorkflowStoreFuture<'_, Result<Option<ClaimedWorkflow>, WorkflowStoreError>>
fn claim( &self, worker: WorkerId, lease: LeaseDuration, ) -> WorkflowStoreFuture<'_, Result<Option<ClaimedWorkflow>, WorkflowStoreError>>
Atomically claims the highest-priority eligible task.
Sourcefn heartbeat(
&self,
lease: WorkflowLease,
extension: LeaseDuration,
) -> WorkflowStoreFuture<'_, Result<WorkflowLease, WorkflowStoreError>>
fn heartbeat( &self, lease: WorkflowLease, extension: LeaseDuration, ) -> WorkflowStoreFuture<'_, Result<WorkflowLease, WorkflowStoreError>>
Extends a currently owned, unexpired lease.
Sourcefn finish(
&self,
lease: WorkflowLease,
disposition: WorkflowDisposition,
) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
fn finish( &self, lease: WorkflowLease, disposition: WorkflowDisposition, ) -> WorkflowStoreFuture<'_, Result<(), WorkflowStoreError>>
Applies a terminal or retry disposition under the current lease.
Sourcefn publish_signal(
&self,
tenant_id: WorkflowTenantId,
signal: WorkflowSignal,
) -> WorkflowStoreFuture<'_, Result<WorkflowSignalOutcome, WorkflowStoreError>>
fn publish_signal( &self, tenant_id: WorkflowTenantId, signal: WorkflowSignal, ) -> WorkflowStoreFuture<'_, Result<WorkflowSignalOutcome, WorkflowStoreError>>
Idempotently publishes an external signal, buffering it when necessary.
Sourcefn cancel(
&self,
tenant_id: WorkflowTenantId,
checkpoint_id: CheckpointId,
) -> WorkflowStoreFuture<'_, Result<WorkflowCancelOutcome, WorkflowStoreError>>
fn cancel( &self, tenant_id: WorkflowTenantId, checkpoint_id: CheckpointId, ) -> WorkflowStoreFuture<'_, Result<WorkflowCancelOutcome, WorkflowStoreError>>
Idempotently cancels queued, waiting, or currently leased work.
Sourcefn inspect_signal(
&self,
tenant_id: WorkflowTenantId,
signal_id: WorkflowSignalId,
) -> WorkflowStoreFuture<'_, Result<WorkflowSignalSnapshot, WorkflowStoreError>>
fn inspect_signal( &self, tenant_id: WorkflowTenantId, signal_id: WorkflowSignalId, ) -> WorkflowStoreFuture<'_, Result<WorkflowSignalSnapshot, WorkflowStoreError>>
Loads safe signal lifecycle metadata without exposing its payload.
Sourcefn compact_signals(
&self,
tenant_id: WorkflowTenantId,
retention: WorkflowSignalRetention,
) -> WorkflowStoreFuture<'_, Result<u64, WorkflowStoreError>>
fn compact_signals( &self, tenant_id: WorkflowTenantId, retention: WorkflowSignalRetention, ) -> WorkflowStoreFuture<'_, Result<u64, WorkflowStoreError>>
Deletes only consumed or dead-letter signals older than retention.
Sourcefn inspect(
&self,
tenant_id: WorkflowTenantId,
checkpoint_id: CheckpointId,
) -> WorkflowStoreFuture<'_, Result<WorkflowTaskSnapshot, WorkflowStoreError>>
fn inspect( &self, tenant_id: WorkflowTenantId, checkpoint_id: CheckpointId, ) -> WorkflowStoreFuture<'_, Result<WorkflowTaskSnapshot, WorkflowStoreError>>
Loads safe control-plane state for inspection.
Sourcefn list_checkpoint_history(
&self,
tenant_id: WorkflowTenantId,
checkpoint_id: CheckpointId,
after_revision: Option<u64>,
limit: WorkflowCheckpointHistoryLimit,
) -> WorkflowStoreFuture<'_, Result<Vec<WorkflowCheckpointRevision>, WorkflowStoreError>>
fn list_checkpoint_history( &self, tenant_id: WorkflowTenantId, checkpoint_id: CheckpointId, after_revision: Option<u64>, limit: WorkflowCheckpointHistoryLimit, ) -> WorkflowStoreFuture<'_, Result<Vec<WorkflowCheckpointRevision>, WorkflowStoreError>>
Lists immutable checkpoint revisions after an optional revision cursor.
Sourcefn load_checkpoint_revision(
&self,
tenant_id: WorkflowTenantId,
checkpoint_id: CheckpointId,
revision: u64,
) -> WorkflowStoreFuture<'_, Result<WorkflowCheckpointRevision, WorkflowStoreError>>
fn load_checkpoint_revision( &self, tenant_id: WorkflowTenantId, checkpoint_id: CheckpointId, revision: u64, ) -> WorkflowStoreFuture<'_, Result<WorkflowCheckpointRevision, WorkflowStoreError>>
Loads one exact immutable checkpoint revision for state inspection.
Sourcefn fork_workflow(
&self,
tenant_id: WorkflowTenantId,
command: WorkflowForkCommand,
) -> WorkflowStoreFuture<'_, Result<WorkflowForkOutcome, WorkflowStoreError>>
fn fork_workflow( &self, tenant_id: WorkflowTenantId, command: WorkflowForkCommand, ) -> WorkflowStoreFuture<'_, Result<WorkflowForkOutcome, WorkflowStoreError>>
Idempotently creates a new execution branch from immutable history.
Sourcefn load_checkpoint(
&self,
lease: WorkflowLease,
) -> WorkflowStoreFuture<'_, Result<Checkpoint, CheckpointError>>
fn load_checkpoint( &self, lease: WorkflowLease, ) -> WorkflowStoreFuture<'_, Result<Checkpoint, CheckpointError>>
Loads a checkpoint under a current worker lease.
Sourcefn compare_and_swap_checkpoint(
&self,
lease: WorkflowLease,
checkpoint: Checkpoint,
expected_revision: Option<u64>,
) -> WorkflowStoreFuture<'_, Result<(), CheckpointError>>
fn compare_and_swap_checkpoint( &self, lease: WorkflowLease, checkpoint: Checkpoint, expected_revision: Option<u64>, ) -> WorkflowStoreFuture<'_, Result<(), CheckpointError>>
Creates or compare-and-swaps a checkpoint under a current worker lease.
Provided Methods§
Sourcefn decide_interrupt(
&self,
tenant_id: WorkflowTenantId,
command: WorkflowInterruptCommand,
) -> WorkflowStoreFuture<'_, Result<WorkflowInterruptDecisionOutcome, WorkflowStoreError>>
fn decide_interrupt( &self, tenant_id: WorkflowTenantId, command: WorkflowInterruptCommand, ) -> WorkflowStoreFuture<'_, Result<WorkflowInterruptDecisionOutcome, WorkflowStoreError>>
Idempotently applies a typed human decision to a durable interrupt.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".