From 43811a6af9917b3698826827f9b79b39f48ee173 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Thu, 4 Nov 2021 06:30:35 -0500 Subject: [PATCH] Start some docs --- daemon/Cargo.toml | 2 +- daemon/src/mail/event.rs | 2 -- daemon/src/mail/mod.rs | 6 ++++-- daemon/src/mail/sessions.rs | 1 + docs/.gitignore | 1 + docs/SUMMARY.md | 11 +++++++++++ docs/book.toml | 6 ++++++ docs/daemon/api.md | 33 +++++++++++++++++++++++++++++++++ docs/daemon/hooks.md | 1 + docs/daemon/index.md | 21 +++++++++++++++++++++ docs/front.md | 3 +++ 11 files changed, 82 insertions(+), 5 deletions(-) delete mode 100644 daemon/src/mail/event.rs create mode 100644 daemon/src/mail/sessions.rs create mode 100644 docs/.gitignore create mode 100644 docs/SUMMARY.md create mode 100644 docs/book.toml create mode 100644 docs/daemon/api.md create mode 100644 docs/daemon/hooks.md create mode 100644 docs/daemon/index.md create mode 100644 docs/front.md diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index cc2dc94..ca1b506 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -19,6 +19,7 @@ log = "0.4.14" panorama-imap = { path = "../imap" } panorama-smtp = { path = "../smtp" } serde = { version = "1.0.130", features = ["derive"] } +session_types = "0.3.1" stderrlog = "0.5.1" tokio = { version = "1.13.0", features = ["full"] } tokio-rustls = "0.23.1" @@ -26,7 +27,6 @@ toml = "0.5.8" xdg = "2.4.0" notify = { version = "5.0.0-pre.13", optional = true } -session_types = "0.3.1" [dependencies.sqlx] version = "0.5.9" diff --git a/daemon/src/mail/event.rs b/daemon/src/mail/event.rs deleted file mode 100644 index 0a05f2c..0000000 --- a/daemon/src/mail/event.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[derive(Debug)] -pub enum MailEvent {} diff --git a/daemon/src/mail/mod.rs b/daemon/src/mail/mod.rs index dfabc59..f2e054a 100644 --- a/daemon/src/mail/mod.rs +++ b/daemon/src/mail/mod.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -mod event; +mod sessions; mod store; use anyhow::{Context, Result}; @@ -18,7 +18,9 @@ use tokio::sync::mpsc::UnboundedSender; use crate::config::{MailAccountConfig, TlsMethod}; -pub use self::event::MailEvent; +// pub use self::event::MailEvent; +#[derive(Debug)] +pub struct MailEvent; pub use self::store::MailStore; static MIGRATOR: Migrator = sqlx::migrate!(); diff --git a/daemon/src/mail/sessions.rs b/daemon/src/mail/sessions.rs new file mode 100644 index 0000000..3567c0f --- /dev/null +++ b/daemon/src/mail/sessions.rs @@ -0,0 +1 @@ +// TODO: figure out what sessions I actually want diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..7585238 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +book diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md new file mode 100644 index 0000000..957ba56 --- /dev/null +++ b/docs/SUMMARY.md @@ -0,0 +1,11 @@ +# Summary + +- [Front](./front.md) + +--- + +# Daemon + +- [Daemon](./daemon/index.md) +- [API](./daemon/api.md) +- [Hooks](./daemon/hooks.md) diff --git a/docs/book.toml b/docs/book.toml new file mode 100644 index 0000000..6d1183c --- /dev/null +++ b/docs/book.toml @@ -0,0 +1,6 @@ +[book] +authors = ["Michael Zhang"] +language = "en" +multilingual = false +src = "." +title = "panorama" diff --git a/docs/daemon/api.md b/docs/daemon/api.md new file mode 100644 index 0000000..f3e23b9 --- /dev/null +++ b/docs/daemon/api.md @@ -0,0 +1,33 @@ +# Daemon API + +To communicate with the daemon start by connecting to the socket it exposes. +This opens a long-lasting connection that can be used to send RPC messages. The +following messages are planned: + +#### `mail::listen-receive` + +``` +(account : Option) -> Stream +``` + +Begin subscribing to when mail is received for a particular account if provided, +or all accounts by default. + +#### `mail::send` + +``` +(message : SendMessage) -> Result<()> +``` + +Send an email. If the send fails the result is returned immediately without +retry. + +TODO: send with retry? + +#### `mail::search` + +``` +(query : StructuredQuery) -> Result +``` + +Search for messages, returns a summary of messages + first sentence. diff --git a/docs/daemon/hooks.md b/docs/daemon/hooks.md new file mode 100644 index 0000000..744f34e --- /dev/null +++ b/docs/daemon/hooks.md @@ -0,0 +1 @@ +# Hooks diff --git a/docs/daemon/index.md b/docs/daemon/index.md new file mode 100644 index 0000000..1245f98 --- /dev/null +++ b/docs/daemon/index.md @@ -0,0 +1,21 @@ +# Daemon + +The panorama daemon runs locally and serves as the primary controller of all of +panorama's functions. Since it needs to be ready to listen for clients at any +time, it should remain running in the background. + +Planned functionality: + +- Email + - Synchronizes with mail servers, aggregating a local database of messages. + - Build a comprehensive and full-text search index over all local messages. + - Send email by communicating with SMTP servers. +- Calendar + - Import ical files. + - Send reminders to various outputs. + +Stretch goals: + +- Email + - Expose a JMAP API, allowing other clients to connect to it. + - Massively configurable hooks. diff --git a/docs/front.md b/docs/front.md new file mode 100644 index 0000000..248822b --- /dev/null +++ b/docs/front.md @@ -0,0 +1,3 @@ +# Front + +