pub struct NativeVersionedLog<S: ?Sized> { /* private fields */ }Expand description
Versioned transaction log backed by a native key/value-style store.
Each transaction is written as its own create-only object keyed
(name, write_version, t), so an append is a single small insert with no
read and no growing buffer. The writer is the sole appender under its lease
version (the fence gives each active owner its own version; a deposed
writer’s stale appends land in a version the takeover cutoff discards), so
tracking next_t in memory is all the append state required.
Implementations§
Source§impl<S: NativeLogStorage + ?Sized + 'static> NativeVersionedLog<S>
impl<S: NativeLogStorage + ?Sized + 'static> NativeVersionedLog<S>
Sourcepub async fn open(
storage: Arc<S>,
name: &str,
write_version: u64,
) -> Result<Self, LogError>
pub async fn open( storage: Arc<S>, name: &str, write_version: u64, ) -> Result<Self, LogError>
Opens the log for writing under write_version.
§Errors
Returns an error when stored records cannot be read or decoded.
Sourcepub async fn open_sealed(
storage: Arc<S>,
name: &str,
write_version: u64,
cipher: Arc<LogCipher>,
) -> Result<Self, LogError>
pub async fn open_sealed( storage: Arc<S>, name: &str, write_version: u64, cipher: Arc<LogCipher>, ) -> Result<Self, LogError>
Opens the log for writing with record payloads sealed under cipher.
§Errors
Returns an error when stored records cannot be read, decoded, or authenticated.
Sourcepub fn open_read_only(storage: Arc<S>, name: &str) -> Self
pub fn open_read_only(storage: Arc<S>, name: &str) -> Self
Opens the log for read-only range replay without first scanning it to initialize writer state.
Trait Implementations§
Source§impl<S: NativeLogStorage + ?Sized + 'static> TransactionLog for NativeVersionedLog<S>
impl<S: NativeLogStorage + ?Sized + 'static> TransactionLog for NativeVersionedLog<S>
Source§fn append(&self, record: &TxRecord) -> Result<(), LogError>
fn append(&self, record: &TxRecord) -> Result<(), LogError>
Source§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_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,
Self::append by default;
storage-backed logs override this method and await their backend. Read moreSource§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 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,
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. Read moreSource§fn tx_range(
&self,
start: u64,
end: Option<u64>,
) -> Result<Vec<TxRecord>, LogError>
fn tx_range( &self, start: u64, end: Option<u64>, ) -> Result<Vec<TxRecord>, LogError>
[start, end). Read more