pub struct StorageManager { /* private fields */ }Expand description
Manages storage lifecycle including cleanup and size limits
Implementations§
Source§impl StorageManager
impl StorageManager
Sourcepub fn new(
storage_path: impl AsRef<Path>,
retention_days: i64,
max_storage_bytes: u64,
) -> Result<Self, UndoRedoError>
pub fn new( storage_path: impl AsRef<Path>, retention_days: i64, max_storage_bytes: u64, ) -> Result<Self, UndoRedoError>
Create a new storage manager
Sourcepub fn with_defaults(
storage_path: impl AsRef<Path>,
) -> Result<Self, UndoRedoError>
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)
Sourcepub fn cleanup_on_session_start(&mut self) -> Result<(), UndoRedoError>
pub fn cleanup_on_session_start(&mut self) -> Result<(), UndoRedoError>
Perform automatic cleanup on session start
Sourcepub fn cleanup_on_session_end(&mut self) -> Result<(), UndoRedoError>
pub fn cleanup_on_session_end(&mut self) -> Result<(), UndoRedoError>
Perform automatic cleanup on session end
Sourcepub fn enforce_storage_limit(&mut self) -> Result<(), UndoRedoError>
pub fn enforce_storage_limit(&mut self) -> Result<(), UndoRedoError>
Enforce storage size limit by removing oldest entries
Sourcepub fn get_store(&self) -> &HistoryStore
pub fn get_store(&self) -> &HistoryStore
Get the underlying history store
Sourcepub fn get_store_mut(&mut self) -> &mut HistoryStore
pub fn get_store_mut(&mut self) -> &mut HistoryStore
Get the underlying history store mutably
Sourcepub fn set_retention_days(&mut self, days: i64)
pub fn set_retention_days(&mut self, days: i64)
Set retention days
Sourcepub fn set_max_storage_bytes(&mut self, bytes: u64)
pub fn set_max_storage_bytes(&mut self, bytes: u64)
Set maximum storage bytes
Sourcepub fn get_retention_days(&self) -> i64
pub fn get_retention_days(&self) -> i64
Get retention days
Sourcepub fn get_max_storage_bytes(&self) -> u64
pub fn get_max_storage_bytes(&self) -> u64
Get maximum storage bytes
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
Mutably borrows from an owned value. Read more