mirror of https://github.com/terhechte/postsack
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
558 B
Rust
20 lines
558 B
Rust
use std::path::Path;
|
|
use std::thread::JoinHandle;
|
|
|
|
use crossbeam_channel::Sender;
|
|
use eyre::Result;
|
|
|
|
use crate::Config;
|
|
|
|
use super::{db_message::DBMessage, query::Query, query_result::QueryResult};
|
|
|
|
pub trait DatabaseLike: Clone + Send {
|
|
fn new(path: impl AsRef<Path>) -> Result<Self>
|
|
where
|
|
Self: Sized;
|
|
fn total_mails(&self) -> Result<usize>;
|
|
fn query(&self, query: &Query) -> Result<Vec<QueryResult>>;
|
|
fn import(self) -> (Sender<DBMessage>, JoinHandle<Result<usize>>);
|
|
fn save_config(&self, config: Config) -> Result<()>;
|
|
}
|