Skip to main content

InboxStore

Trait InboxStore 

Source
pub trait InboxStore: Send + Sync {
    // Required method
    async fn accept(&self, key: &str) -> Result<bool, EngineError>;
}
Expand description

Async idempotency store for inbound messages.

Implement this trait to plug in persistent deduplication storage (e.g. PostgreSQL, redb). Use [InMemoryInboxStore] for tests and development.

Required Methods§

Source

async fn accept(&self, key: &str) -> Result<bool, EngineError>

Check whether key has been seen before and, if not, register it.

Returns Ok(true) when key is new (the message should be processed). Returns Ok(false) when key was already seen (duplicate — the caller should drop the message).

Implementations must guarantee atomic check-and-set semantics under concurrent callers.

§Errors

Returns EngineError::Store on storage failure.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§