IndexBackendPlugin

Trait IndexBackendPlugin 

Source
pub trait IndexBackendPlugin: Send + Sync {
    // Required methods
    fn create_element_index<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ElementIndex>, IndexError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_archive_index<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ElementArchiveIndex>, IndexError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_result_index<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ResultIndex>, IndexError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_future_queue<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn FutureQueue>, IndexError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_volatile(&self) -> bool;
}
Expand description

Plugin trait for external index storage backends.

Each storage backend (RocksDB, Garnet, etc.) implements this trait to provide the four index types needed for query evaluation.

§Thread Safety

Implementations must be Send + Sync to allow use across async tasks.

§Example

use drasi_core::interface::IndexBackendPlugin;

pub struct MyIndexProvider {
    // configuration fields
}

#[async_trait]
impl IndexBackendPlugin for MyIndexProvider {
    async fn create_element_index(&self, query_id: &str) -> Result<Arc<dyn ElementIndex>, IndexError> {
        // Create and return your element index implementation
    }
    // ... other methods
}

Required Methods§

Source

fn create_element_index<'life0, 'life1, 'async_trait>( &'life0 self, query_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ElementIndex>, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create an ElementIndex instance for the given query.

The element index manages the current graph elements (nodes and relationships) for a specific query. Each query gets its own isolated index instance.

Source

fn create_archive_index<'life0, 'life1, 'async_trait>( &'life0 self, query_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ElementArchiveIndex>, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create an ElementArchiveIndex instance for the given query.

The archive index supports point-in-time queries and version history, enabling the past() function in Cypher queries.

Source

fn create_result_index<'life0, 'life1, 'async_trait>( &'life0 self, query_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ResultIndex>, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a ResultIndex instance for the given query.

The result index stores accumulated query results and aggregations, supporting efficient incremental computation.

Source

fn create_future_queue<'life0, 'life1, 'async_trait>( &'life0 self, query_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn FutureQueue>, IndexError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a FutureQueue instance for the given query.

The future queue manages temporal queries and scheduled operations, enabling time-based query features.

Source

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.

Implementors§