Skip to main content

Backend

Trait Backend 

Source
pub trait Backend: Send + Sync {
    // Required methods
    fn put_row(
        &self,
        table: &str,
        key: &[u8],
        row: &VectorRow,
    ) -> Result<(), StoreError>;
    fn get_row(
        &self,
        table: &str,
        key: &[u8],
    ) -> Result<Option<VectorRow>, StoreError>;
    fn delete_row(&self, table: &str, key: &[u8]) -> Result<bool, StoreError>;
    fn for_each_row(
        &self,
        table: &str,
        f: &mut RowVisitor<'_>,
    ) -> Result<(), StoreError>;
    fn put_schema(&self, schema: &TableSchema) -> Result<(), StoreError>;
    fn list_schemas(&self) -> Result<Vec<TableSchema>, StoreError>;
}
Expand description

Storage backend trait.

Implementations are responsible for persisting / fetching the row map and the HNSW snapshot. The MVP ships an in-memory backend (MemoryBackend); a Noxu-backed backend lives behind the noxu feature.

Required Methods§

Source

fn put_row( &self, table: &str, key: &[u8], row: &VectorRow, ) -> Result<(), StoreError>

Persist row under (table, key). Overwrites prior values.

Source

fn get_row( &self, table: &str, key: &[u8], ) -> Result<Option<VectorRow>, StoreError>

Fetch the row at (table, key). Returns None for a missing row.

Source

fn delete_row(&self, table: &str, key: &[u8]) -> Result<bool, StoreError>

Remove (table, key). Returns true when present, false when absent.

Source

fn for_each_row( &self, table: &str, f: &mut RowVisitor<'_>, ) -> Result<(), StoreError>

Iterate every (key, row) in table in unspecified order. Used to rebuild the HNSW index on startup.

Source

fn put_schema(&self, schema: &TableSchema) -> Result<(), StoreError>

Persist a TableSchema.

Source

fn list_schemas(&self) -> Result<Vec<TableSchema>, StoreError>

List every persisted TableSchema.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§