Skip to main content

StorageManager

Struct StorageManager 

Source
pub struct StorageManager { /* private fields */ }
Expand description

High-level storage manager that provides transactional operations and automatic external modification tracking.

Implementations§

Source§

impl StorageManager

Source

pub fn new() -> Result<Self>

Create a new StorageManager

Source

pub fn load_with_tracking(&mut self, date: Date) -> Result<DayData>

Load day data with automatic revision tracking

Source

pub fn check_and_reload(&mut self, date: Date) -> Result<Option<DayData>>

Check if day data changed externally and reload if needed. Returns Some(DayData) if data was modified and reloaded, None if no change.

Source

pub fn add_record(&mut self, date: Date, record: WorkRecord) -> Result<()>

Add a new work record (transactional: load -> add -> save -> track)

Source

pub fn update_record(&mut self, date: Date, record: WorkRecord) -> Result<()>

Update an existing work record (transactional: load -> update -> save -> track)

Source

pub fn remove_record(&mut self, date: Date, id: u32) -> Result<WorkRecord>

Remove a work record by ID (transactional: load -> remove -> save -> track) Returns the removed record if found.

Source

pub fn save(&mut self, day_data: &DayData) -> Result<()>

Save day data and update tracking

Source

pub fn get_last_modified(&self, date: &Date) -> Option<SystemTime>

Get the last known modification token for a date

Source

pub fn save_active_timer(&self, timer: &TimerState) -> Result<()>

Source

pub fn load_active_timer(&self) -> Result<Option<TimerState>>

Source

pub fn clear_active_timer(&self) -> Result<()>

Source

pub fn start_timer( &self, task_name: String, description: Option<String>, project: Option<String>, customer: Option<String>, source_record_id: Option<u32>, source_record_date: Option<Date>, ) -> Result<TimerState>

Source

pub fn stop_timer(&self) -> Result<WorkRecord>

Source

pub fn pause_timer(&self) -> Result<TimerState>

Source

pub fn resume_timer(&self) -> Result<TimerState>

Source

pub fn get_timer_elapsed(&self, timer: &TimerState) -> Duration

Auto Trait Implementations§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.