Skip to main content

StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend: Send + Sync {
    // Required methods
    fn table_scan(
        &self,
        table: &str,
        columns: &[String],
        predicate: Option<&str>,
    ) -> Result<Vec<HashMap<String, SochValue>>>;
    fn primary_key_lookup(
        &self,
        table: &str,
        key: &SochValue,
    ) -> Result<Option<HashMap<String, SochValue>>>;
    fn secondary_index_seek(
        &self,
        table: &str,
        index: &str,
        key: &SochValue,
    ) -> Result<Vec<HashMap<String, SochValue>>>;
    fn time_index_scan(
        &self,
        table: &str,
        start_us: u64,
        end_us: u64,
    ) -> Result<Vec<HashMap<String, SochValue>>>;
    fn vector_search(
        &self,
        table: &str,
        query: &[f32],
        k: usize,
    ) -> Result<Vec<(f32, HashMap<String, SochValue>)>>;
    fn row_count(&self, table: &str) -> usize;
}
Expand description

Storage backend trait for executing optimized query plans

This trait abstracts the storage layer so the optimizer can execute plans without knowing the concrete storage implementation.

Required Methods§

Source

fn table_scan( &self, table: &str, columns: &[String], predicate: Option<&str>, ) -> Result<Vec<HashMap<String, SochValue>>>

Execute a full table scan

Source

fn primary_key_lookup( &self, table: &str, key: &SochValue, ) -> Result<Option<HashMap<String, SochValue>>>

Execute a primary key lookup

Source

fn secondary_index_seek( &self, table: &str, index: &str, key: &SochValue, ) -> Result<Vec<HashMap<String, SochValue>>>

Execute a secondary index seek

Source

fn time_index_scan( &self, table: &str, start_us: u64, end_us: u64, ) -> Result<Vec<HashMap<String, SochValue>>>

Execute a time range scan

Execute a vector similarity search

Source

fn row_count(&self, table: &str) -> usize

Get table row count (for optimization)

Implementors§