pub trait TransactionLog: Send + Sync {
// Required methods
fn append(&self, record: &TxRecord) -> Result<(), LogError>;
fn tx_range(
&self,
start: u64,
end: Option<u64>,
) -> Result<Vec<TxRecord>, LogError>;
// Provided methods
fn append_async<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 TxRecord,
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn append_batch_async<'life0, 'life1, 'async_trait>(
&'life0 self,
records: &'life1 [TxRecord],
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn tx_range_async<'life0, 'async_trait>(
&'life0 self,
start: u64,
end: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<TxRecord>, LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn replay(&self) -> Result<Vec<TxRecord>, LogError> { ... }
fn replay_async<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<TxRecord>, LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Common transaction log interface.
Required Methods§
Provided Methods§
Sourcefn append_async<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 TxRecord,
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append_async<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 TxRecord,
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Durably appends exactly the next transaction without blocking an async
runtime worker. Synchronous logs use Self::append by default;
storage-backed logs override this method and await their backend.
§Errors
Returns an error for I/O failure, corruption, or a non-contiguous t.
Sourcefn append_batch_async<'life0, 'life1, 'async_trait>(
&'life0 self,
records: &'life1 [TxRecord],
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append_batch_async<'life0, 'life1, 'async_trait>(
&'life0 self,
records: &'life1 [TxRecord],
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Durably appends a contiguous run of transactions under a single
durability boundary where the backend supports one (one fsync, one
object, one database transaction), so group commit amortizes the
per-append cost across the batch. records must be contiguous in t
starting at the log’s next expected t; an empty slice is a no-op. The
default appends them one at a time; batching backends override this.
§Errors
Returns an error for I/O failure, corruption, or a non-contiguous t.
Sourcefn tx_range_async<'life0, 'async_trait>(
&'life0 self,
start: u64,
end: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<TxRecord>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tx_range_async<'life0, 'async_trait>(
&'life0 self,
start: u64,
end: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<TxRecord>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Asynchronous form of Self::tx_range.
§Errors
Returns an error when stored records cannot be read or decoded.
Sourcefn replay(&self) -> Result<Vec<TxRecord>, LogError>
fn replay(&self) -> Result<Vec<TxRecord>, LogError>
Replays every committed record.
§Errors
Returns an error when stored records cannot be read or decoded.
Sourcefn replay_async<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<TxRecord>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn replay_async<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<TxRecord>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Asynchronously replays every committed record.
§Errors
Returns an error when stored records cannot be read or decoded.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".