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§
Sourcefn table_scan(
&self,
table: &str,
columns: &[String],
predicate: Option<&str>,
) -> Result<Vec<HashMap<String, SochValue>>>
fn table_scan( &self, table: &str, columns: &[String], predicate: Option<&str>, ) -> Result<Vec<HashMap<String, SochValue>>>
Execute a full table scan
Sourcefn primary_key_lookup(
&self,
table: &str,
key: &SochValue,
) -> Result<Option<HashMap<String, SochValue>>>
fn primary_key_lookup( &self, table: &str, key: &SochValue, ) -> Result<Option<HashMap<String, SochValue>>>
Execute a primary key lookup
Sourcefn secondary_index_seek(
&self,
table: &str,
index: &str,
key: &SochValue,
) -> Result<Vec<HashMap<String, SochValue>>>
fn secondary_index_seek( &self, table: &str, index: &str, key: &SochValue, ) -> Result<Vec<HashMap<String, SochValue>>>
Execute a secondary index seek
Sourcefn time_index_scan(
&self,
table: &str,
start_us: u64,
end_us: u64,
) -> Result<Vec<HashMap<String, SochValue>>>
fn time_index_scan( &self, table: &str, start_us: u64, end_us: u64, ) -> Result<Vec<HashMap<String, SochValue>>>
Execute a time range scan