relay_server

Trait EnvelopeStack

source
pub trait EnvelopeStack: Send + Debug {
    type Error: Debug + Error;

    // Required methods
    fn push(
        &mut self,
        envelope: Box<Envelope>,
    ) -> impl Future<Output = Result<(), Self::Error>>;
    fn peek(
        &mut self,
    ) -> impl Future<Output = Result<Option<DateTime<Utc>>, Self::Error>>;
    fn pop(
        &mut self,
    ) -> impl Future<Output = Result<Option<Box<Envelope>>, Self::Error>>;
    fn flush(self) -> impl Future<Output = ()>;
}
Expand description

A stack-like data structure that holds [Envelope]s.

Required Associated Types§

source

type Error: Debug + Error

The error type that is returned when an error is encountered during reading or writing the EnvelopeStack.

Required Methods§

source

fn push( &mut self, envelope: Box<Envelope>, ) -> impl Future<Output = Result<(), Self::Error>>

Pushes an [Envelope] on top of the stack.

source

fn peek( &mut self, ) -> impl Future<Output = Result<Option<DateTime<Utc>>, Self::Error>>

Peeks the [Envelope] on top of the stack.

source

fn pop( &mut self, ) -> impl Future<Output = Result<Option<Box<Envelope>>, Self::Error>>

Pops the [Envelope] on top of the stack.

source

fn flush(self) -> impl Future<Output = ()>

Persists all envelopes in the EnvelopeStacks to external storage, if possible, and consumes the stack provider.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl EnvelopeStack for SqliteEnvelopeStack

source§

type Error = SqliteEnvelopeStackError