pub trait IndexBackendPlugin: Send + Sync {
// Required methods
fn create_index_set<'life0, 'life1, 'async_trait>(
&'life0 self,
query_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<IndexSet, IndexError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn is_volatile(&self) -> bool;
}Expand description
Index backend plugin trait for implementing storage backends Plugin trait for external index storage backends.
Each storage backend (RocksDB, Garnet, etc.) implements this trait to provide all index types needed for query evaluation from a single shared backend instance.
§Thread Safety
Implementations must be Send + Sync to allow use across async tasks.
§Example
use drasi_core::interface::{IndexBackendPlugin, IndexSet};
pub struct MyIndexProvider {
// configuration fields
}
#[async_trait]
impl IndexBackendPlugin for MyIndexProvider {
async fn create_index_set(&self, query_id: &str) -> Result<IndexSet, IndexError> {
// Create and return all indexes from a shared backend instance
}
fn is_volatile(&self) -> bool { false }
}Required Methods§
Sourcefn create_index_set<'life0, 'life1, 'async_trait>(
&'life0 self,
query_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<IndexSet, IndexError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn create_index_set<'life0, 'life1, 'async_trait>(
&'life0 self,
query_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<IndexSet, IndexError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Create all indexes for a query from a single shared backend instance.
This method creates the element index, archive index, result index, future queue, and session control backed by a shared storage resource (e.g., a single RocksDB database or Redis connection). This reduces resource overhead and enables cross-index atomic transactions.
Sourcefn is_volatile(&self) -> bool
fn is_volatile(&self) -> bool
Returns true if this backend is volatile (data lost on restart).
Volatile backends (like in-memory) require re-bootstrapping after restart, while persistent backends (like RocksDB) retain data.