pub trait Storage: StorageRead {
// Required methods
fn apply_with_options<'life0, 'async_trait>(
&'life0 self,
ops: Vec<RecordOp>,
options: WriteOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn put_with_options<'life0, 'async_trait>(
&'life0 self,
records: Vec<PutRecordOp>,
options: WriteOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn merge_with_options<'life0, 'async_trait>(
&'life0 self,
records: Vec<MergeRecordOp>,
options: WriteOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + 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;
fn subscribe_durable(&self) -> Receiver<u64>;
// Provided methods
fn apply<'life0, 'async_trait>(
&'life0 self,
ops: Vec<RecordOp>,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn put<'life0, 'async_trait>(
&'life0 self,
records: Vec<PutRecordOp>,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn merge<'life0, 'async_trait>(
&'life0 self,
records: Vec<MergeRecordOp>,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
The storage type encapsulates access to the underlying storage (e.g. SlateDB).
Required Methods§
Sourcefn apply_with_options<'life0, 'async_trait>(
&'life0 self,
ops: Vec<RecordOp>,
options: WriteOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn apply_with_options<'life0, 'async_trait>(
&'life0 self,
ops: Vec<RecordOp>,
options: WriteOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Applies a batch of mixed operations with custom write options.
options.await_durable controls whether this call returns only after
the batch reaches durable storage.
§Errors
Returns an error if the batch cannot be applied.
Sourcefn put_with_options<'life0, 'async_trait>(
&'life0 self,
records: Vec<PutRecordOp>,
options: WriteOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put_with_options<'life0, 'async_trait>(
&'life0 self,
records: Vec<PutRecordOp>,
options: WriteOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + 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 writeoptions- Write options controlling durability behavior
§Errors
Returns an error if any write in the batch fails.
Sourcefn merge_with_options<'life0, 'async_trait>(
&'life0 self,
records: Vec<MergeRecordOp>,
options: WriteOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn merge_with_options<'life0, 'async_trait>(
&'life0 self,
records: Vec<MergeRecordOp>,
options: WriteOptions,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Merges values with custom write options.
options.await_durable controls whether this call returns only after
the batch reaches durable storage.
§Errors
Returns an error if no merge operator is configured or if the merge operation fails.
Sourcefn 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 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.
Sourcefn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + 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,
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.
§Errors
Returns an error if durability cannot be established.
Sourcefn close<'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,
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.
§Errors
Returns an error if resource shutdown fails.
Sourcefn subscribe_durable(&self) -> Receiver<u64>
fn subscribe_durable(&self) -> Receiver<u64>
Subscribes to the durable sequence watermark.
Returns a watch::Receiver<u64> that tracks the highest sequence number
confirmed durable by the storage engine. For SlateDB, this maps to
DbStatus::durable_seq. For in-memory storage, writes are immediately
“durable” so the watermark matches the latest written seqnum.
Provided Methods§
Sourcefn apply<'life0, 'async_trait>(
&'life0 self,
ops: Vec<RecordOp>,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn apply<'life0, 'async_trait>(
&'life0 self,
ops: Vec<RecordOp>,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Applies a batch of mixed operations (puts, merges, and deletes) atomically.
All operations in the batch are written together in a single WriteBatch,
so either all succeed or none are visible. This is the primary write method
used by flushers that produce a mix of operation types from a frozen delta.
Uses WriteOptions::default() (await_durable: false).
Sourcefn put<'life0, 'async_trait>(
&'life0 self,
records: Vec<PutRecordOp>,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
records: Vec<PutRecordOp>,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Writes records to storage.
Uses WriteOptions::default() (await_durable: false).
Sourcefn merge<'life0, 'async_trait>(
&'life0 self,
records: Vec<MergeRecordOp>,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn merge<'life0, 'async_trait>(
&'life0 self,
records: Vec<MergeRecordOp>,
) -> Pin<Box<dyn Future<Output = StorageResult<WriteResult>> + Send + 'async_trait>>where
Self: Sync + '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.
Uses WriteOptions::default() (await_durable: false).