pub struct TransactionLogStore { /* private fields */ }Expand description
Helper for reading and writing the commit log under a table root.
Layout:
<root>/_timeseries_log/0000000001.json
<root>/_timeseries_log/0000000002.json
<root>/_timeseries_log/CURRENT
Implementations§
Source§impl TransactionLogStore
impl TransactionLogStore
Sourcepub const LOG_DIR_NAME: &str = storage::layout::LOG_DIR_NAME
pub const LOG_DIR_NAME: &str = storage::layout::LOG_DIR_NAME
Name of the subdirectory containing the commit log.
Sourcepub const CURRENT_FILE_NAME: &str = storage::layout::CURRENT_FILE_NAME
pub const CURRENT_FILE_NAME: &str = storage::layout::CURRENT_FILE_NAME
Name of the file that stores the current version pointer.
Sourcepub const COMMIT_FILENAME_DIGITS: usize = storage::layout::COMMIT_FILENAME_DIGITS
pub const COMMIT_FILENAME_DIGITS: usize = storage::layout::COMMIT_FILENAME_DIGITS
Number of digits used in zero-padded commit file names.
Sourcepub fn new(location: TableLocation) -> Self
pub fn new(location: TableLocation) -> Self
Create a new TransactionLogStore rooted at a table directory.
Sourcepub fn location(&self) -> &TableLocation
pub fn location(&self) -> &TableLocation
Get the TableLocation of the LogStore.
Sourcepub async fn load_commit(&self, version: u64) -> Result<Commit, CommitError>
pub async fn load_commit(&self, version: u64) -> Result<Commit, CommitError>
Load a single commit by version.
- On storage-layer failures, returns
CommitError::Storage. - On JSON parse failures, returns
CommitError::CorruptState.
Sourcepub async fn load_current_version(&self) -> Result<u64, CommitError>
pub async fn load_current_version(&self) -> Result<u64, CommitError>
Load the CURRENT version pointer.
Behavior:
- If CURRENT does not exist, treat as a fresh table and return 0.
- If CURRENT contains invalid or empty content, return CorruptState.
Source§impl TransactionLogStore
impl TransactionLogStore
Sourcepub async fn rebuild_table_state(&self) -> Result<TableState, CommitError>
pub async fn rebuild_table_state(&self) -> Result<TableState, CommitError>
Rebuild the current TableState by replaying all commits up to CURRENT.
v0.1 behavior:
- If CURRENT == 0 (no commits), this returns CommitError::CorruptState.
- The first commit must include at least one UpdateTableMeta action to bootstrap TableMeta; the last UpdateTableMeta wins.
Trait Implementations§
Source§impl Clone for TransactionLogStore
impl Clone for TransactionLogStore
Source§fn clone(&self) -> TransactionLogStore
fn clone(&self) -> TransactionLogStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TransactionLogStore
impl RefUnwindSafe for TransactionLogStore
impl Send for TransactionLogStore
impl Sync for TransactionLogStore
impl Unpin for TransactionLogStore
impl UnsafeUnpin for TransactionLogStore
impl UnwindSafe for TransactionLogStore
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more