pub struct StorageManager { /* private fields */ }Expand description
High-level storage manager that provides transactional operations and automatic file modification tracking
Implementations§
Source§impl StorageManager
impl StorageManager
Sourcepub fn load_with_tracking(&mut self, date: Date) -> Result<DayData>
pub fn load_with_tracking(&mut self, date: Date) -> Result<DayData>
Load day data with automatic file modification tracking Returns the loaded data and updates internal tracking
Sourcepub fn check_and_reload(&mut self, date: Date) -> Result<Option<DayData>>
pub fn check_and_reload(&mut self, date: Date) -> Result<Option<DayData>>
Check if file has been modified externally and reload if needed Returns Some(DayData) if file was modified and reloaded, None if no change
Sourcepub fn add_record(&mut self, date: Date, record: WorkRecord) -> Result<()>
pub fn add_record(&mut self, date: Date, record: WorkRecord) -> Result<()>
Add a new work record (transactional: load → add → save → track)
Sourcepub fn update_record(&mut self, date: Date, record: WorkRecord) -> Result<()>
pub fn update_record(&mut self, date: Date, record: WorkRecord) -> Result<()>
Update an existing work record (transactional: load → update → save → track)
Sourcepub fn remove_record(&mut self, date: Date, id: u32) -> Result<WorkRecord>
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
Sourcepub fn get_last_modified(&self, date: &Date) -> Option<SystemTime>
pub fn get_last_modified(&self, date: &Date) -> Option<SystemTime>
Get the last known modification time for a date
Sourcepub fn save_active_timer(&self, timer: &TimerState) -> Result<()>
pub fn save_active_timer(&self, timer: &TimerState) -> Result<()>
Pass-through methods for timer operations (these don’t need tracking)
pub fn load_active_timer(&self) -> Result<Option<TimerState>>
pub fn clear_active_timer(&self) -> Result<()>
Sourcepub fn start_timer(
&self,
task_name: String,
description: Option<String>,
source_record_id: Option<u32>,
source_record_date: Option<Date>,
) -> Result<TimerState>
pub fn start_timer( &self, task_name: String, description: Option<String>, source_record_id: Option<u32>, source_record_date: Option<Date>, ) -> Result<TimerState>
Start a new timer with the given task name and optional description
Sourcepub fn stop_timer(&self) -> Result<WorkRecord>
pub fn stop_timer(&self) -> Result<WorkRecord>
Stop the active timer and return the work record
Sourcepub fn pause_timer(&self) -> Result<TimerState>
pub fn pause_timer(&self) -> Result<TimerState>
Pause the active timer
Sourcepub fn resume_timer(&self) -> Result<TimerState>
pub fn resume_timer(&self) -> Result<TimerState>
Resume a paused timer
Sourcepub fn get_timer_elapsed(&self, timer: &TimerState) -> Duration
pub fn get_timer_elapsed(&self, timer: &TimerState) -> Duration
Get elapsed duration for a timer
Auto Trait Implementations§
impl Freeze for StorageManager
impl RefUnwindSafe for StorageManager
impl Send for StorageManager
impl Sync for StorageManager
impl Unpin for StorageManager
impl UnwindSafe for StorageManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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