pub struct MemoryStorage { /* private fields */ }Expand description
In-memory storage implementation for development and testing
Implementations§
Source§impl MemoryStorage
impl MemoryStorage
Sourcepub fn store_document(&mut self, id: String, document: Document) -> Result<()>
pub fn store_document(&mut self, id: String, document: Document) -> Result<()>
Store a document
Sourcepub fn get_document(&self, id: &str) -> Option<&Document>
pub fn get_document(&self, id: &str) -> Option<&Document>
Retrieve a document by ID
Sourcepub fn get_entity(&self, id: &str) -> Option<&Entity>
pub fn get_entity(&self, id: &str) -> Option<&Entity>
Retrieve an entity by ID
Sourcepub fn all_documents(&self) -> Vec<&Document>
pub fn all_documents(&self) -> Vec<&Document>
Get all documents
Sourcepub fn all_entities(&self) -> Vec<&Entity>
pub fn all_entities(&self) -> Vec<&Entity>
Get all entities
Sourcepub fn all_chunks(&self) -> Vec<&TextChunk>
pub fn all_chunks(&self) -> Vec<&TextChunk>
Get all chunks
Sourcepub fn stats(&self) -> StorageStats
pub fn stats(&self) -> StorageStats
Get storage statistics
Trait Implementations§
Source§impl Clone for MemoryStorage
impl Clone for MemoryStorage
Source§fn clone(&self) -> MemoryStorage
fn clone(&self) -> MemoryStorage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryStorage
impl Debug for MemoryStorage
Source§impl Default for MemoryStorage
impl Default for MemoryStorage
Source§fn default() -> MemoryStorage
fn default() -> MemoryStorage
Returns the “default value” for a type. Read more
Source§impl Storage for MemoryStorage
Available on crate feature async only.
impl Storage for MemoryStorage
Available on crate feature
async only.Source§type Error = GraphRAGError
type Error = GraphRAGError
The error type returned by storage operations
Source§fn store_entity(&mut self, entity: Self::Entity) -> Result<String>
fn store_entity(&mut self, entity: Self::Entity) -> Result<String>
Store an entity and return its assigned ID
Source§fn retrieve_entity(&self, id: &str) -> Result<Option<Self::Entity>>
fn retrieve_entity(&self, id: &str) -> Result<Option<Self::Entity>>
Retrieve an entity by its ID
Source§fn store_document(&mut self, document: Self::Document) -> Result<String>
fn store_document(&mut self, document: Self::Document) -> Result<String>
Store a document and return its assigned ID
Source§fn retrieve_document(&self, id: &str) -> Result<Option<Self::Document>>
fn retrieve_document(&self, id: &str) -> Result<Option<Self::Document>>
Retrieve a document by its ID
Auto Trait Implementations§
impl Freeze for MemoryStorage
impl RefUnwindSafe for MemoryStorage
impl Send for MemoryStorage
impl Sync for MemoryStorage
impl Unpin for MemoryStorage
impl UnsafeUnpin for MemoryStorage
impl UnwindSafe for MemoryStorage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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