pub trait StorageEngine: Send + Sync {
// Required methods
fn store(
&self,
message: &EmailMessage,
) -> impl Future<Output = StorageResult<String>> + Send;
fn retrieve(
&self,
user: &str,
message_id: &str,
) -> impl Future<Output = StorageResult<String>> + Send;
fn list(
&self,
user: &str,
) -> impl Future<Output = StorageResult<Vec<String>>> + Send;
fn delete(
&self,
user: &str,
message_id: &str,
) -> impl Future<Output = StorageResult<()>> + Send;
fn create_mailbox(
&self,
user: &str,
mailbox: &str,
) -> impl Future<Output = StorageResult<()>> + Send;
}Expand description
Trait for storage engines.
Implementations of this trait provide different storage backends, such as filesystem, database, S3, etc.
Required Methods§
Sourcefn store(
&self,
message: &EmailMessage,
) -> impl Future<Output = StorageResult<String>> + Send
fn store( &self, message: &EmailMessage, ) -> impl Future<Output = StorageResult<String>> + Send
Stores an email message for a recipient.
Returns the message ID on success.
Sourcefn retrieve(
&self,
user: &str,
message_id: &str,
) -> impl Future<Output = StorageResult<String>> + Send
fn retrieve( &self, user: &str, message_id: &str, ) -> impl Future<Output = StorageResult<String>> + Send
Retrieves an email message by ID for a user.
Sourcefn list(
&self,
user: &str,
) -> impl Future<Output = StorageResult<Vec<String>>> + Send
fn list( &self, user: &str, ) -> impl Future<Output = StorageResult<Vec<String>>> + Send
Lists all message IDs for a user.
Sourcefn delete(
&self,
user: &str,
message_id: &str,
) -> impl Future<Output = StorageResult<()>> + Send
fn delete( &self, user: &str, message_id: &str, ) -> impl Future<Output = StorageResult<()>> + Send
Deletes a message by ID for a user.
Sourcefn create_mailbox(
&self,
user: &str,
mailbox: &str,
) -> impl Future<Output = StorageResult<()>> + Send
fn create_mailbox( &self, user: &str, mailbox: &str, ) -> impl Future<Output = StorageResult<()>> + Send
Creates a mailbox for a user.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.