pub struct ExternalMemory { /* private fields */ }Expand description
External memory manager for storing and retrieving session notes.
Implementations§
Source§impl ExternalMemory
impl ExternalMemory
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default settings.
Uses ~/.bamboo/notes as the storage directory.
Sourcepub async fn save_note(&self, session_id: &str, note: &str) -> Result<PathBuf>
pub async fn save_note(&self, session_id: &str, note: &str) -> Result<PathBuf>
Save a note for a session.
The note is stored as a markdown file named {session_id}.md.
Sourcepub async fn read_note(&self, session_id: &str) -> Result<Option<String>>
pub async fn read_note(&self, session_id: &str) -> Result<Option<String>>
Read a note for a session.
Returns None if no note exists for the session.
Sourcepub async fn delete_note(&self, session_id: &str) -> Result<bool>
pub async fn delete_note(&self, session_id: &str) -> Result<bool>
Delete a note for a session.
Returns true if a note was deleted, false if no note existed.
Sourcepub async fn list_sessions_with_notes(&self) -> Result<Vec<String>>
pub async fn list_sessions_with_notes(&self) -> Result<Vec<String>>
List all session IDs that have notes.
Sourcepub async fn append_note(
&self,
session_id: &str,
content: &str,
) -> Result<PathBuf>
pub async fn append_note( &self, session_id: &str, content: &str, ) -> Result<PathBuf>
Append to an existing note, or create a new one if it doesn’t exist.
Sourcepub fn get_note_path(&self, session_id: &str) -> PathBuf
pub fn get_note_path(&self, session_id: &str) -> PathBuf
Get the path to the notes file for a session.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExternalMemory
impl RefUnwindSafe for ExternalMemory
impl Send for ExternalMemory
impl Sync for ExternalMemory
impl Unpin for ExternalMemory
impl UnsafeUnpin for ExternalMemory
impl UnwindSafe for ExternalMemory
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