relay_server/services/buffer/envelope_stack/
mod.rs1use std::future::Future;
2
3use chrono::{DateTime, Utc};
4
5use crate::envelope::Envelope;
6
7pub mod caching;
8pub mod memory;
9pub mod sqlite;
10
11pub trait EnvelopeStack: Send + std::fmt::Debug {
13 type Error: std::fmt::Debug + std::error::Error;
16
17 fn push(&mut self, envelope: Box<Envelope>) -> impl Future<Output = Result<(), Self::Error>>;
19
20 fn peek(&mut self) -> impl Future<Output = Result<Option<DateTime<Utc>>, Self::Error>>;
22
23 fn pop(&mut self) -> impl Future<Output = Result<Option<Box<Envelope>>, Self::Error>>;
25
26 fn flush(self) -> impl Future<Output = ()>;
29}