Skip to main content

Store

Struct Store 

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

Implementations§

Source§

impl Store

Source

pub fn new(storage_dir: impl Into<PathBuf>) -> Self

Source

pub fn find_file(&self, date: NaiveDate) -> Option<PathBuf>

First .mps file matching date, or None.

Source

pub fn find_files(&self, date: NaiveDate) -> Vec<PathBuf>

All .mps files matching date (handles multiple files per day).

Source

pub fn find_or_create_path(&self, date: NaiveDate) -> PathBuf

Existing file for date, or a generated new path (file not yet created).

Source

pub fn parse_date( &self, date: NaiveDate, ) -> Result<IndexMap<String, Element>, MpsError>

Parsed elements for date. Returns empty map if no file exists.

Source

pub fn append( &self, kind: &str, body: &str, tags: &[String], attrs: &[(&str, &str)], date: NaiveDate, ) -> Result<PathBuf, MpsError>

Append a new element to date’s file (creates file if absent).

Source

pub fn all_files(&self) -> Result<Vec<PathBuf>, MpsError>

All .mps files in storage_dir, sorted by filename (chronological).

Source

pub fn files_since( &self, since_date: NaiveDate, ) -> Result<Vec<PathBuf>, MpsError>

Files whose date-stamp >= since_date.

Source

pub fn all_file_dates(&self) -> Result<Vec<NaiveDate>, MpsError>

Unique sorted dates for which .mps files exist.

Source

pub fn rewrite_element( &self, ref_str: &str, new_attrs: &HashMap<String, String>, date: NaiveDate, ) -> Result<bool, MpsError>

Rewrite an element’s typed attributes in-place, atomically.

ref_str may be an epoch ref (e.g. “20260428.1”) or a human ref (e.g. “task-1”). Human refs are resolved against date (defaults to today in the caller). new_attrs maps attribute name → new value (e.g. {“status” → “done”}).

Returns true on success, false if ref not found or file unchanged.

Source

pub fn search( &self, query: &str, type_filter: Option<&str>, tag_filter: Option<&str>, since_date: Option<NaiveDate>, ) -> Result<Vec<SearchResult>, MpsError>

Full-text search across files. Returns matched elements with file and date_str.

Auto Trait Implementations§

§

impl Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe 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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.