pub trait NativeLogStorage: Send + Sync {
// Required methods
fn put_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
records: &'life2 [(u64, Vec<u8>)],
) -> Pin<Box<dyn Future<Output = Result<bool, LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn read_record<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
t: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_records<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn read_legacy_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
chunk: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_legacy_chunks<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_all<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Asynchronous object store for transaction-log records.
Implementations adapt the same native storage system used for blobs and
roots. The live log is written one object per transaction — a
create-only write keyed (name, version, t) whose success is the
durability point — so an append is O(1) (a small insert) instead of a
read-modify-write of a growing chunk. On a SQL backend that is a
row-per-commit insert; on an object store, a create-only PUT.
Earlier releases wrote a different layout: a sequence of chunk objects
(name, version, chunk), each a run of framed records, appended in place
and rolled at a size cap. Those objects are still read, read-only, through
Self::list_legacy_chunks / Self::read_legacy_chunk, so a log
written by an older binary keeps replaying after an upgrade; new records
are always written in the per-transaction layout.
Required Methods§
Sourcefn put_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
records: &'life2 [(u64, Vec<u8>)],
) -> Pin<Box<dyn Future<Output = Result<bool, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
records: &'life2 [(u64, Vec<u8>)],
) -> Pin<Box<dyn Future<Output = Result<bool, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create-only, atomic write of one contiguous batch of transactions as a
single object, keyed by the batch’s last t. Each element is
(t, framed_bytes) in ascending t; the object holds their framed
bytes concatenated (the same encoding a multi-record chunk uses).
Returns Ok(true) when written and Ok(false) when an object already
exists for that last-t — a lost create race or a retry of an
already-durable batch. The create-only condition is the log’s fence: a
given (version, last t) is written at most once, and the batch is
durable in full or not at all.
§Errors
Returns an error when the native backend cannot publish the object.
Sourcefn read_record<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
t: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_record<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
t: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads the bytes of the batch object keyed by last-t t for
(name, version).
§Errors
Returns an error when the native backend cannot read the object.
Sourcefn list_records<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_records<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lists every (version, last-t) batch object present for name.
§Errors
Returns an error when the native backend cannot enumerate log objects or returns an invalid identifier.
Sourcefn read_legacy_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
chunk: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_legacy_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
chunk: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads one legacy chunk object (pre-per-record layout), for read-only replay of logs written by older binaries.
§Errors
Returns an error when the native backend cannot read the chunk object.
Sourcefn list_legacy_chunks<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_legacy_chunks<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lists every legacy (version, chunk) object present for name, for
read-only replay of older logs. Returns an empty list on a store that
only ever wrote the per-record layout.
§Errors
Returns an error when the native backend cannot enumerate log objects or returns an invalid identifier.
Sourcefn delete_all<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_all<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes every log object for name, in both layouts.
§Errors
Returns an error when the native backend cannot remove an object.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".