pub struct PostgresStore { /* private fields */ }Expand description
PostgreSQL storage backend for baselines.
Implementations§
Source§impl PostgresStore
impl PostgresStore
Sourcepub async fn new(
url: &str,
artifacts: Option<Arc<dyn ArtifactStore>>,
pool_config: &PostgresPoolConfig,
) -> Result<Self, StoreError>
pub async fn new( url: &str, artifacts: Option<Arc<dyn ArtifactStore>>, pool_config: &PostgresPoolConfig, ) -> Result<Self, StoreError>
Creates a new PostgreSQL storage backend and runs initial schema migrations.
The connection pool is configured according to the supplied
PostgresPoolConfig. An after_connect callback sets
statement_timeout on every new connection, and a before_acquire
callback pings the connection to verify it is still alive.
Trait Implementations§
Source§impl AuditStore for PostgresStore
impl AuditStore for PostgresStore
Source§fn log_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 AuditEvent,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn log_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 AuditEvent,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Appends a new audit event to the log.
Source§fn list_events<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 ListAuditEventsQuery,
) -> Pin<Box<dyn Future<Output = Result<ListAuditEventsResponse, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_events<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 ListAuditEventsQuery,
) -> Pin<Box<dyn Future<Output = Result<ListAuditEventsResponse, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lists audit events with optional filtering.
Source§impl BaselineStore for PostgresStore
impl BaselineStore for PostgresStore
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 BaselineRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 BaselineRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stores a new baseline record.
Source§fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
version: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<BaselineRecord>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
version: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<BaselineRecord>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Retrieves a baseline by project, benchmark, and version.
Source§fn get_latest<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<BaselineRecord>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_latest<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<BaselineRecord>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieves the latest baseline for a project and benchmark.
Source§fn list<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
query: &'life2 ListBaselinesQuery,
) -> Pin<Box<dyn Future<Output = Result<ListBaselinesResponse, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
query: &'life2 ListBaselinesQuery,
) -> Pin<Box<dyn Future<Output = Result<ListBaselinesResponse, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Lists baselines with optional filtering.
Source§fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 BaselineRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 BaselineRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Updates an existing baseline record.
Source§fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
version: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
version: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Deletes a baseline (soft delete).
Source§fn hard_delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
version: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn hard_delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
version: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Permanently removes a deleted baseline.
Source§fn list_versions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<BaselineVersion>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list_versions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
benchmark: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<BaselineVersion>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Lists all versions for a benchmark.
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageHealth, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageHealth, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Checks if the storage backend is healthy.
Source§fn backend_type(&self) -> &'static str
fn backend_type(&self) -> &'static str
Returns the backend type name.
Source§fn pool_metrics(&self) -> Option<PoolMetrics>
fn pool_metrics(&self) -> Option<PoolMetrics>
Returns connection pool metrics, if the backend uses a pool. Read more
Source§fn create_verdict<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 VerdictRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_verdict<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 VerdictRecord,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stores a new verdict record.
Source§fn list_verdicts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
query: &'life2 ListVerdictsQuery,
) -> Pin<Box<dyn Future<Output = Result<ListVerdictsResponse, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list_verdicts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project: &'life1 str,
query: &'life2 ListVerdictsQuery,
) -> Pin<Box<dyn Future<Output = Result<ListVerdictsResponse, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Lists verdicts with optional filtering.
Source§impl Clone for PostgresStore
impl Clone for PostgresStore
Source§fn clone(&self) -> PostgresStore
fn clone(&self) -> PostgresStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PostgresStore
impl !RefUnwindSafe for PostgresStore
impl Send for PostgresStore
impl Sync for PostgresStore
impl Unpin for PostgresStore
impl UnsafeUnpin for PostgresStore
impl !UnwindSafe for PostgresStore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.