Skip to main content

PgWorkflowExecutor

Struct PgWorkflowExecutor 

Source
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>

Source

pub fn new(inner: E, store: PgWorkflowStore) -> Self

Wrap an application executor with Postgres-backed workflow storage.

Source

pub fn store(&self) -> &PgWorkflowStore

Return the underlying store.

Source

pub fn inner(&self) -> &E

Return the wrapped application executor.

Trait Implementations§

Source§

impl<E> WorkflowExecutor for PgWorkflowExecutor<E>

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ColumnValue<Value> for T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more