pub struct Q42Journal<S: Read + Write + Seek> {
pub storage: S,
pub header: JournalHeader,
/* private fields */
}Expand description
Core Journal Engine managing durable appending and atomic replay.
Fields§
§storage: S§header: JournalHeaderImplementations§
Source§impl<S: Read + Write + Seek> Q42Journal<S>
impl<S: Read + Write + Seek> Q42Journal<S>
Sourcepub fn create(storage: S, header: JournalHeader) -> Result<Self, JournalError>
pub fn create(storage: S, header: JournalHeader) -> Result<Self, JournalError>
Initialize a new journal with the given storage and header.
Sourcepub fn open(
storage: S,
expected_base_digest: &[u8; 32],
) -> Result<Self, JournalError>
pub fn open( storage: S, expected_base_digest: &[u8; 32], ) -> Result<Self, JournalError>
Open and validate an existing journal from storage.
Sourcepub fn open_any(storage: S) -> Result<Self, JournalError>
pub fn open_any(storage: S) -> Result<Self, JournalError>
Open and validate an existing journal from storage with any base digest.
Sourcepub fn append_transaction(
&mut self,
tx: &JournalTransaction,
) -> Result<(), JournalError>
pub fn append_transaction( &mut self, tx: &JournalTransaction, ) -> Result<(), JournalError>
Atomically appends a complete transaction to the journal.
Sourcepub fn recover_transactions(
&mut self,
) -> Result<Vec<JournalTransaction>, JournalError>
pub fn recover_transactions( &mut self, ) -> Result<Vec<JournalTransaction>, JournalError>
Replays the journal and recovers all committed transactions. Safely ignores torn uncommitted transactions at the tail.
Sourcepub fn append_topology_delta(
&mut self,
tx_id: u32,
tick: u64,
delta_bytes: &[u8],
) -> Result<(), JournalError>
pub fn append_topology_delta( &mut self, tx_id: u32, tick: u64, delta_bytes: &[u8], ) -> Result<(), JournalError>
Appends a TopologyDelta (0x06) frame carrying a 16-byte TopologicalDeltaEntry payload.
Sourcepub fn append_topology_seal(
&mut self,
tx_id: u32,
tick: u64,
geometry_id: u64,
segment_crc32c: u32,
graph_count: u16,
) -> Result<(), JournalError>
pub fn append_topology_seal( &mut self, tx_id: u32, tick: u64, geometry_id: u64, segment_crc32c: u32, graph_count: u16, ) -> Result<(), JournalError>
Appends a TopologySeal (0x07) frame carrying [geometry_id: u64 LE, crc32c: u32 LE, slot_count: u32 LE].
Sourcepub fn reset_to_generation(
&mut self,
new_base_digest: [u8; 32],
new_generation: u64,
) -> Result<(), JournalError>
pub fn reset_to_generation( &mut self, new_base_digest: [u8; 32], new_generation: u64, ) -> Result<(), JournalError>
Reset journal back to empty header after a checkpoint compaction.
Auto Trait Implementations§
impl<S> Freeze for Q42Journal<S>where
S: Freeze,
impl<S> RefUnwindSafe for Q42Journal<S>where
S: RefUnwindSafe,
impl<S> Send for Q42Journal<S>where
S: Send,
impl<S> Sync for Q42Journal<S>where
S: Sync,
impl<S> Unpin for Q42Journal<S>where
S: Unpin,
impl<S> UnsafeUnpin for Q42Journal<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Q42Journal<S>where
S: UnwindSafe,
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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