StorageManager

Struct StorageManager 

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

Manages storage lifecycle including cleanup and size limits

Implementations§

Source§

impl StorageManager

Source

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

Create a new storage manager

Source

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

Create a new storage manager with default settings (30 days retention, 1GB limit)

Source

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

Perform automatic cleanup on session start

Source

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

Perform automatic cleanup on session end

Source

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

Enforce storage size limit by removing oldest entries

Source

pub fn get_store(&self) -> &HistoryStore

Get the underlying history store

Source

pub fn get_store_mut(&mut self) -> &mut HistoryStore

Get the underlying history store mutably

Source

pub fn set_retention_days(&mut self, days: i64)

Set retention days

Source

pub fn set_max_storage_bytes(&mut self, bytes: u64)

Set maximum storage bytes

Source

pub fn get_retention_days(&self) -> i64

Get retention days

Source

pub fn get_max_storage_bytes(&self) -> u64

Get maximum storage bytes

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.