pub struct SessionStoreV2 { /* private fields */ }Implementations§
Source§impl SessionStoreV2
impl SessionStoreV2
pub async fn new(bamboo_home_dir: PathBuf) -> Result<Self>
pub fn search_index(&self) -> &SessionSearchIndex
pub fn bamboo_home_dir(&self) -> &Path
pub fn index_path(&self) -> &Path
pub async fn rebuild_search_index(&self) -> Result<()>
pub fn sessions_root_dir(&self) -> &Path
pub async fn list_index_entries(&self) -> Vec<SessionIndexEntry>
pub async fn get_index_entry( &self, session_id: &str, ) -> Option<SessionIndexEntry>
pub async fn resolve_rel_path(&self, session_id: &str) -> Option<String>
Sourcepub async fn migrate_runtime_sidecars(&self) -> Result<usize>
pub async fn migrate_runtime_sidecars(&self) -> Result<usize>
One-shot migration: create the runtime sidecar (runtime.json) for every
existing session that predates the message/control-plane split.
Loading already tolerates a missing sidecar (it falls back to the embedded
control-plane in session.json), so this is an optimization migration,
not a correctness one — but running it once means the fast runtime-save
path is in effect immediately for legacy sessions, and the denormalized
children id vectors (now #[serde(skip)]) drop out of the sidecar.
Idempotent and cheap on later boots: guarded by a marker file, and any session that already has a sidecar is skipped. Returns the number of sidecars created.
pub async fn write_image_attachment( &self, session: &Session, raw_base64_or_data_url: &str, mime_hint: Option<&str>, ) -> Result<(String, String)>
Sourcepub async fn read_attachment(
&self,
session_id: &str,
attachment_id: &str,
) -> Result<Option<(Vec<u8>, String)>>
pub async fn read_attachment( &self, session_id: &str, attachment_id: &str, ) -> Result<Option<(Vec<u8>, String)>>
Read an attachment by id, returning bytes + inferred MIME.
pub async fn clear_session(&self, session_id: &str) -> Result<bool>
pub async fn cleanup( &self, mode: CleanupMode, keep_pinned: bool, ) -> Result<CleanupResult>
Sourcepub async fn dev_reset(&self) -> Result<()>
pub async fn dev_reset(&self) -> Result<()>
Development-only: hard reset all sessions and the index.
This is the supported “greenfield” mechanism. It deletes:
bamboo_home_dir/sessions/bamboo_home_dir/sessions.json(rewritten to empty index)
Sourcepub async fn delete_session_recursive(
&self,
session_id: &str,
force: bool,
) -> Result<bool>
pub async fn delete_session_recursive( &self, session_id: &str, force: bool, ) -> Result<bool>
Delete a session. If the session is a root, deletes its entire directory (and all child sessions). If the session is a child, deletes only that child directory.
force=true ignores pinned protection; callers must enforce confirmations at the API/UI layer.
Trait Implementations§
Source§impl AttachmentReader for SessionStoreV2
impl AttachmentReader for SessionStoreV2
fn read_attachment<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
attachment_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(Vec<u8>, String)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§impl Debug for SessionStoreV2
impl Debug for SessionStoreV2
Source§impl Storage for SessionStoreV2
impl Storage for SessionStoreV2
Source§fn save_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn load_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Session>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Session>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn delete_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn save_runtime_state<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_runtime_state<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
messages history) for an already-existing session. Read moreSource§fn load_runtime_control_plane<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Session>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_runtime_control_plane<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Session>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn list_child_run_statuses<'life0, 'life1, 'async_trait>(
&'life0 self,
parent_session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, Option<String>)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_child_run_statuses<'life0, 'life1, 'async_trait>(
&'life0 self,
parent_session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, Option<String>)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
(child_session_id, last_run_status) for every direct child of the
given parent session, sourced from the index/metadata the backend keeps. Read more