Skip to main content

PgDovecoteAudit

Struct PgDovecoteAudit 

Source
pub struct PgDovecoteAudit { /* private fields */ }
Expand description

Postgres Dovecote-backed decision audit sink.

Implementations§

Source§

impl PgDovecoteAudit

Source

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.

Source

pub fn from_config(pool: PgPool, config: DecisionAuditConfig) -> Self

Creates a sink from validated configuration.

Source

pub const fn config(&self) -> &DecisionAuditConfig

Returns the configuration used for newly constructed events.

Source

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.

Source

pub async fn record_authorization_attempt( &self, entry: &AuthorizationAttempt, ) -> Result<EnqueueOutcome, PgDovecoteAuditError>

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.

Source

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.

Source

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.

Source

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

Source§

type Error = PgDovecoteAuditError

Storage failure, including uncertain commit outcomes.
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,

Stores the frozen attempt; retry exactly this event after ambiguous errors.
Source§

impl AuditSink for PgDovecoteAudit

Source§

type Error = PgDovecoteAuditError

Sink-specific write error.
Source§

fn record<'life0, 'life1, 'async_trait>( &'life0 self, entry: &'life1 AuditEntry, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Records a durable audit entry.
Source§

impl Clone for PgDovecoteAudit

Source§

fn clone(&self) -> PgDovecoteAudit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more