Skip to main content

FlowStore

Trait FlowStore 

Source
pub trait FlowStore: Send + Sync {
Show 14 methods // Required methods fn insert<'life0, 'life1, 'async_trait>( &'life0 self, flow: &'life1 Flow, ) -> Pin<Box<dyn Future<Output = Result<(), FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Flow>, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_by_owner<'life0, 'life1, 'async_trait>( &'life0 self, owner_session_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Flow>, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_by_status<'life0, 'async_trait>( &'life0 self, status: FlowStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<Flow>, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn update_with_revision<'life0, 'life1, 'async_trait>( &'life0 self, flow: &'life1 Flow, ) -> Pin<Box<dyn Future<Output = Result<Flow, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn append_event<'life0, 'life1, 'async_trait>( &'life0 self, flow_id: Uuid, kind: &'life1 str, payload: Value, ) -> Pin<Box<dyn Future<Output = Result<FlowEvent, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_events<'life0, 'async_trait>( &'life0 self, flow_id: Uuid, limit: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<FlowEvent>, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn insert_step<'life0, 'life1, 'async_trait>( &'life0 self, step: &'life1 FlowStep, ) -> Pin<Box<dyn Future<Output = Result<(), FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_step<'life0, 'life1, 'async_trait>( &'life0 self, step: &'life1 FlowStep, ) -> Pin<Box<dyn Future<Output = Result<FlowStep, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_step<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<FlowStep>, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_steps<'life0, 'async_trait>( &'life0 self, flow_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<FlowStep>, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_step_by_run_id<'life0, 'life1, 'async_trait>( &'life0 self, flow_id: Uuid, run_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<FlowStep>, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided methods fn update_and_append<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, flow: &'life1 Flow, event_kind: &'life2 str, event_payload: Value, ) -> Pin<Box<dyn Future<Output = Result<(Flow, FlowEvent), FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn prune_terminal_flows<'life0, 'async_trait>( &'life0 self, _retain_days: i64, ) -> Pin<Box<dyn Future<Output = Result<u64, FlowError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

Persistence layer for Flow records.

All mutating operations are revision-checked. Stale callers receive FlowError::RevisionMismatch and must re-fetch before retrying.

Required Methods§

Source

fn insert<'life0, 'life1, 'async_trait>( &'life0 self, flow: &'life1 Flow, ) -> Pin<Box<dyn Future<Output = Result<(), FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Flow>, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn list_by_owner<'life0, 'life1, 'async_trait>( &'life0 self, owner_session_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Flow>, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn list_by_status<'life0, 'async_trait>( &'life0 self, status: FlowStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<Flow>, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn update_with_revision<'life0, 'life1, 'async_trait>( &'life0 self, flow: &'life1 Flow, ) -> Pin<Box<dyn Future<Output = Result<Flow, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn append_event<'life0, 'life1, 'async_trait>( &'life0 self, flow_id: Uuid, kind: &'life1 str, payload: Value, ) -> Pin<Box<dyn Future<Output = Result<FlowEvent, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn list_events<'life0, 'async_trait>( &'life0 self, flow_id: Uuid, limit: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<FlowEvent>, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn insert_step<'life0, 'life1, 'async_trait>( &'life0 self, step: &'life1 FlowStep, ) -> Pin<Box<dyn Future<Output = Result<(), FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn update_step<'life0, 'life1, 'async_trait>( &'life0 self, step: &'life1 FlowStep, ) -> Pin<Box<dyn Future<Output = Result<FlowStep, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_step<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<FlowStep>, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn list_steps<'life0, 'async_trait>( &'life0 self, flow_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<FlowStep>, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn find_step_by_run_id<'life0, 'life1, 'async_trait>( &'life0 self, flow_id: Uuid, run_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<FlowStep>, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn update_and_append<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, flow: &'life1 Flow, event_kind: &'life2 str, event_payload: Value, ) -> Pin<Box<dyn Future<Output = Result<(Flow, FlowEvent), FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update a flow’s revision + append an audit event atomically. Previously FlowManager::with_retry called update_with_revision followed by append_event as two round-trips — a crash between them left the flow updated but with no event row, silently corrupting the audit trail. Implementers should run both in a single transaction; the default impl here is safe for stores where atomic multi-op isn’t possible (falls back to the non-atomic pair with a warn log).

Source

fn prune_terminal_flows<'life0, 'async_trait>( &'life0 self, _retain_days: i64, ) -> Pin<Box<dyn Future<Output = Result<u64, FlowError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drop flows in terminal status (Finished, Failed, Cancelled) whose updated_at is older than retain_days. Cascades through flow_steps and flow_events via ON DELETE CASCADE in schema. Intended for a daily heartbeat so list_by_owner / list_by_ status don’t grow O(n) over all history. Default impl returns an error — stores must override.

Implementors§