pub struct SessionStore { /* private fields */ }Expand description
Manages session persistence to disk
Implementations§
Source§impl SessionStore
impl SessionStore
Sourcepub fn new() -> SessionResult<Self>
pub fn new() -> SessionResult<Self>
Create a new session store with default directories
Sourcepub fn with_dirs(
sessions_dir: PathBuf,
archive_dir: PathBuf,
) -> SessionResult<Self>
pub fn with_dirs( sessions_dir: PathBuf, archive_dir: PathBuf, ) -> SessionResult<Self>
Create a session store with custom directories (for testing)
Sourcepub async fn save(&self, session: &Session) -> SessionResult<()>
pub async fn save(&self, session: &Session) -> SessionResult<()>
Save a session to disk
Sourcepub async fn load(&self, session_id: &str) -> SessionResult<Session>
pub async fn load(&self, session_id: &str) -> SessionResult<Session>
Load a session from disk
Sourcepub async fn list(&self) -> SessionResult<Vec<Session>>
pub async fn list(&self) -> SessionResult<Vec<Session>>
List all persisted sessions
Sourcepub async fn export(
&self,
session_id: &str,
export_path: &Path,
) -> SessionResult<()>
pub async fn export( &self, session_id: &str, export_path: &Path, ) -> SessionResult<()>
Export a session to a user-specified file
Sourcepub async fn delete(&self, session_id: &str) -> SessionResult<()>
pub async fn delete(&self, session_id: &str) -> SessionResult<()>
Delete a session and archive it
Sourcepub fn sessions_dir(&self) -> &Path
pub fn sessions_dir(&self) -> &Path
Get the sessions directory path
Sourcepub fn archive_dir(&self) -> &Path
pub fn archive_dir(&self) -> &Path
Get the archive directory path
Trait Implementations§
Source§impl Clone for SessionStore
impl Clone for SessionStore
Source§fn clone(&self) -> SessionStore
fn clone(&self) -> SessionStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionStore
impl Debug for SessionStore
Auto Trait Implementations§
impl Freeze for SessionStore
impl RefUnwindSafe for SessionStore
impl Send for SessionStore
impl Sync for SessionStore
impl Unpin for SessionStore
impl UnwindSafe for SessionStore
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