Skip to main content

AuditStore

Trait AuditStore 

Source
pub trait AuditStore:
    Send
    + Sync
    + Debug {
Show 16 methods // Required methods fn record<'life0, 'async_trait>( &'life0 self, transaction: NewTransaction, ) -> Pin<Box<dyn Future<Output = Result<TransactionRecord, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn record_previewed<'life0, 'async_trait>( &'life0 self, transaction: NewTransaction, preview: PreviewEnvelope, ) -> Pin<Box<dyn Future<Output = Result<RecordedPreviewedTransaction, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<TransactionRecord>, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_preview<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<PreviewEnvelope>, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_status<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, new_status: JobState, ) -> Pin<Box<dyn Future<Output = Result<(), TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn approve_transaction<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn revoke_unconsumed_approval<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn claim_approved_for_execution<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, transaction_id: &'life1 str, receipt_digest: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn cleanup_stale_queued<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn cancel_queued<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_transactions<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, limit: u32, status_filter: Option<&'life1 str>, action_filter: Option<&'life2 str>, since_hours: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionRecord>, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn list_history<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, limit: u32, status_filter: Option<&'life1 str>, action_filter: Option<&'life2 str>, since_hours: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<JobHistoryEntry>, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn fetch_chain_row<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ChainRow>, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn fetch_chain_rows<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChainRow>, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn verify_audit_chain<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 AuditKey, ) -> Pin<Box<dyn Future<Output = Result<VerifyOutcome, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided method fn reconcile_interrupted_running<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, TransactionStoreError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

Async, polymorphic interface to the audit log. Implemented by SqliteStore (rusqlite, blocking under the hood) and postgres::PostgresStore (sqlx, native async).

All methods on this trait correspond 1:1 to methods on TransactionStore for the SQLite path; the Postgres path implements the same semantics over a different SQL dialect.

Required Methods§

Source

fn record<'life0, 'async_trait>( &'life0 self, transaction: NewTransaction, ) -> Pin<Box<dyn Future<Output = Result<TransactionRecord, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn record_previewed<'life0, 'async_trait>( &'life0 self, transaction: NewTransaction, preview: PreviewEnvelope, ) -> Pin<Box<dyn Future<Output = Result<RecordedPreviewedTransaction, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<TransactionRecord>, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_preview<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<PreviewEnvelope>, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn update_status<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, new_status: JobState, ) -> Pin<Box<dyn Future<Output = Result<(), TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn approve_transaction<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn revoke_unconsumed_approval<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn claim_approved_for_execution<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, transaction_id: &'life1 str, receipt_digest: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

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

Source

fn cancel_queued<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancel one still-Queued transaction (Queued → Canceled). Returns true iff a queued row was transitioned; a Running (in-flight) or terminal transaction is never cancelled. See crate::transactions::TransactionStore::cancel_queued.

Source

fn list_transactions<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, limit: u32, status_filter: Option<&'life1 str>, action_filter: Option<&'life2 str>, since_hours: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionRecord>, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn list_history<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, limit: u32, status_filter: Option<&'life1 str>, action_filter: Option<&'life2 str>, since_hours: Option<u32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<JobHistoryEntry>, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Structured history rows (with created_at and typed risk_level) for programmatic clients. See crate::transactions::JobHistoryEntry.

Source

fn fetch_chain_row<'life0, 'life1, 'async_trait>( &'life0 self, transaction_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ChainRow>, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn fetch_chain_rows<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChainRow>, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn verify_audit_chain<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 AuditKey, ) -> Pin<Box<dyn Future<Output = Result<VerifyOutcome, TransactionStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

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

Reconcile transactions orphaned by a daemon crash or restart.

A row still in Running means the daemon was mid-execution of that action when it exited. On the next start the in-flight work is orphaned and its true outcome is unknown, so each such row is transitioned Running → Failed (the conservative outcome — the operator must re-check) and the transition is recorded in the audit chain. Intended to run exactly once at startup, before the daemon begins accepting connections, so clients never observe a phantom in-flight row.

Returns the number of transactions reconciled. The default implementation is backend-agnostic: it pages through Running rows via list_transactions and applies update_status, both of which every backend already implements with identical semantics.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§