pub struct PostgresEventStore { /* private fields */ }Expand description
A3S ORM-backed PostgreSQL event store for multi-process durable hosts.
The store keeps one row per FlowEventEnvelope. Appends take the same
transaction-scoped advisory lock used by earlier Flow releases before
checking the latest sequence and inserting the next event. That preserves
per-run event order across rolling upgrades and concurrent workers.
Implementations§
Source§impl PostgresEventStore
impl PostgresEventStore
Sourcepub async fn hold_history(
&self,
run_id: &str,
hold_id: &str,
reason: &str,
) -> Result<()>
pub async fn hold_history( &self, run_id: &str, hold_id: &str, reason: &str, ) -> Result<()>
Persist an audit hold that prevents a run history from being pruned.
Repeating the same (run_id, hold_id, reason) is idempotent. Reusing a
hold ID with another reason returns a conflict so audit intent cannot be
silently replaced.
Sourcepub async fn release_history_hold(
&self,
run_id: &str,
hold_id: &str,
) -> Result<bool>
pub async fn release_history_hold( &self, run_id: &str, hold_id: &str, ) -> Result<bool>
Release one audit hold. Returns false when the hold did not exist.
Sourcepub async fn history_holds(&self, run_id: &str) -> Result<Vec<FlowHistoryHold>>
pub async fn history_holds(&self, run_id: &str) -> Result<Vec<FlowHistoryHold>>
List durable audit holds for one run in stable hold-ID order.
Sourcepub async fn history_tombstone(
&self,
run_id: &str,
) -> Result<Option<FlowHistoryTombstone>>
pub async fn history_tombstone( &self, run_id: &str, ) -> Result<Option<FlowHistoryTombstone>>
Read the minimal audit tombstone retained after history deletion.
Sourcepub async fn prune_terminal_history(
&self,
policy: FlowHistoryRetentionPolicy,
) -> Result<FlowHistoryRetentionReport>
pub async fn prune_terminal_history( &self, policy: FlowHistoryRetentionPolicy, ) -> Result<FlowHistoryRetentionReport>
Delete complete eligible terminal histories in one consistent scan.
The scan takes an exclusive retention guard, locks existing run streams in stable order, preserves durable holds and linked components, writes a checksum tombstone, and only then deletes event rows. It never performs partial stream compaction.
Source§impl PostgresEventStore
impl PostgresEventStore
Sourcepub async fn connect(database_url: impl AsRef<str>) -> Result<Self>
pub async fn connect(database_url: impl AsRef<str>) -> Result<Self>
Connect with the ORM’s bounded non-TLS pool and run Flow migrations.
Production hosts that require TLS or custom pool controls should create
a configured PostgresExecutor and call Self::from_executor.
Sourcepub async fn connect_verified(database_url: impl AsRef<str>) -> Result<Self>
pub async fn connect_verified(database_url: impl AsRef<str>) -> Result<Self>
Connect and verify that the complete Flow schema was applied by a separate migrator, without acquiring DDL authority.
Sourcepub async fn from_executor(executor: PostgresExecutor) -> Result<Self>
pub async fn from_executor(executor: PostgresExecutor) -> Result<Self>
Create a store from a configured executor and run Flow migrations.
Sourcepub async fn from_executor_verified(executor: PostgresExecutor) -> Result<Self>
pub async fn from_executor_verified(executor: PostgresExecutor) -> Result<Self>
Create a store from a configured executor after read-only admission of the complete Flow schema.
Sourcepub fn executor(&self) -> &PostgresExecutor
pub fn executor(&self) -> &PostgresExecutor
Return the executor used by this store.
Trait Implementations§
Source§impl Clone for PostgresEventStore
impl Clone for PostgresEventStore
Source§fn clone(&self) -> PostgresEventStore
fn clone(&self) -> PostgresEventStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PostgresEventStore
impl Debug for PostgresEventStore
Source§impl FlowEventStore for PostgresEventStore
impl FlowEventStore for PostgresEventStore
Source§fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
event: FlowEvent,
) -> Pin<Box<dyn Future<Output = Result<FlowEventEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
event: FlowEvent,
) -> Pin<Box<dyn Future<Output = Result<FlowEventEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
event to run_id and return its durable envelope.Source§fn append_if_sequence<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
expected_sequence: u64,
event: FlowEvent,
) -> Pin<Box<dyn Future<Output = Result<FlowEventEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append_if_sequence<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
expected_sequence: u64,
event: FlowEvent,
) -> Pin<Box<dyn Future<Output = Result<FlowEventEnvelope>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FlowEventEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FlowEventEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
run_id in sequence order.Source§fn list_run_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_run_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn list_due_wakeups<'life0, 'async_trait>(
&'life0 self,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScheduledWakeup>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_due_wakeups<'life0, 'async_trait>(
&'life0 self,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ScheduledWakeup>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
now. Read more