Re-enable collections

This commit is contained in:
Quentin 2024-03-08 08:43:28 +01:00
parent 1a43ce5ac7
commit 1edf0b15ec
Signed by: quentin
GPG key ID: E9602264D639FF68
16 changed files with 196 additions and 41 deletions

137
Cargo.lock generated
View file

@ -23,10 +23,32 @@ version = "0.3.0"
dependencies = [ dependencies = [
"aero-user", "aero-user",
"anyhow", "anyhow",
"hex",
"log", "log",
"rand", "rand",
"serde", "serde",
"tokio", "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]] [[package]]
@ -93,6 +115,21 @@ dependencies = [
"tokio", "tokio",
] ]
[[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]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.79" version = "1.0.79"
@ -616,6 +653,15 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitmaps"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
dependencies = [
"typenum",
]
[[package]] [[package]]
name = "blake2" name = "blake2"
version = "0.10.6" version = "0.10.6"
@ -684,7 +730,12 @@ version = "0.4.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a"
dependencies = [ dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits", "num-traits",
"wasm-bindgen",
"windows-targets 0.52.0",
] ]
[[package]] [[package]]
@ -887,6 +938,27 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[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]] [[package]]
name = "equivalent" name = "equivalent"
version = "1.0.1" version = "1.0.1"
@ -1284,6 +1356,29 @@ dependencies = [
"tracing", "tracing",
] ]
[[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]] [[package]]
name = "idna" name = "idna"
version = "0.5.0" version = "0.5.0"
@ -1294,6 +1389,20 @@ dependencies = [
"unicode-normalization", "unicode-normalization",
] ]
[[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]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.2.5" version = "2.2.5"
@ -1716,6 +1825,15 @@ dependencies = [
"getrandom", "getrandom",
] ]
[[package]]
name = "rand_xoshiro"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
dependencies = [
"rand_core",
]
[[package]] [[package]]
name = "regex-lite" name = "regex-lite"
version = "0.1.5" version = "0.1.5"
@ -2066,6 +2184,16 @@ dependencies = [
"rand_core", "rand_core",
] ]
[[package]]
name = "sized-chunks"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e"
dependencies = [
"bitmaps",
"typenum",
]
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.9" version = "0.4.9"
@ -2601,6 +2729,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 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]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.48.0" version = "0.48.0"

View file

@ -6,7 +6,7 @@ members = [
"aero-sasl", "aero-sasl",
"aero-dav", "aero-dav",
"aero-dav/fuzz", "aero-dav/fuzz",
# "aero-collections", "aero-collections",
# "aero-proto", # "aero-proto",
# "aerogramme", # "aerogramme",
] ]
@ -19,7 +19,7 @@ aero-user = { version = "0.3.0", path = "aero-user" }
aero-bayou = { version = "0.3.0", path = "aero-bayou" } aero-bayou = { version = "0.3.0", path = "aero-bayou" }
aero-sasl = { version = "0.3.0", path = "aero-sasl" } aero-sasl = { version = "0.3.0", path = "aero-sasl" }
aero-dav = { version = "0.3.0", path = "aero-dav" } 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" } #aero-proto = { version = "0.3.0", path = "aero-proto" }
#aerogramme = { version = "0.3.0", path = "aerogramme" } #aerogramme = { version = "0.3.0", path = "aerogramme" }

View file

@ -10,6 +10,8 @@ description = "A simplified version of Bayou by Terry et al. (ACM SIGOPS 1995)"
aero-user.workspace = true aero-user.workspace = true
anyhow.workspace = true anyhow.workspace = true
hex.workspace = true
tracing.workspace = true
log.workspace = true log.workspace = true
rand.workspace = true rand.workspace = true
serde.workspace = true serde.workspace = true

View file

@ -1,4 +1,4 @@
mod timestamp pub mod timestamp;
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
@ -9,9 +9,9 @@ use rand::prelude::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tokio::sync::{watch, Notify}; use tokio::sync::{watch, Notify};
use aero_foundations::cryptoblob::*; use aero_user::cryptoblob::*;
use aero_foundations::login::Credentials; use aero_user::login::Credentials;
use aero_foundations::storage; use aero_user::storage;
use crate::timestamp::*; use crate::timestamp::*;

View file

@ -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

View file

@ -0,0 +1 @@
//@FIXME Event Index

View file

@ -0,0 +1,3 @@
pub mod user;
pub mod mail;
pub mod calendar;

View file

@ -1,6 +1,3 @@
//use std::collections::HashMap;
use std::convert::TryFrom;
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use std::time::Duration; use std::time::Duration;
@ -11,15 +8,16 @@ use futures::{future::BoxFuture, FutureExt};
use tokio::sync::watch; use tokio::sync::watch;
use tracing::{debug, error, info, warn}; use tracing::{debug, error, info, warn};
use crate::cryptoblob; use aero_user::cryptoblob;
use crate::login::{Credentials, PublicCredentials}; use aero_user::login::{Credentials, PublicCredentials};
use aero_user::storage;
use aero_bayou::timestamp::now_msec;
use crate::mail::mailbox::Mailbox; use crate::mail::mailbox::Mailbox;
use crate::mail::uidindex::ImapUidvalidity; use crate::mail::uidindex::ImapUidvalidity;
use crate::mail::unique_ident::*; use crate::mail::unique_ident::*;
use crate::user::User; use crate::user::User;
use crate::mail::IMF; use crate::mail::IMF;
use crate::storage;
use crate::timestamp::now_msec;
const INCOMING_PK: &str = "incoming"; const INCOMING_PK: &str = "incoming";
const INCOMING_LOCK_SK: &str = "lock"; const INCOMING_LOCK_SK: &str = "lock";

View file

@ -2,14 +2,15 @@ use anyhow::{anyhow, bail, Result};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tokio::sync::RwLock; use tokio::sync::RwLock;
use crate::bayou::Bayou; use aero_user::cryptoblob::{self, gen_key, open_deserialize, seal_serialize, Key};
use crate::cryptoblob::{self, gen_key, open_deserialize, seal_serialize, Key}; use aero_user::login::Credentials;
use crate::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::uidindex::*;
use crate::mail::unique_ident::*; use crate::mail::unique_ident::*;
use crate::mail::IMF; use crate::mail::IMF;
use crate::storage::{self, BlobRef, BlobVal, RowRef, RowVal, Selector, Store};
use crate::timestamp::now_msec;
pub struct Mailbox { pub struct Mailbox {
pub(super) id: UniqueIdent, pub(super) id: UniqueIdent,

View file

@ -1,5 +1,3 @@
use std::convert::TryFrom;
pub mod incoming; pub mod incoming;
pub mod mailbox; pub mod mailbox;
pub mod query; pub mod query;

View file

@ -1,19 +1,12 @@
use std::collections::{BTreeMap, HashMap}; use std::collections::BTreeMap;
use std::sync::{Arc, Weak};
use anyhow::{anyhow, bail, Result}; use anyhow::{bail, Result};
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tokio::sync::watch;
use crate::cryptoblob::{open_deserialize, seal_serialize}; use aero_bayou::timestamp::now_msec;
use crate::login::Credentials;
use crate::mail::incoming::incoming_mail_watch_process;
use crate::mail::mailbox::Mailbox;
use crate::mail::uidindex::ImapUidvalidity; use crate::mail::uidindex::ImapUidvalidity;
use crate::mail::unique_ident::{gen_ident, UniqueIdent}; use crate::mail::unique_ident::{gen_ident, UniqueIdent};
use crate::storage;
use crate::timestamp::now_msec;
pub const MAILBOX_HIERARCHY_DELIMITER: char = '.'; pub const MAILBOX_HIERARCHY_DELIMITER: char = '.';

View file

@ -3,7 +3,7 @@ use std::num::{NonZeroU32, NonZeroU64};
use im::{HashMap, OrdMap, OrdSet}; use im::{HashMap, OrdMap, OrdSet};
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use crate::bayou::*; use aero_bayou::*;
use crate::mail::unique_ident::UniqueIdent; use crate::mail::unique_ident::UniqueIdent;
pub type ModSeq = NonZeroU64; pub type ModSeq = NonZeroU64;

View file

@ -5,7 +5,7 @@ use lazy_static::lazy_static;
use rand::prelude::*; use rand::prelude::*;
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; 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: /// An internal Mail Identifier is composed of two components:
/// - a process identifier, 128 bits, itself composed of: /// - a process identifier, 128 bits, itself composed of:

View file

@ -1,20 +1,18 @@
use std::collections::{BTreeMap, HashMap}; use std::collections::HashMap;
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use anyhow::{anyhow, bail, Result}; use anyhow::{anyhow, bail, Result};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use tokio::sync::watch; use tokio::sync::watch;
use crate::cryptoblob::{open_deserialize, seal_serialize}; use aero_user::cryptoblob::{open_deserialize, seal_serialize};
use crate::login::Credentials; use aero_user::login::Credentials;
use aero_user::storage;
use crate::mail::incoming::incoming_mail_watch_process; use crate::mail::incoming::incoming_mail_watch_process;
use crate::mail::mailbox::Mailbox; use crate::mail::mailbox::Mailbox;
use crate::mail::uidindex::ImapUidvalidity; use crate::mail::uidindex::ImapUidvalidity;
use crate::mail::unique_ident::{gen_ident, UniqueIdent}; use crate::mail::unique_ident::UniqueIdent;
use crate::storage;
use crate::timestamp::now_msec;
use crate::mail::namespace::{MAILBOX_HIERARCHY_DELIMITER, INBOX, DRAFTS, ARCHIVE, SENT, TRASH, MAILBOX_LIST_PK, MAILBOX_LIST_SK,MailboxList,CreatedMailbox}; 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 //@FIXME User should be totally rewriten