Skip to main content

Storage

Trait Storage 

Source
pub trait Storage: Send + Sync {
    // Required methods
    fn read_batch<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        predicate: Option<&'life2 Expr>,
    ) -> Pin<Box<dyn Future<Output = Result<SendableRecordBatchStream, FnError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn write_batch<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        batch: &'life2 RecordBatch,
    ) -> Pin<Box<dyn Future<Output = Result<WriteHandle, FnError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_tables<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, FnError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        predicate: &'life2 Expr,
    ) -> Pin<Box<dyn Future<Output = Result<u64, FnError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn supports_branching(&self) -> bool { ... }
    fn fork<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _table: &'life1 str,
        _src_branch: &'life2 str,
        _dst_branch: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<BranchMetadata, FnError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn schema<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _table: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<SchemaRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Per-instance storage interface.

Required Methods§

Source

fn read_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, predicate: Option<&'life2 Expr>, ) -> Pin<Box<dyn Future<Output = Result<SendableRecordBatchStream, FnError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stream batches from table matching predicate.

predicate = None means a full scan.

§Errors

Returns FnError if the read cannot start.

Source

fn write_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, batch: &'life2 RecordBatch, ) -> Pin<Box<dyn Future<Output = Result<WriteHandle, FnError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Write a single batch to table.

§Errors

Returns FnError on write failure.

Source

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

List tables known to this backend.

§Errors

Returns FnError if the listing cannot complete.

Source

fn delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, predicate: &'life2 Expr, ) -> Pin<Box<dyn Future<Output = Result<u64, FnError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete rows in table matching predicate. Returns the number of rows actually deleted.

§Errors

Returns FnError on delete failure.

Provided Methods§

Source

fn supports_branching(&self) -> bool

Whether this backend supports branched / forked state.

Source

fn fork<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _table: &'life1 str, _src_branch: &'life2 str, _dst_branch: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<BranchMetadata, FnError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Fork src_branch of table into dst_branch. Default: unsupported.

Granularity is per-dataset (table) because real branching backends (Lance) track branches and versions independently per dataset. Multi-dataset orchestration (atomic across all tables of a logical fork) is the caller’s responsibility.

§Errors

Returns FnError if branching is not supported or the fork operation fails (missing source branch, name collision, I/O).

Source

fn schema<'life0, 'life1, 'async_trait>( &'life0 self, _table: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<SchemaRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Backend-declared schema for table, if known.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§