pub struct LogicalLog {
pub file: Arc<dyn File>,
pub offset: u64,
pub running_crc: u32,
/* private fields */
}Fields§
§file: Arc<dyn File>§offset: u64§running_crc: u32Running CRC state for chained checksums. Seeded from the header salt;
updated after each committed frame. The next frame’s CRC is computed as
crc32c_append(running_crc, frame_bytes).
Implementations§
Source§impl LogicalLog
impl LogicalLog
pub fn new( file: Arc<dyn File>, io: Arc<dyn IO>, encryption_ctx: Option<EncryptionContext>, ) -> Self
Sourcepub fn log_tx(&mut self, tx: LogRecord) -> Result<Completion>
pub fn log_tx(&mut self, tx: LogRecord) -> Result<Completion>
Writes a transaction to the log and immediately advances the writer offset. Used for checkpoint-initiated writes where no two-phase commit is needed.
pub fn upgrade_header_for_log_tx( &mut self, tx: &LogRecord, ) -> Result<Option<Completion>>
Sourcepub fn log_tx_deferred_offset(
&mut self,
tx: LogRecord,
on_serialization_complete: OnSerializationComplete<'_>,
) -> Result<(Completion, u64)>
pub fn log_tx_deferred_offset( &mut self, tx: LogRecord, on_serialization_complete: OnSerializationComplete<'_>, ) -> Result<(Completion, u64)>
Writes a transaction to the log but does NOT advance the writer offset.
Returns (completion, bytes_written). The caller must call
advance_offset_after_success(bytes) after confirming the commit succeeded.
If on_serialization_complete is provided, it is called with shared
ownership of the framed bytes and the running CRC after framing but
before the disk write.
pub fn advance_offset_after_success(&mut self, bytes: u64)
pub fn sync(&mut self, sync_type: FileSyncType) -> Result<Completion>
pub fn update_header(&mut self) -> Result<Completion>
Sourcepub fn truncate(&mut self, checkpointed_through_ts: u64) -> Result<Completion>
pub fn truncate(&mut self, checkpointed_through_ts: u64) -> Result<Completion>
Truncate when max_appended_commit_ts <= boundary; passive uses durable_txid_max_new,
truncate mode uses u64::MAX (always empty after checkpoint).
Sourcepub fn reset_to_fresh_header(&mut self) -> Result<Completion>
pub fn reset_to_fresh_header(&mut self) -> Result<Completion>
Reset the log to a header-only file and return one completion for the header write plus truncate.
This intentionally truncates to LOG_HDR_SIZE, not zero, so the header
write and truncate can run as a group without an ordering dependency.
Either completion order leaves a header-sized file with the fresh header
bytes at offset zero.
Auto Trait Implementations§
impl !RefUnwindSafe for LogicalLog
impl !UnwindSafe for LogicalLog
impl Freeze for LogicalLog
impl Send for LogicalLog
impl Sync for LogicalLog
impl Unpin for LogicalLog
impl UnsafeUnpin for LogicalLog
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
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> ⓘ
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