Skip to main content

SessionRepo

Trait SessionRepo 

Source
pub trait SessionRepo {
    // Required methods
    fn list(
        &self,
        session_dir: &Path,
        filter_cwd: Option<&Path>,
        progress: Option<&dyn Fn(usize, usize)>,
    ) -> Vec<SessionInfo>;
    fn list_all(
        &self,
        progress: Option<&dyn Fn(usize, usize)>,
    ) -> Vec<SessionInfo>;
    fn delete(&self, path: &Path) -> Result<()>;
    fn fork(
        &self,
        source_path: &Path,
        target_dir: &Path,
        entry_id: Option<&str>,
        position: Option<&str>,
    ) -> Result<String>;
    fn load_info(&self, path: &Path) -> Option<SessionInfo>;
}
Expand description

Session lifecycle management: create, open, list, delete, fork.

Default implementation uses JSONL files on disk.

Required Methods§

Source

fn list( &self, session_dir: &Path, filter_cwd: Option<&Path>, progress: Option<&dyn Fn(usize, usize)>, ) -> Vec<SessionInfo>

List sessions in a directory, optionally filtered by cwd. progress receives (loaded_count, total_count) for UI updates.

Source

fn list_all(&self, progress: Option<&dyn Fn(usize, usize)>) -> Vec<SessionInfo>

List sessions across all project directories under ~/.rab/sessions/.

Source

fn delete(&self, path: &Path) -> Result<()>

Delete a session file.

Source

fn fork( &self, source_path: &Path, target_dir: &Path, entry_id: Option<&str>, position: Option<&str>, ) -> Result<String>

Fork a session: create a new session file containing entries up to (and including) the given entry_id, or all entries if entry_id is None.

Source

fn load_info(&self, path: &Path) -> Option<SessionInfo>

Load metadata for a single session file.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§