HanzoDatabase

Trait HanzoDatabase 

Source
pub trait HanzoDatabase: Send + Sync {
    // Required methods
    fn init<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn create_table<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        schema: TableSchema,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn insert<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        data: &'life2 [Record],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn query<'life0, 'async_trait>(
        &'life0 self,
        query: Query,
    ) -> Pin<Box<dyn Future<Output = Result<QueryResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn vector_search<'life0, 'async_trait>(
        &'life0 self,
        query: VectorQuery,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn begin_transaction<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Transaction>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn optimize<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<DatabaseStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Unified database trait

Required Methods§

Source

fn init<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initialize the database

Source

fn create_table<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, schema: TableSchema, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a table

Source

fn insert<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, data: &'life2 [Record], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Insert data

Source

fn query<'life0, 'async_trait>( &'life0 self, query: Query, ) -> Pin<Box<dyn Future<Output = Result<QueryResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Query data

Vector search

Source

fn begin_transaction<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Transaction>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Begin transaction

Source

fn optimize<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Optimize database

Source

fn stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<DatabaseStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get database statistics

Implementors§