Compare commits

..

No commits in common. "9fbfa378bba3b8bec39f0f5223a4648ec23e4c70" and "416d82042f2445609b792a02325920eef2e32e9c" have entirely different histories.

10 changed files with 232 additions and 572 deletions

759
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[package]
name = "notmuch"
version = "0.0.60"
version = "0.0.59"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "procmail2notmuch"
version = "0.0.60"
version = "0.0.59"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,6 +1,6 @@
[package]
name = "server"
version = "0.0.60"
version = "0.0.59"
edition = "2021"
default-run = "server"
@ -15,6 +15,7 @@ async-trait = "0.1.81"
build-info = "0.0.38"
cacher = {git = "http://git-private.h.xinu.tv/wathiede/cacher.git"}
css-inline = "0.13.0"
glog = "0.1.0"
html-escape = "0.2.13"
linkify = "0.10.0"
log = "0.4.17"
@ -34,11 +35,8 @@ sqlx = { version = "0.7.4", features = ["postgres", "runtime-tokio", "time"] }
tantivy = "0.22.0"
thiserror = "1.0.37"
tokio = "1.26.0"
tracing = "0.1.41"
url = "2.5.2"
urlencoding = "2.1.3"
#xtracing = { path = "../../xtracing" }
xtracing = { git = "http://git-private.h.xinu.tv/wathiede/xtracing.git" }
[build-dependencies]
build-info-build = "0.0.38"

View File

@ -7,6 +7,7 @@ use std::{error::Error, io::Cursor, str::FromStr};
use async_graphql::{http::GraphiQLSource, EmptySubscription, Schema};
use async_graphql_rocket::{GraphQLQuery, GraphQLRequest, GraphQLResponse};
use glog::Flags;
use notmuch::{Notmuch, NotmuchError, ThreadSet};
use rocket::{
fairing::AdHoc,
@ -175,7 +176,14 @@ async fn graphql_request(
#[rocket::main]
async fn main() -> Result<(), Box<dyn Error>> {
let _guard = xtracing::init(env!("CARGO_BIN_NAME"))?;
glog::new()
.init(Flags {
colorlogtostderr: true,
//alsologtostderr: true, // use logtostderr to only write to stderr and not to files
logtostderr: true,
..Default::default()
})
.unwrap();
build_info::build_info!(fn bi);
info!("Build Info: {}", shared::build_version(bi));
let allowed_origins = AllowedOrigins::all();

View File

@ -9,7 +9,6 @@ use log::info;
use notmuch::Notmuch;
use serde::{Deserialize, Serialize};
use sqlx::postgres::PgPool;
use tracing::instrument;
use crate::{config::Config, newsreader, nm, tantivy::TantivyConnection, Query};
@ -270,7 +269,6 @@ impl QueryRoot {
build_info::build_info!(fn bi);
Ok(shared::build_version(bi))
}
#[instrument(skip_all, fields(query=query))]
async fn count<'ctx>(&self, ctx: &Context<'ctx>, query: String) -> Result<usize, Error> {
let nm = ctx.data_unchecked::<Notmuch>();
let pool = ctx.data_unchecked::<PgPool>();
@ -286,7 +284,6 @@ impl QueryRoot {
Ok(total)
}
#[instrument(skip_all, fields(query=query))]
async fn search<'ctx>(
&self,
ctx: &Context<'ctx>,
@ -421,7 +418,6 @@ impl QueryRoot {
.await?)
}
#[instrument(skip_all)]
async fn tags<'ctx>(&self, ctx: &Context<'ctx>) -> FieldResult<Vec<Tag>> {
let nm = ctx.data_unchecked::<Notmuch>();
let pool = ctx.data_unchecked::<PgPool>();
@ -430,7 +426,6 @@ impl QueryRoot {
tags.append(&mut nm::tags(nm, needs_unread)?);
Ok(tags)
}
#[instrument(skip_all, fields(thread_id=thread_id))]
async fn thread<'ctx>(&self, ctx: &Context<'ctx>, thread_id: String) -> Result<Thread, Error> {
let nm = ctx.data_unchecked::<Notmuch>();
let pool = ctx.data_unchecked::<PgPool>();
@ -505,7 +500,6 @@ async fn tantivy_search(
pub struct Mutation;
#[Object]
impl Mutation {
#[instrument(skip_all, fields(query, bool))]
async fn set_read_status<'ctx>(
&self,
ctx: &Context<'ctx>,
@ -522,7 +516,6 @@ impl Mutation {
nm::set_read_status(nm, &query, unread).await?;
Ok(true)
}
#[instrument(skip_all, fields(query, tag))]
async fn tag_add<'ctx>(
&self,
ctx: &Context<'ctx>,
@ -534,7 +527,6 @@ impl Mutation {
nm.tag_add(&tag, &query)?;
Ok(true)
}
#[instrument(skip_all, fields(query, tag))]
async fn tag_remove<'ctx>(
&self,
ctx: &Context<'ctx>,
@ -556,7 +548,6 @@ impl Mutation {
Ok(true)
}
#[instrument(skip_all)]
async fn refresh<'ctx>(&self, ctx: &Context<'ctx>) -> Result<bool, Error> {
let nm = ctx.data_unchecked::<Notmuch>();
let tantivy = ctx.data_unchecked::<TantivyConnection>();

View File

@ -9,7 +9,6 @@ use log::{error, info, warn};
use mailparse::{parse_content_type, parse_mail, MailHeader, MailHeaderMap, ParsedMail};
use memmap::MmapOptions;
use notmuch::Notmuch;
use tracing::instrument;
use crate::{
compute_offset_limit,
@ -49,7 +48,6 @@ pub fn threadset_to_messages(thread_set: notmuch::ThreadSet) -> Result<Vec<Messa
Ok(Vec::new())
}
#[instrument(name="nm::count", skip_all, fields(query=?query))]
pub async fn count(nm: &Notmuch, query: &Query) -> Result<usize, ServerError> {
if !is_notmuch_query(query) {
return Ok(0);
@ -58,7 +56,6 @@ pub async fn count(nm: &Notmuch, query: &Query) -> Result<usize, ServerError> {
Ok(nm.count(&query)?)
}
#[instrument(name="nm::search", skip_all, fields(query=?query))]
pub async fn search(
nm: &Notmuch,
after: Option<i32>,
@ -102,7 +99,6 @@ pub async fn search(
.collect())
}
#[instrument(name="nm::tags", skip_all, fields(needs_unread=needs_unread))]
pub fn tags(nm: &Notmuch, needs_unread: bool) -> Result<Vec<Tag>, ServerError> {
let now = Instant::now();
let unread_msg_cnt: HashMap<String, usize> = if needs_unread {
@ -144,7 +140,6 @@ pub fn tags(nm: &Notmuch, needs_unread: bool) -> Result<Vec<Tag>, ServerError> {
Ok(tags)
}
#[instrument(name="nm::thread", skip_all, fields(thread_id=thread_id))]
pub async fn thread(
nm: &Notmuch,
thread_id: String,
@ -856,7 +851,6 @@ fn render_content_type_tree(m: &ParsedMail) -> String {
)
}
#[instrument(name="nm::set_read_status", skip_all, fields(query=?query, unread=unread))]
pub async fn set_read_status<'ctx>(
nm: &Notmuch,
query: &Query,

View File

@ -9,7 +9,6 @@ use tantivy::{
schema::{Facet, IndexRecordOption, Value},
DocAddress, Index, Searcher, TantivyDocument, TantivyError, Term,
};
use tracing::instrument;
use crate::{
compute_offset_limit,
@ -43,7 +42,6 @@ impl TantivyConnection {
db_path: tantivy_db_path.to_string(),
})
}
#[instrument(name = "tantivy::refresh", skip_all)]
pub async fn refresh(&self, pool: &PgPool) -> Result<(), ServerError> {
let start_time = std::time::Instant::now();
let p_uids: Vec<_> = sqlx::query_file!("sql/all-uids.sql")
@ -169,7 +167,6 @@ impl TantivyConnection {
index_writer.commit()?;
Ok(())
}
#[instrument(name = "tantivy::reindex_thread", skip_all, fields(query=?query))]
pub async fn reindex_thread(&self, pool: &PgPool, query: &Query) -> Result<(), ServerError> {
let uids: Vec<_> = query
.uids
@ -179,7 +176,6 @@ impl TantivyConnection {
.collect();
Ok(self.reindex_uids(pool, &uids).await?)
}
#[instrument(name = "tantivy::reindex_all", skip_all)]
pub async fn reindex_all(&self, pool: &PgPool) -> Result<(), ServerError> {
let rows = sqlx::query_file!("sql/all-posts.sql")
.fetch_all(pool)
@ -228,7 +224,6 @@ impl TantivyConnection {
Ok((searcher, Box::new(search_query)))
}
#[instrument(name="tantivy::count", skip_all, fields(query=?query))]
pub async fn count(&self, query: &Query) -> Result<usize, ServerError> {
if !is_tantivy_query(query) {
return Ok(0);
@ -238,7 +233,6 @@ impl TantivyConnection {
let (searcher, query) = self.searcher_and_query(&query)?;
Ok(searcher.search(&query, &Count)?)
}
#[instrument(name="tantivy::search", skip_all, fields(query=?query))]
pub async fn search(
&self,
pool: &PgPool,

View File

@ -1,6 +1,6 @@
[package]
name = "shared"
version = "0.0.60"
version = "0.0.59"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,5 +1,5 @@
[package]
version = "0.0.60"
version = "0.0.59"
name = "letterbox"
repository = "https://github.com/seed-rs/seed-quickstart"
authors = ["Bill Thiede <git@xinu.tv>"]