This commit is contained in:
parent
cf8b9ac28d
commit
26f14df3f4
3 changed files with 6 additions and 7 deletions
|
@ -23,6 +23,7 @@ use crate::mail::unique_ident::*;
|
||||||
use crate::mail::user::User;
|
use crate::mail::user::User;
|
||||||
use crate::mail::IMF;
|
use crate::mail::IMF;
|
||||||
use crate::time::now_msec;
|
use crate::time::now_msec;
|
||||||
|
use crate::storage::Sto;
|
||||||
|
|
||||||
const INCOMING_PK: &str = "incoming";
|
const INCOMING_PK: &str = "incoming";
|
||||||
const INCOMING_LOCK_SK: &str = "lock";
|
const INCOMING_LOCK_SK: &str = "lock";
|
||||||
|
@ -139,14 +140,14 @@ async fn incoming_mail_watch_process_internal(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_incoming_mail(
|
async fn handle_incoming_mail<X: Sto>(
|
||||||
user: &Arc<User>,
|
user: &Arc<User>,
|
||||||
s3: &S3Client,
|
s3: &S3Client,
|
||||||
inbox: &Arc<Mailbox>,
|
inbox: &Arc<Mailbox>,
|
||||||
lock_held: &watch::Receiver<bool>,
|
lock_held: &watch::Receiver<bool>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let lor = ListObjectsV2Request {
|
let lor = ListObjectsV2Request {
|
||||||
bucket: user.creds.storage.bucket.clone(),
|
bucket: user.creds.storage.engine::<X>().bucket.clone(),
|
||||||
max_keys: Some(1000),
|
max_keys: Some(1000),
|
||||||
prefix: Some("incoming/".into()),
|
prefix: Some("incoming/".into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -30,8 +30,6 @@ pub const INBOX: &str = "INBOX";
|
||||||
const MAILBOX_LIST_PK: &str = "mailboxes";
|
const MAILBOX_LIST_PK: &str = "mailboxes";
|
||||||
const MAILBOX_LIST_SK: &str = "list";
|
const MAILBOX_LIST_SK: &str = "list";
|
||||||
|
|
||||||
use crate::storage::*;
|
|
||||||
|
|
||||||
pub struct User {
|
pub struct User {
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub creds: Credentials,
|
pub creds: Credentials,
|
||||||
|
|
|
@ -36,8 +36,8 @@ pub trait Sto: Sized {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Engine<T: Sto> {
|
pub struct Engine<T: Sto> {
|
||||||
bucket: String,
|
pub bucket: String,
|
||||||
row: T::Builder,
|
pub row: T::Builder,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum AnyEngine {
|
pub enum AnyEngine {
|
||||||
|
@ -45,7 +45,7 @@ pub enum AnyEngine {
|
||||||
Garage(Engine<garage::GrgTypes>),
|
Garage(Engine<garage::GrgTypes>),
|
||||||
}
|
}
|
||||||
impl AnyEngine {
|
impl AnyEngine {
|
||||||
fn engine<X: Sto>(&self) -> &Engine<X> {
|
pub fn engine<X: Sto>(&self) -> &Engine<X> {
|
||||||
match self {
|
match self {
|
||||||
Self::InMemory(x) => x,
|
Self::InMemory(x) => x,
|
||||||
Self::Garage(x) => x,
|
Self::Garage(x) => x,
|
||||||
|
|
Loading…
Reference in a new issue