Skip to main content

Storage

Trait Storage 

Source
pub trait Storage: StorageRead {
    // Required methods
    fn apply<'life0, 'async_trait>(
        &'life0 self,
        ops: Vec<RecordOp>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn put<'life0, 'async_trait>(
        &'life0 self,
        records: Vec<Record>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn put_with_options<'life0, 'async_trait>(
        &'life0 self,
        records: Vec<Record>,
        options: WriteOptions,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn merge<'life0, 'async_trait>(
        &'life0 self,
        records: Vec<Record>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn snapshot<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Arc<dyn StorageSnapshot>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn flush<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The storage type encapsulates access to the underlying storage (e.g. SlateDB).

Required Methods§

Source

fn apply<'life0, 'async_trait>( &'life0 self, ops: Vec<RecordOp>, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn put<'life0, 'async_trait>( &'life0 self, records: Vec<Record>, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn put_with_options<'life0, 'async_trait>( &'life0 self, records: Vec<Record>, options: WriteOptions, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Writes records to storage with custom options.

This method allows control over durability behavior. Use this when you need to specify whether to wait for writes to be durable.

§Arguments
  • records - The records to write
  • options - Write options controlling durability behavior
Source

fn merge<'life0, 'async_trait>( &'life0 self, records: Vec<Record>, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Merges values for the given keys using the configured merge operator.

This method requires the underlying storage engine to be configured with a merge operator. If no merge operator is configured, this method will return a StorageError::Storage error.

The merge operation is atomic - all merges in the batch are applied together or not at all.

Source

fn snapshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StorageResult<Arc<dyn StorageSnapshot>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates a point-in-time snapshot of the storage.

The snapshot provides a consistent read-only view of the database at the time the snapshot was created. Reads from the snapshot will not see any subsequent writes to the underlying storage.

Source

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

Flushes all pending writes to durable storage.

This ensures that all writes that have been acknowledged are persisted to durable storage. For SlateDB, this flushes the memtable to the WAL and object store.

Source

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

Closes the storage, releasing any resources.

This method should be called before dropping the storage to ensure proper cleanup. For SlateDB, this releases the database fence.

Implementors§