Skip to main content

SessionManagement

Trait SessionManagement 

Source
pub trait SessionManagement {
    // Required methods
    fn start_session(&mut self, name: &str) -> SisterResult<ContextId>;
    fn end_session(&mut self) -> SisterResult<()>;
    fn current_session(&self) -> Option<ContextId>;
    fn current_session_info(&self) -> SisterResult<ContextInfo>;
    fn list_sessions(&self) -> SisterResult<Vec<ContextSummary>>;
    fn export_session(&self, id: ContextId) -> SisterResult<ContextSnapshot>;
    fn import_session(
        &mut self,
        snapshot: ContextSnapshot,
    ) -> SisterResult<ContextId>;

    // Provided methods
    fn start_session_with_metadata(
        &mut self,
        name: &str,
        metadata: Metadata,
    ) -> SisterResult<ContextId> { ... }
    fn get_session_info(&self, id: ContextId) -> SisterResult<ContextInfo> { ... }
}
Expand description

Session management for sisters with append-only sequential sessions.

Used by: Memory (sessions), Vision (sessions), Identity (chains)

Key difference from WorkspaceManagement:

  • Sessions are sequential — you don’t “switch back” to an old session
  • Sessions are append-only — you can’t delete past sessions
  • The current session is always the latest one

NOT used by: Time (stateless), Codebase (uses WorkspaceManagement)

Required Methods§

Source

fn start_session(&mut self, name: &str) -> SisterResult<ContextId>

Start a new session. Returns the session ID. The previous session (if any) is automatically ended

Source

fn end_session(&mut self) -> SisterResult<()>

End the current session. After this, a new session must be started before operations

Source

fn current_session(&self) -> Option<ContextId>

Get the current session ID. Returns None if no session is active

Source

fn current_session_info(&self) -> SisterResult<ContextInfo>

Get info about the current session

Source

fn list_sessions(&self) -> SisterResult<Vec<ContextSummary>>

List all past sessions (most recent first)

Source

fn export_session(&self, id: ContextId) -> SisterResult<ContextSnapshot>

Export a session as a snapshot (for backup/transfer)

Source

fn import_session( &mut self, snapshot: ContextSnapshot, ) -> SisterResult<ContextId>

Import a session from a snapshot

Provided Methods§

Source

fn start_session_with_metadata( &mut self, name: &str, metadata: Metadata, ) -> SisterResult<ContextId>

Start a new session with metadata

Source

fn get_session_info(&self, id: ContextId) -> SisterResult<ContextInfo>

Get info about a specific past session

Implementors§