Skip to main content

TransactionObserver

Trait TransactionObserver 

Source
pub trait TransactionObserver:
    Send
    + Sync
    + Debug
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn requirements(&self) -> ObserverRequirements;
    fn on_commit(&self, event: &TransactionEvent<'_>) -> Result<()>;
}
Expand description

Trait implemented by every consumer of the post-commit observation surface (audit, replication, etc.).

See module docs for the full contract.

Required Methods§

Source

fn name(&self) -> &'static str

A short identifier for diagnostics and observability — appears in error logs and metric labels. Conventionally crate-shortname like "audit" or "replication".

Source

fn requirements(&self) -> ObserverRequirements

Declare which optional TransactionEvent fields this observer needs the backend to populate. Called once at registration time; cached by the backend.

Source

fn on_commit(&self, event: &TransactionEvent<'_>) -> Result<()>

Called inside the backend’s commit path, after the storage write succeeded. See module docs for failure semantics.

§Errors

Returns the observer-specific YetiError when post-commit processing fails. The backend logs the error and continues — observer failures do not roll back the write.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§