HistoryStore

Struct HistoryStore 

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

Manages history persistence to disk

Implementations§

Source§

impl HistoryStore

Source

pub fn new(storage_path: impl AsRef<Path>) -> Result<Self, UndoRedoError>

Create a new history store with the given storage path

Source

pub fn save_history( &mut self, snapshot: HistorySnapshot, ) -> Result<(), UndoRedoError>

Save history to disk with retry logic

Source

pub fn load_history(&mut self) -> Result<HistorySnapshot, UndoRedoError>

Load history from disk with fallback to empty history

Source

pub fn cleanup_old_entries( &mut self, retention_days: i64, ) -> Result<(), UndoRedoError>

Clean up entries older than the specified number of days

Source

pub fn get_storage_stats(&self) -> Result<StorageStats, UndoRedoError>

Get storage statistics

Source

pub fn is_storage_full(&self) -> Result<bool, UndoRedoError>

Check if storage is full (exceeds 1GB limit)

Source

pub fn handle_storage_full(&self) -> Result<(), UndoRedoError>

Handle storage full gracefully by logging warning

Source

pub fn get_history_data(&self) -> Option<HistorySnapshot>

Get the current history data

Source

pub fn set_history_data(&mut self, snapshot: HistorySnapshot)

Set the history data

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, 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.