pub struct Storage { /* private fields */ }Expand description
Simple storage repository for text data
Implementations§
Source§impl Storage
impl Storage
Sourcepub async fn store(
&self,
content: &str,
context: String,
summary: String,
tags: Option<Vec<String>>,
) -> Result<Uuid>
pub async fn store( &self, content: &str, context: String, summary: String, tags: Option<Vec<String>>, ) -> Result<Uuid>
Store text with context and summary (deduplication by hash)
Sourcepub async fn store_chunk(
&self,
content: &str,
context: String,
summary: String,
tags: Option<Vec<String>>,
chunk_index: i32,
total_chunks: i32,
parent_id: Uuid,
) -> Result<Uuid>
pub async fn store_chunk( &self, content: &str, context: String, summary: String, tags: Option<Vec<String>>, chunk_index: i32, total_chunks: i32, parent_id: Uuid, ) -> Result<Uuid>
Store a chunk with parent reference
Sourcepub async fn get_chunks(&self, parent_id: Uuid) -> Result<Vec<Memory>>
pub async fn get_chunks(&self, parent_id: Uuid) -> Result<Vec<Memory>>
Get all chunks for a parent document, ordered by chunk index
Sourcepub async fn stats(&self) -> Result<StorageStats>
pub async fn stats(&self) -> Result<StorageStats>
Get basic storage statistics
Sourcepub async fn list_recent(&self, limit: i64) -> Result<Vec<Memory>>
pub async fn list_recent(&self, limit: i64) -> Result<Vec<Memory>>
List recent memories (for basic browsing)
Sourcepub async fn find_similar_content(
&self,
content_hash: &str,
limit: i64,
) -> Result<Vec<Memory>>
pub async fn find_similar_content( &self, content_hash: &str, limit: i64, ) -> Result<Vec<Memory>>
Find memories with similar content but different contexts Implements transfer appropriate processing - matching content with varying contexts
Sourcepub async fn exists_with_content(&self, content_hash: &str) -> Result<bool>
pub async fn exists_with_content(&self, content_hash: &str) -> Result<bool>
Check if a specific content already exists Simplified deduplication based on content hash only
Sourcepub async fn get_content_stats(&self) -> Result<Vec<(String, i64)>>
pub async fn get_content_stats(&self) -> Result<Vec<(String, i64)>>
Get content statistics showing duplicate content Useful for understanding deduplication effectiveness
Sourcepub async fn search_memories(
&self,
params: SearchParams,
) -> Result<Vec<SearchResult>>
pub async fn search_memories( &self, params: SearchParams, ) -> Result<Vec<SearchResult>>
Semantic similarity search using existing embeddings from codex-dreams Implements progressive search strategy with automatic threshold relaxation
Sourcepub async fn search_memories_progressive_with_metadata(
&self,
params: SearchParams,
) -> Result<SearchResultWithMetadata>
pub async fn search_memories_progressive_with_metadata( &self, params: SearchParams, ) -> Result<SearchResultWithMetadata>
Progressive search with metadata about which stage was used
Auto Trait Implementations§
impl Freeze for Storage
impl !RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl !UnwindSafe for Storage
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more