Skip to main content

MemoryStore

Struct MemoryStore 

Source
pub struct MemoryStore { /* private fields */ }
Expand description

Bamboo-facing memory handle. Jiandu remains private so Bamboo callers cannot bypass the facade’s Project identity and inspection extensions.

Implementations§

Source§

impl MemoryStore

Source

pub fn new(data_dir: impl Into<PathBuf>) -> MemoryStore

Construct a Jiandu store rooted at an explicit data directory.

Source

pub fn with_defaults() -> MemoryStore

Construct the production store at the independent ~/.jiandu root.

Source

pub fn default_data_dir() -> PathBuf

Resolve the canonical production data root used by Self::with_defaults.

Source

pub fn for_project(&self, project_id: &ProjectId) -> MemoryStore

Bind Project memory to Bamboo’s first-class Project identity.

Source

pub async fn read_session_topic( &self, session_id: &str, topic: &str, ) -> Result<Option<String>, Error>

Source

pub async fn write_session_topic( &self, session_id: &str, topic: &str, content: &str, ) -> Result<PathBuf, Error>

Source

pub async fn delete_session_topic( &self, session_id: &str, topic: &str, ) -> Result<bool, Error>

Source

pub async fn list_session_topics( &self, session_id: &str, ) -> Result<Vec<String>, Error>

Source

pub async fn read_session_topics_with_content( &self, session_id: &str, ) -> Result<Vec<(String, String)>, Error>

Source

pub async fn read_session_state( &self, session_id: &str, ) -> Result<SessionState, Error>

Source

pub async fn mark_session_extracted( &self, session_id: &str, extracted_at: &str, ) -> Result<(), Error>

Source

pub async fn read_memory_view( &self, scope: MemoryScope, project_key: Option<&str>, ) -> Result<Option<String>, Error>

Source

pub async fn query_scope( &self, scope: MemoryScope, project_key: Option<&str>, query: Option<&str>, filter_types: Option<&HashSet<DurableMemoryType>>, filter_statuses: Option<&HashSet<DurableMemoryStatus>>, filter_granularity: Option<&HashSet<TemporalGranularity>>, options: &MemoryQueryOptions, ) -> Result<MemoryQueryResult, Error>

Source

pub async fn inspect_scope( &self, scope: MemoryScope, project_key: Option<&str>, ) -> Result<MemoryInspectResult, Error>

Source

pub async fn get_memory( &self, id: &str, preferred_project_key: Option<&str>, ) -> Result<Option<DurableMemoryDocument>, Error>

Source

pub async fn write_memory( &self, scope: MemoryScope, project_key: Option<&str>, type: DurableMemoryType, title: &str, content: &str, tags: &[String], session_id: Option<&str>, actor: &str, allow_merge_if_similar: bool, granularity: Option<TemporalGranularity>, ) -> Result<DurableMemoryDocument, Error>

Source

pub async fn write_memory_with_retrieval( &self, scope: MemoryScope, project_key: Option<&str>, type: DurableMemoryType, title: &str, content: &str, tags: &[String], retrieval: &MemoryRetrievalInput, session_id: Option<&str>, actor: &str, allow_merge_if_similar: bool, granularity: Option<TemporalGranularity>, ) -> Result<DurableMemoryDocument, Error>

Source

pub async fn archive_memory( &self, id: &str, preferred_project_key: Option<&str>, mode: DurableMemoryStatus, reason: Option<&str>, ) -> Result<Option<DurableMemoryDocument>, Error>

Source

pub async fn split_memory( &self, id: &str, preferred_project_key: Option<&str>, pieces: &[MemorySplitPiece], session_id: Option<&str>, actor: &str, ) -> Result<Option<MemorySplitResult>, Error>

Source

pub async fn split_memory_with_retrieval( &self, id: &str, preferred_project_key: Option<&str>, pieces: &[MemorySplitPiece], retrieval: &[MemoryRetrievalInput], session_id: Option<&str>, actor: &str, ) -> Result<Option<MemorySplitResult>, Error>

Source

pub async fn find_duplicate_candidates( &self, scope: MemoryScope, project_key: Option<&str>, type: Option<DurableMemoryType>, title: &str, content: &str, tags: &[String], limit: usize, ) -> Result<Vec<MemoryDuplicateCandidate>, Error>

Source

pub async fn find_duplicate_candidates_with_retrieval( &self, scope: MemoryScope, project_key: Option<&str>, type: Option<DurableMemoryType>, title: &str, content: &str, tags: &[String], retrieval: &MemoryRetrievalInput, limit: usize, ) -> Result<Vec<MemoryDuplicateCandidate>, Error>

Source

pub async fn scan_blob_candidates( &self, scope: MemoryScope, project_key: Option<&str>, min_appended_sections: usize, limit: usize, ) -> Result<BlobScanReport, Error>

Source

pub async fn scan_duplicate_clusters( &self, scope: MemoryScope, project_key: Option<&str>, min_score: f64, max_members_per_cluster: usize, limit: usize, ) -> Result<DuplicateScanReport, Error>

Source

pub async fn consolidate_memories( &self, ids: &[String], preferred_project_key: Option<&str>, merged: &MemorySplitPiece, session_id: Option<&str>, actor: &str, ) -> Result<Option<MemoryConsolidateResult>, Error>

Source

pub async fn consolidate_memories_with_retrieval( &self, ids: &[String], preferred_project_key: Option<&str>, merged: &MemorySplitPiece, retrieval: &MemoryRetrievalInput, session_id: Option<&str>, actor: &str, ) -> Result<Option<MemoryConsolidateResult>, Error>

Source

pub async fn purge_memories( &self, scope: MemoryScope, project_key: Option<&str>, filter_types: Option<&HashSet<DurableMemoryType>>, filter_statuses: Option<&HashSet<DurableMemoryStatus>>, filter_granularity: Option<&HashSet<TemporalGranularity>>, mode: DurableMemoryStatus, reason: Option<&str>, ) -> Result<MemoryPurgeResult, Error>

Source

pub async fn mark_memory_contradicted( &self, id: &str, preferred_project_key: Option<&str>, contradicted_by_ids: &[String], reason: Option<&str>, session_id: Option<&str>, actor: &str, ) -> Result<Option<MemoryContradictionResult>, Error>

Source

pub async fn merge_memory( &self, id: &str, preferred_project_key: Option<&str>, content: &str, tags: &[String], session_id: Option<&str>, actor: &str, source_memory_ids: &[String], ) -> Result<Option<MemoryMergeResult>, Error>

Source

pub async fn merge_memory_with_retrieval( &self, id: &str, preferred_project_key: Option<&str>, content: &str, tags: &[String], retrieval: &MemoryRetrievalInput, session_id: Option<&str>, actor: &str, source_memory_ids: &[String], ) -> Result<Option<MemoryMergeResult>, Error>

Source

pub async fn rebuild_scope( &self, scope: MemoryScope, project_key: Option<&str>, ) -> Result<(), Error>

Source

pub async fn current_scope_generation( &self, scope: MemoryScope, project_key: Option<&str>, ) -> Result<String, Error>

Source

pub async fn read_dream_snapshot( &self, scope: MemoryScope, project_key: Option<&str>, ) -> Result<DreamReadResult, Error>

Source

pub async fn publish_dream_snapshot( &self, scope: MemoryScope, project_key: Option<&str>, source_generation: &str, content: &str, ) -> Result<DreamSnapshot, Error>

Source

pub async fn list_memory_documents( &self, scope: MemoryScope, project_key: Option<&str>, ) -> Result<Vec<DurableMemoryDocument>, Error>

Source

pub async fn count_scope_memories( &self, scope: MemoryScope, project_key: Option<&str>, ) -> Result<usize, Error>

Source

pub async fn enforce_scope_capacity( &self, scope: MemoryScope, project_key: Option<&str>, capacity: usize, max_archivals: usize, ) -> Result<Vec<String>, Error>

Source

pub async fn expire_stale_granularity( &self, scope: MemoryScope, project_key: Option<&str>, ) -> Result<Vec<String>, Error>

Trait Implementations§

Source§

impl Clone for MemoryStore

Source§

fn clone(&self) -> MemoryStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MemoryStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryStore

Source§

fn default() -> MemoryStore

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more