aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 2b17e4c0b03e36099c2c3d05634aab1f8bca257a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use anyhow::Result;

use rusoto_credential::{EnvironmentProvider, ProvideAwsCredentials};
use rusoto_signature::Region;

mod bayou;
mod cryptoblob;
mod time;
mod uidindex;

use bayou::Bayou;
use cryptoblob::Key;
use uidindex::{UidIndex, UidIndexOp};

#[tokio::main]
async fn main() {
    do_stuff().await.expect("Something failed");
}

async fn do_stuff() -> Result<()> {
    let creds = EnvironmentProvider::default().credentials().await.unwrap();

    let k2v_region = Region::Custom {
        name: "garage-staging".to_owned(),
        endpoint: "https://k2v-staging.home.adnab.me".to_owned(),
    };

    let s3_region = Region::Custom {
        name: "garage-staging".to_owned(),
        endpoint: "https://garage-staging.home.adnab.me".to_owned(),
    };

    let key = Key::from_slice(&[0u8; 32]).unwrap();

    let mut mail_index = Bayou::<UidIndex>::new(
        creds,
        k2v_region,
        s3_region,
        "alex".into(),
        "TestMailbox".into(),
        key,
    )?;

    mail_index.sync().await?;

    Ok(())
}