pub struct PgDovecoteAudit { /* private fields */ }Expand description
Postgres Dovecote-backed decision audit sink.
Implementations§
Source§impl PgDovecoteAudit
impl PgDovecoteAudit
Sourcepub fn new(
pool: PgPool,
source: impl Into<String>,
) -> Result<Self, DecisionAuditConfigError>
pub fn new( pool: PgPool, source: impl Into<String>, ) -> Result<Self, DecisionAuditConfigError>
Creates a sink using an application-owned absolute source URI.
§Errors
Returns an error when source is not an absolute URI.
Sourcepub fn from_config(pool: PgPool, config: DecisionAuditConfig) -> Self
pub fn from_config(pool: PgPool, config: DecisionAuditConfig) -> Self
Creates a sink from validated configuration.
Sourcepub const fn config(&self) -> &DecisionAuditConfig
pub const fn config(&self) -> &DecisionAuditConfig
Returns the configuration used for newly constructed events.
Sourcepub async fn check_schema(&self) -> Result<(), SchemaError>
pub async fn check_schema(&self) -> Result<(), SchemaError>
Verifies that the selected database has the installed Dovecote schema.
§Errors
Returns the typed Dovecote schema error when the schema is absent or incompatible.
Stores a failed attempt in its own transaction.
§Errors
Returns event validation, enqueue or commit errors. Retain the same immutable entry when reconciling an uncertain commit.
Sourcepub async fn record_attempt_in_transaction(
&self,
transaction: &mut Transaction<'_, Postgres>,
entry: &AuthorizationAttempt,
) -> Result<EnqueueOutcome, PgDovecoteAuditError>
pub async fn record_attempt_in_transaction( &self, transaction: &mut Transaction<'_, Postgres>, entry: &AuthorizationAttempt, ) -> Result<EnqueueOutcome, PgDovecoteAuditError>
Stores a failed attempt in a caller-owned transaction.
§Errors
Returns event or enqueue failures. The caller must commit for durability; rolling back the protected operation also rolls back this audit event.
Sourcepub async fn record_decision_audit(
&self,
entry: &AuditEntry,
) -> Result<EnqueueOutcome, PgDovecoteAuditError>
pub async fn record_decision_audit( &self, entry: &AuditEntry, ) -> Result<EnqueueOutcome, PgDovecoteAuditError>
Records an audit event in a transaction owned by this sink.
This is atomic between the Dovecote event and its pending delivery. Use
Self::record_decision_audit_in_transaction when an application must
include the event in its own transaction boundary.
§Errors
Returns a typed event, Dovecote, or SQLx transaction error.
Sourcepub async fn record_decision_audit_in_transaction(
&self,
transaction: &mut Transaction<'_, Postgres>,
entry: &AuditEntry,
) -> Result<EnqueueOutcome, PgDovecoteAuditError>
pub async fn record_decision_audit_in_transaction( &self, transaction: &mut Transaction<'_, Postgres>, entry: &AuditEntry, ) -> Result<EnqueueOutcome, PgDovecoteAuditError>
Records an audit event in a caller-owned Postgres transaction.
The caller must commit or roll back the transaction. The operation is atomic with other writes in that transaction, but not with arbitrary business-state writes performed in another transaction.
§Errors
Returns a typed event or Dovecote error. The caller remains responsible for rolling back after an error.
Trait Implementations§
Source§impl AttemptAuditSink for PgDovecoteAudit
impl AttemptAuditSink for PgDovecoteAudit
Source§type Error = PgDovecoteAuditError
type Error = PgDovecoteAuditError
Source§fn record_attempt<'life0, 'life1, 'async_trait>(
&'life0 self,
entry: &'life1 AuthorizationAttempt,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn record_attempt<'life0, 'life1, 'async_trait>(
&'life0 self,
entry: &'life1 AuthorizationAttempt,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl AuditSink for PgDovecoteAudit
impl AuditSink for PgDovecoteAudit
Source§type Error = PgDovecoteAuditError
type Error = PgDovecoteAuditError
Source§impl Clone for PgDovecoteAudit
impl Clone for PgDovecoteAudit
Source§fn clone(&self) -> PgDovecoteAudit
fn clone(&self) -> PgDovecoteAudit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PgDovecoteAudit
impl !UnwindSafe for PgDovecoteAudit
impl Freeze for PgDovecoteAudit
impl Send for PgDovecoteAudit
impl Sync for PgDovecoteAudit
impl Unpin for PgDovecoteAudit
impl UnsafeUnpin for PgDovecoteAudit
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
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> ⓘ
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> ⓘ
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 more