pub struct StorageBackend { /* private fields */ }Expand description
Storage backend for persisting knowledge entries and embeddings.
Implementations§
Source§impl StorageBackend
impl StorageBackend
Sourcepub async fn open(path: impl AsRef<Path>) -> Result<Self>
pub async fn open(path: impl AsRef<Path>) -> Result<Self>
Open or create storage at the given path.
Sourcepub async fn load_all(&self) -> Result<Vec<(KnowledgeEntry, Vec<f32>)>>
pub async fn load_all(&self) -> Result<Vec<(KnowledgeEntry, Vec<f32>)>>
Load all entries and embeddings.
Sourcepub async fn save_entry(
&self,
entry: &KnowledgeEntry,
embedding: &[f32],
) -> Result<()>
pub async fn save_entry( &self, entry: &KnowledgeEntry, embedding: &[f32], ) -> Result<()>
Save a single entry with its embedding.
Sourcepub async fn save_batch(
&self,
batch: &[(KnowledgeEntry, Vec<f32>)],
) -> Result<()>
pub async fn save_batch( &self, batch: &[(KnowledgeEntry, Vec<f32>)], ) -> Result<()>
Save multiple entries in batch.
Sourcepub async fn delete_entry(&self, id: Uuid) -> Result<()>
pub async fn delete_entry(&self, id: Uuid) -> Result<()>
Delete an entry.
Sourcepub async fn stats(&self) -> StorageStats
pub async fn stats(&self) -> StorageStats
Get storage statistics.
Auto Trait Implementations§
impl !Freeze for StorageBackend
impl !RefUnwindSafe for StorageBackend
impl Send for StorageBackend
impl Sync for StorageBackend
impl Unpin for StorageBackend
impl UnsafeUnpin for StorageBackend
impl !UnwindSafe for StorageBackend
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request