Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }

Implementations§

Source§

impl Store

Source

pub fn migrations() -> Migrations<'static>

Source

pub fn open(path: &Path) -> Result<Store, StoreError>

Source

pub fn open_account(paths: &Paths, account: &str) -> Result<Store, StoreError>

The account’s store, in its private directory.

Source

pub fn open_in_memory() -> Result<Store, StoreError>

Source

pub fn transaction<T, E: From<StoreError>>( &self, f: impl FnOnce() -> Result<T, E>, ) -> Result<T, E>

Runs f in one transaction; any error rolls back everything f wrote.

Source

pub fn folders(&self) -> Result<Vec<Folder>, StoreError>

Source

pub fn folder(&self, name: &str) -> Result<Option<Folder>, StoreError>

Source

pub fn upsert_folder(&self, folder: &Folder) -> Result<(), StoreError>

Source

pub fn initial_uid_next(&self, folder: &str) -> Result<u32, StoreError>

One above the highest uid already on the server when folder was first tracked; 0 when unknown.

Source

pub fn set_initial_uid_next( &self, folder: &str, uid_next: u32, ) -> Result<(), StoreError>

Source

pub fn rules_uid(&self, folder: &str) -> Result<u32, StoreError>

The highest uid the rules have evaluated in folder; above it mail is fresh. 0 when unknown.

Source

pub fn set_rules_uid(&self, folder: &str, uid: u32) -> Result<(), StoreError>

Source

pub fn notified_uid(&self, folder: &str) -> Result<u32, StoreError>

The highest uid new-mail notifications have covered in folder; 0 when unknown.

Source

pub fn set_notified_uid(&self, folder: &str, uid: u32) -> Result<(), StoreError>

Source

pub fn flags_synced(&self, folder: &str) -> Result<(u64, i64), StoreError>

The HIGHESTMODSEQ (0 when unknown) and Unix time at which folder’s flags were last fully up to date.

Source

pub fn set_flags_synced( &self, folder: &str, highest_modseq: u64, at: i64, ) -> Result<(), StoreError>

Source

pub fn reset_folder( &self, name: &str, uidvalidity: u32, ) -> Result<(), StoreError>

Source

pub fn remove_folder(&self, name: &str) -> Result<(), StoreError>

Removes the folder with its messages and its rule and notification state.

Source

pub fn insert_message(&self, m: &Message) -> Result<(), StoreError>

Source

pub fn update_flags( &self, folder: &str, uid: u32, flags: &str, ) -> Result<(), StoreError>

Source

pub fn remove_message(&self, folder: &str, uid: u32) -> Result<(), StoreError>

Source

pub fn remove_missing( &self, folder: &str, upto_uid: u32, present: &[u32], ) -> Result<usize, StoreError>

Removes rows with uid <= upto_uid whose uid is not in present.

Source

pub fn messages( &self, folder: &str, limit: u32, filter: Filter, ) -> Result<Vec<Message>, StoreError>

Source

pub fn threads( &self, folder: &str, limit: u32, filter: Filter, ) -> Result<Vec<Vec<Message>>, StoreError>

Threads in folder with a member filter keeps, the most recently active first; each thread’s messages oldest first.

Source

pub fn thread_summaries( &self, folder: &str, limit: u32, filter: Filter, ) -> Result<Vec<ThreadSummary>, StoreError>

One row per thread in folder with a member filter keeps, the most recently active first. With exactly one MAX() in the query, SQLite fills the bare columns from the row holding it: the thread’s latest message. A second MAX() anywhere breaks that.

Source

pub fn thread_members( &self, folder: &str, thread_id: &str, ) -> Result<Vec<MessageSummary>, StoreError>

Source

pub fn messages_in_folder( &self, folder: &str, ) -> Result<Vec<Message>, StoreError>

Source

pub fn messages_without_body( &self, folder: &str, ) -> Result<Vec<Message>, StoreError>

The messages in folder whose body is not downloaded yet, by uid.

Source

pub fn lacks_bodies(&self, folder: Option<&str>) -> Result<bool, StoreError>

Whether any message in folder, or in any folder, lacks its body.

Source

pub fn search( &self, query: &str, folder: Option<&str>, limit: u32, ) -> Result<Vec<Message>, StoreError>

FTS5 search, newest first. A query FTS5 cannot parse, such as a bare email address, is retried with every word quoted.

Source

pub fn search_headers( &self, query: &str, folder: Option<&str>, limit: u32, ) -> Result<Vec<Message>, StoreError>

Search over subject and addresses only; every word is quoted, because FTS5 syntax could escape the column filter.

Source

pub fn message( &self, folder: &str, uid: u32, ) -> Result<Option<Message>, StoreError>

Source

pub fn raw(&self, folder: &str, uid: u32) -> Result<Option<Vec<u8>>, StoreError>

Source

pub fn set_raw( &self, folder: &str, uid: u32, raw: &[u8], body_text: &str, ) -> Result<(), StoreError>

Source

pub fn rule_first_seen( &self, name: &str, definition: &str, now: i64, ) -> Result<i64, StoreError>

Returns when the rule was first seen with this definition, starting its clock at now if it is new or changed.

Source

pub fn restart_rule_clock(&self, name: &str, now: i64) -> Result<(), StoreError>

Starts the rule’s clock at now, replacing any stale first-seen time; the next load adopts its definition.

Source

pub fn mark_rules_seen_except( &self, except: &[String], ) -> Result<(), StoreError>

Moves rules_uid up to last_uid in every folder not in except, so their mail stops counting as fresh.

Source

pub fn forget_rules_except(&self, names: &[&str]) -> Result<(), StoreError>

Drops first-seen times of rules no longer in the file, so a re-added rule starts fresh instead of acting on history.

Source

pub fn log_action(&self, entry: &LogEntry) -> Result<(), StoreError>

Source

pub fn log(&self, limit: u32) -> Result<Vec<LogEntry>, StoreError>

Source

pub fn message_count(&self, folder: &str) -> Result<u32, StoreError>

Source

pub fn unread_count(&self, folder: &str) -> Result<u32, StoreError>

Source

pub fn unread_uids(&self, folder: &str) -> Result<Vec<u32>, StoreError>

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl !Sync for Store

§

impl !UnwindSafe for Store

§

impl Send for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more