pub struct PgWorkflowExecutor<E> { /* private fields */ }Expand description
Workflow executor wrapper that delegates business side effects and stores runtime guarantees in PostgreSQL.
Implementations§
Source§impl<E> PgWorkflowExecutor<E>
impl<E> PgWorkflowExecutor<E>
Sourcepub fn new(inner: E, store: PgWorkflowStore) -> Self
pub fn new(inner: E, store: PgWorkflowStore) -> Self
Wrap an application executor with Postgres-backed workflow storage.
Sourcepub fn store(&self) -> &PgWorkflowStore
pub fn store(&self) -> &PgWorkflowStore
Return the underlying store.
Trait Implementations§
Source§impl<E> WorkflowExecutor for PgWorkflowExecutor<E>where
E: WorkflowExecutor,
impl<E> WorkflowExecutor for PgWorkflowExecutor<E>where
E: WorkflowExecutor,
Source§fn execute_query<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd_json: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_query<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd_json: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Value, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute a QAIL query (QAIL wire text) and return results.
Source§fn send_notification<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelKind,
recipient: &'life2 str,
template: &'life3 str,
params: &'life4 Value,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn send_notification<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelKind,
recipient: &'life2 str,
template: &'life3 str,
params: &'life4 Value,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Send a notification through a channel.
Source§fn save_state<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 WorkflowContext,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_state<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 WorkflowContext,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persist the workflow state (for crash recovery).
Source§fn load_state<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<WorkflowContext>, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_state<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<WorkflowContext>, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load a previously persisted workflow state.
Source§fn create_charge<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 PaymentKind,
request: ChargeRequest,
) -> Pin<Box<dyn Future<Output = Result<ChargeResponse, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_charge<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 PaymentKind,
request: ChargeRequest,
) -> Pin<Box<dyn Future<Output = Result<ChargeResponse, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a payment charge via the appropriate provider. Read more
Source§fn acquire_workflow_lease<'life0, 'life1, 'async_trait>(
&'life0 self,
lease: &'life1 WorkflowLease,
) -> Pin<Box<dyn Future<Output = Result<bool, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn acquire_workflow_lease<'life0, 'life1, 'async_trait>(
&'life0 self,
lease: &'life1 WorkflowLease,
) -> Pin<Box<dyn Future<Output = Result<bool, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Acquire a per-workflow lease before executing a workflow operation. Read more
Source§fn release_workflow_lease<'life0, 'life1, 'async_trait>(
&'life0 self,
lease: &'life1 WorkflowLease,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn release_workflow_lease<'life0, 'life1, 'async_trait>(
&'life0 self,
lease: &'life1 WorkflowLease,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Release a per-workflow lease after a workflow operation finishes.
Source§fn begin_workflow_operation<'life0, 'life1, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowOperation,
) -> Pin<Box<dyn Future<Output = Result<WorkflowOperationStatus, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn begin_workflow_operation<'life0, 'life1, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowOperation,
) -> Pin<Box<dyn Future<Output = Result<WorkflowOperationStatus, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Begin or replay-detect an idempotent workflow operation. Read more
Source§fn complete_workflow_operation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowOperation,
state: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn complete_workflow_operation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowOperation,
state: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Mark an idempotent workflow operation as completed.
Source§fn fail_workflow_operation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowOperation,
error: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fail_workflow_operation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowOperation,
error: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Mark an idempotent workflow operation as failed.
Source§fn load_due_workflow_timeouts<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_name: &'life1 str,
now: DateTime<Utc>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_due_workflow_timeouts<'life0, 'life1, 'async_trait>(
&'life0 self,
workflow_name: &'life1 str,
now: DateTime<Utc>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return workflow ids whose wait deadlines are due for timeout handling. Read more
Source§fn begin_workflow_side_effect<'life0, 'life1, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
) -> Pin<Box<dyn Future<Output = Result<WorkflowSideEffectStatus, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn begin_workflow_side_effect<'life0, 'life1, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
) -> Pin<Box<dyn Future<Output = Result<WorkflowSideEffectStatus, WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Begin or replay-detect an idempotent side-effect operation.
Source§fn complete_workflow_side_effect<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
result: Option<&'life2 Value>,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn complete_workflow_side_effect<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
result: Option<&'life2 Value>,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Mark a side effect as completed, optionally storing its result.
Source§fn fail_workflow_side_effect<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
error: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fail_workflow_side_effect<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
error: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Mark a side effect as failed so a later retry can make a fresh attempt. Read more
Source§fn execute_query_once<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
cmd_json: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value, WorkflowError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn execute_query_once<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
cmd_json: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Value, WorkflowError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Execute a QAIL query with a stable workflow side-effect id.
Source§fn send_notification_once<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
channel: &'life2 ChannelKind,
recipient: &'life3 str,
template: &'life4 str,
params: &'life5 Value,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait,
fn send_notification_once<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
channel: &'life2 ChannelKind,
recipient: &'life3 str,
template: &'life4 str,
params: &'life5 Value,
) -> Pin<Box<dyn Future<Output = Result<(), WorkflowError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait,
Send a notification with a stable workflow side-effect id.
Source§fn create_charge_once<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
provider: &'life2 PaymentKind,
request: ChargeRequest,
) -> Pin<Box<dyn Future<Output = Result<ChargeResponse, WorkflowError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn create_charge_once<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation: &'life1 WorkflowSideEffect,
provider: &'life2 PaymentKind,
request: ChargeRequest,
) -> Pin<Box<dyn Future<Output = Result<ChargeResponse, WorkflowError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Create a payment charge with a stable workflow side-effect id.
Auto Trait Implementations§
impl<E> !RefUnwindSafe for PgWorkflowExecutor<E>
impl<E> !UnwindSafe for PgWorkflowExecutor<E>
impl<E> Freeze for PgWorkflowExecutor<E>where
E: Freeze,
impl<E> Send for PgWorkflowExecutor<E>where
E: Send,
impl<E> Sync for PgWorkflowExecutor<E>where
E: Sync,
impl<E> Unpin for PgWorkflowExecutor<E>where
E: Unpin,
impl<E> UnsafeUnpin for PgWorkflowExecutor<E>where
E: UnsafeUnpin,
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