diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-03-08 08:43:28 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-03-08 08:43:28 +0100 |
commit | 1edf0b15ecaa73d55bb72c6f3c6e25d4f231f322 (patch) | |
tree | f69b53af28f2680d2d923add56c1ccb204c96176 | |
parent | 1a43ce5ac7033c148f64a033f2b1d335e95e11d5 (diff) | |
download | aerogramme-1edf0b15ecaa73d55bb72c6f3c6e25d4f231f322.tar.gz aerogramme-1edf0b15ecaa73d55bb72c6f3c6e25d4f231f322.zip |
Re-enable collections
-rw-r--r-- | Cargo.lock | 137 | ||||
-rw-r--r-- | Cargo.toml | 4 | ||||
-rw-r--r-- | aero-bayou/Cargo.toml | 2 | ||||
-rw-r--r-- | aero-bayou/src/lib.rs | 8 | ||||
-rw-r--r-- | aero-collections/Cargo.toml | 24 | ||||
-rw-r--r-- | aero-collections/src/calendar/mod.rs | 1 | ||||
-rw-r--r-- | aero-collections/src/lib.rs | 3 | ||||
-rw-r--r-- | aero-collections/src/mail/incoming.rs (renamed from aero-collections/mail/incoming.rs) | 12 | ||||
-rw-r--r-- | aero-collections/src/mail/mailbox.rs (renamed from aero-collections/mail/mailbox.rs) | 11 | ||||
-rw-r--r-- | aero-collections/src/mail/mod.rs (renamed from aero-collections/mail/mod.rs) | 2 | ||||
-rw-r--r-- | aero-collections/src/mail/namespace.rs (renamed from aero-collections/mail/namespace.rs) | 15 | ||||
-rw-r--r-- | aero-collections/src/mail/query.rs (renamed from aero-collections/mail/query.rs) | 0 | ||||
-rw-r--r-- | aero-collections/src/mail/snapshot.rs (renamed from aero-collections/mail/snapshot.rs) | 0 | ||||
-rw-r--r-- | aero-collections/src/mail/uidindex.rs (renamed from aero-collections/mail/uidindex.rs) | 2 | ||||
-rw-r--r-- | aero-collections/src/mail/unique_ident.rs (renamed from aero-collections/mail/unique_ident.rs) | 2 | ||||
-rw-r--r-- | aero-collections/src/user.rs (renamed from aero-collections/user.rs) | 14 |
16 files changed, 196 insertions, 41 deletions
@@ -23,10 +23,32 @@ version = "0.3.0" dependencies = [ "aero-user", "anyhow", + "hex", "log", "rand", "serde", "tokio", + "tracing", +] + +[[package]] +name = "aero-collections" +version = "0.3.0" +dependencies = [ + "aero-bayou", + "aero-user", + "anyhow", + "base64 0.21.7", + "eml-codec", + "futures", + "hex", + "im", + "lazy_static", + "rand", + "serde", + "sodiumoxide", + "tokio", + "tracing", ] [[package]] @@ -94,6 +116,21 @@ dependencies = [ ] [[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] name = "anyhow" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -617,6 +654,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + +[[package]] name = "blake2" version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -684,7 +730,12 @@ version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", "num-traits", + "wasm-bindgen", + "windows-targets 0.52.0", ] [[package]] @@ -888,6 +939,27 @@ dependencies = [ ] [[package]] +name = "eml-codec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4499124d87abce26a57ef96ece800fa8babc38fbedd81c607c340ae83d46d2e" +dependencies = [ + "base64 0.21.7", + "chrono", + "encoding_rs", + "nom 7.1.3", +] + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1285,6 +1357,29 @@ dependencies = [ ] [[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] name = "idna" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1295,6 +1390,20 @@ dependencies = [ ] [[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core", + "rand_xoshiro", + "sized-chunks", + "typenum", + "version_check", +] + +[[package]] name = "indexmap" version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1717,6 +1826,15 @@ dependencies = [ ] [[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core", +] + +[[package]] name = "regex-lite" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2067,6 +2185,16 @@ dependencies = [ ] [[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + +[[package]] name = "slab" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2602,6 +2730,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6,7 +6,7 @@ members = [ "aero-sasl", "aero-dav", "aero-dav/fuzz", -# "aero-collections", + "aero-collections", # "aero-proto", # "aerogramme", ] @@ -19,7 +19,7 @@ aero-user = { version = "0.3.0", path = "aero-user" } aero-bayou = { version = "0.3.0", path = "aero-bayou" } aero-sasl = { version = "0.3.0", path = "aero-sasl" } aero-dav = { version = "0.3.0", path = "aero-dav" } -#aero-collections = { version = "0.3.0", path = "aero-collections" } +aero-collections = { version = "0.3.0", path = "aero-collections" } #aero-proto = { version = "0.3.0", path = "aero-proto" } #aerogramme = { version = "0.3.0", path = "aerogramme" } diff --git a/aero-bayou/Cargo.toml b/aero-bayou/Cargo.toml index d271f4a..cade216 100644 --- a/aero-bayou/Cargo.toml +++ b/aero-bayou/Cargo.toml @@ -10,6 +10,8 @@ description = "A simplified version of Bayou by Terry et al. (ACM SIGOPS 1995)" aero-user.workspace = true anyhow.workspace = true +hex.workspace = true +tracing.workspace = true log.workspace = true rand.workspace = true serde.workspace = true diff --git a/aero-bayou/src/lib.rs b/aero-bayou/src/lib.rs index 7756964..159dbbf 100644 --- a/aero-bayou/src/lib.rs +++ b/aero-bayou/src/lib.rs @@ -1,4 +1,4 @@ -mod timestamp +pub mod timestamp; use std::sync::{Arc, Weak}; use std::time::{Duration, Instant}; @@ -9,9 +9,9 @@ use rand::prelude::*; use serde::{Deserialize, Serialize}; use tokio::sync::{watch, Notify}; -use aero_foundations::cryptoblob::*; -use aero_foundations::login::Credentials; -use aero_foundations::storage; +use aero_user::cryptoblob::*; +use aero_user::login::Credentials; +use aero_user::storage; use crate::timestamp::*; diff --git a/aero-collections/Cargo.toml b/aero-collections/Cargo.toml new file mode 100644 index 0000000..90d285e --- /dev/null +++ b/aero-collections/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "aero-collections" +version = "0.3.0" +authors = ["Alex Auvolat <alex@adnab.me>", "Quentin Dufour <quentin@dufour.io>"] +edition = "2021" +license = "EUPL-1.2" +description = "Aerogramme own representation of the different objects it manipulates" + +[dependencies] +aero-user.workspace = true +aero-bayou.workspace = true + +anyhow.workspace = true +base64.workspace = true +futures.workspace = true +lazy_static.workspace = true +serde.workspace = true +hex.workspace = true +tokio.workspace = true +tracing.workspace = true +rand.workspace = true +im.workspace = true +sodiumoxide.workspace = true +eml-codec.workspace = true diff --git a/aero-collections/src/calendar/mod.rs b/aero-collections/src/calendar/mod.rs new file mode 100644 index 0000000..19e3340 --- /dev/null +++ b/aero-collections/src/calendar/mod.rs @@ -0,0 +1 @@ +//@FIXME Event Index diff --git a/aero-collections/src/lib.rs b/aero-collections/src/lib.rs new file mode 100644 index 0000000..adcfc93 --- /dev/null +++ b/aero-collections/src/lib.rs @@ -0,0 +1,3 @@ +pub mod user; +pub mod mail; +pub mod calendar; diff --git a/aero-collections/mail/incoming.rs b/aero-collections/src/mail/incoming.rs index e2ad97d..8220461 100644 --- a/aero-collections/mail/incoming.rs +++ b/aero-collections/src/mail/incoming.rs @@ -1,6 +1,3 @@ -//use std::collections::HashMap; -use std::convert::TryFrom; - use std::sync::{Arc, Weak}; use std::time::Duration; @@ -11,15 +8,16 @@ use futures::{future::BoxFuture, FutureExt}; use tokio::sync::watch; use tracing::{debug, error, info, warn}; -use crate::cryptoblob; -use crate::login::{Credentials, PublicCredentials}; +use aero_user::cryptoblob; +use aero_user::login::{Credentials, PublicCredentials}; +use aero_user::storage; +use aero_bayou::timestamp::now_msec; + use crate::mail::mailbox::Mailbox; use crate::mail::uidindex::ImapUidvalidity; use crate::mail::unique_ident::*; use crate::user::User; use crate::mail::IMF; -use crate::storage; -use crate::timestamp::now_msec; const INCOMING_PK: &str = "incoming"; const INCOMING_LOCK_SK: &str = "lock"; diff --git a/aero-collections/mail/mailbox.rs b/aero-collections/src/mail/mailbox.rs index d1a5473..a767678 100644 --- a/aero-collections/mail/mailbox.rs +++ b/aero-collections/src/mail/mailbox.rs @@ -2,14 +2,15 @@ use anyhow::{anyhow, bail, Result}; use serde::{Deserialize, Serialize}; use tokio::sync::RwLock; -use crate::bayou::Bayou; -use crate::cryptoblob::{self, gen_key, open_deserialize, seal_serialize, Key}; -use crate::login::Credentials; +use aero_user::cryptoblob::{self, gen_key, open_deserialize, seal_serialize, Key}; +use aero_user::login::Credentials; +use aero_user::storage::{self, BlobRef, BlobVal, RowRef, RowVal, Selector, Store}; +use aero_bayou::Bayou; +use aero_bayou::timestamp::now_msec; + use crate::mail::uidindex::*; use crate::mail::unique_ident::*; use crate::mail::IMF; -use crate::storage::{self, BlobRef, BlobVal, RowRef, RowVal, Selector, Store}; -use crate::timestamp::now_msec; pub struct Mailbox { pub(super) id: UniqueIdent, diff --git a/aero-collections/mail/mod.rs b/aero-collections/src/mail/mod.rs index 03e85cd..85361f3 100644 --- a/aero-collections/mail/mod.rs +++ b/aero-collections/src/mail/mod.rs @@ -1,5 +1,3 @@ -use std::convert::TryFrom; - pub mod incoming; pub mod mailbox; pub mod query; diff --git a/aero-collections/mail/namespace.rs b/aero-collections/src/mail/namespace.rs index 5e67173..452ac68 100644 --- a/aero-collections/mail/namespace.rs +++ b/aero-collections/src/mail/namespace.rs @@ -1,19 +1,12 @@ -use std::collections::{BTreeMap, HashMap}; -use std::sync::{Arc, Weak}; +use std::collections::BTreeMap; -use anyhow::{anyhow, bail, Result}; -use lazy_static::lazy_static; +use anyhow::{bail, Result}; use serde::{Deserialize, Serialize}; -use tokio::sync::watch; -use crate::cryptoblob::{open_deserialize, seal_serialize}; -use crate::login::Credentials; -use crate::mail::incoming::incoming_mail_watch_process; -use crate::mail::mailbox::Mailbox; +use aero_bayou::timestamp::now_msec; + use crate::mail::uidindex::ImapUidvalidity; use crate::mail::unique_ident::{gen_ident, UniqueIdent}; -use crate::storage; -use crate::timestamp::now_msec; pub const MAILBOX_HIERARCHY_DELIMITER: char = '.'; diff --git a/aero-collections/mail/query.rs b/aero-collections/src/mail/query.rs index 3e6fe99..3e6fe99 100644 --- a/aero-collections/mail/query.rs +++ b/aero-collections/src/mail/query.rs diff --git a/aero-collections/mail/snapshot.rs b/aero-collections/src/mail/snapshot.rs index ed756b5..ed756b5 100644 --- a/aero-collections/mail/snapshot.rs +++ b/aero-collections/src/mail/snapshot.rs diff --git a/aero-collections/mail/uidindex.rs b/aero-collections/src/mail/uidindex.rs index 5a06670..637a1ac 100644 --- a/aero-collections/mail/uidindex.rs +++ b/aero-collections/src/mail/uidindex.rs @@ -3,7 +3,7 @@ use std::num::{NonZeroU32, NonZeroU64}; use im::{HashMap, OrdMap, OrdSet}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use crate::bayou::*; +use aero_bayou::*; use crate::mail::unique_ident::UniqueIdent; pub type ModSeq = NonZeroU64; diff --git a/aero-collections/mail/unique_ident.rs b/aero-collections/src/mail/unique_ident.rs index 0e629db..0987a2c 100644 --- a/aero-collections/mail/unique_ident.rs +++ b/aero-collections/src/mail/unique_ident.rs @@ -5,7 +5,7 @@ use lazy_static::lazy_static; use rand::prelude::*; use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; -use crate::timestamp::now_msec; +use aero_bayou::timestamp::now_msec; /// An internal Mail Identifier is composed of two components: /// - a process identifier, 128 bits, itself composed of: diff --git a/aero-collections/user.rs b/aero-collections/src/user.rs index a38b9c1..193ce90 100644 --- a/aero-collections/user.rs +++ b/aero-collections/src/user.rs @@ -1,20 +1,18 @@ -use std::collections::{BTreeMap, HashMap}; +use std::collections::HashMap; use std::sync::{Arc, Weak}; use anyhow::{anyhow, bail, Result}; use lazy_static::lazy_static; -use serde::{Deserialize, Serialize}; use tokio::sync::watch; -use crate::cryptoblob::{open_deserialize, seal_serialize}; -use crate::login::Credentials; +use aero_user::cryptoblob::{open_deserialize, seal_serialize}; +use aero_user::login::Credentials; +use aero_user::storage; + use crate::mail::incoming::incoming_mail_watch_process; use crate::mail::mailbox::Mailbox; use crate::mail::uidindex::ImapUidvalidity; -use crate::mail::unique_ident::{gen_ident, UniqueIdent}; -use crate::storage; -use crate::timestamp::now_msec; - +use crate::mail::unique_ident::UniqueIdent; use crate::mail::namespace::{MAILBOX_HIERARCHY_DELIMITER, INBOX, DRAFTS, ARCHIVE, SENT, TRASH, MAILBOX_LIST_PK, MAILBOX_LIST_SK,MailboxList,CreatedMailbox}; //@FIXME User should be totally rewriten |