Skip to main content

TransactionFrameBatch

Struct TransactionFrameBatch 

Source
pub struct TransactionFrameBatch {
    pub frames: Vec<FrameSubmission>,
    pub conflict_pages: Vec<u32>,
    pub conflict_snapshot: Option<TransactionConflictSnapshot>,
    pub conflict_page_baselines: Vec<TransactionConflictPageBaseline>,
    pub context: TransactionFrameBatchContext,
    pub published_durable_freelist: Option<Vec<u32>>,
    pub freed_pages: Vec<u32>,
    pub consumed_freelist_pages: Vec<u32>,
    pub consumed_durable_freelist_pages: Vec<u32>,
}
Expand description

A batch of frames from a single transaction, submitted atomically.

Fields§

§frames: Vec<FrameSubmission>

Frames belonging to this transaction, in write order.

§conflict_pages: Vec<u32>

Pages that must obey first-committer-wins against committed WAL frames newer than this transaction’s read snapshot.

The process-local MVCC registry catches conflicts between connections in the same process. These fields carry the same commit intent through the process-global WAL group-commit queue so the eventual flusher can also reject stale cross-process commits under the WAL append gate.

§conflict_snapshot: Option<TransactionConflictSnapshot>

WAL visibility snapshot pinned when the submitting transaction began. If another process has committed any of conflict_pages after this horizon, the batch must fail with BUSY_SNAPSHOT instead of appending a stale page image that could hide the other writer’s committed rows.

§conflict_page_baselines: Vec<TransactionConflictPageBaseline>

Full-page hashes captured from the submitting transaction’s pinned snapshot, keyed by exact page number.

These are used only when an external checkpoint replaces/resets the WAL generation while the transaction is open. A generation change alone does not prove a write conflict: a stock SQLite reader can checkpoint an otherwise unchanged WAL. The eventual flusher may admit that benign transition only when every conflict candidate has a baseline and the latest committed full-page image hashes identically.

§context: TransactionFrameBatchContext

Lane-local staging context captured before group-commit submission.

§published_durable_freelist: Option<Vec<u32>>

bd-gh302 / bd-0shxy: the exact durable freelist content this batch’s page-1 + trunk frames publish, when the submitting transaction serialized freelist metadata (None otherwise). The publication is derived from the transaction’s BEGIN-TIME freelist view, so a peer may have consumed one of these pages since; the flusher must validate the list against the CURRENT durable freelist under the append gate and fail the batch closed instead of resurrecting a consumed page (“committed-freelist resurrection”: one physical page granted to multiple connections through re-published stale freelist state).

§freed_pages: Vec<u32>

Pages the submitting transaction itself durably freed in this commit. These legitimately appear in published_durable_freelist without being on the current durable freelist yet.

§consumed_freelist_pages: Vec<u32>

Committed-freelist pages the submitting transaction consumed (allocated) in this commit. These legitimately appear on the current durable freelist without being in published_durable_freelist; any OTHER page missing from the publication would be erased from the durable freelist (the dual of resurrection: a peer’s newly freed page silently dropped, leaking it as “never used”).

§consumed_durable_freelist_pages: Vec<u32>

bd-r82et: the subset of consumed_freelist_pages that was on the DURABLE freelist when the submitting transaction popped it — pages a peer connection could also have observed as committed-free. Only these are eligible for the append gate’s double-consumption refusal: a page consumed from the in-memory-only freelist (e.g. an aborted transaction’s returned EOF page) was never durably free, so no peer can have popped it and its absence from the current durable freelist is expected, not evidence of a conflict.

Implementations§

Source§

impl TransactionFrameBatch

Source

pub fn new(frames: Vec<FrameSubmission>) -> Self

Create a new batch with the given frames.

Source

pub fn with_freelist_publication( self, published_durable_freelist: Option<Vec<u32>>, freed_pages: Vec<u32>, consumed_freelist_pages: Vec<u32>, consumed_durable_freelist_pages: Vec<u32>, ) -> Self

Attach the durable-freelist publication this batch carries plus the submitting transaction’s own durably freed and consumed pages (bd-gh302/bd-0shxy). consumed_durable_freelist_pages is the subset of consumed_freelist_pages popped from the durable freelist (bd-r82et) — the only pops a peer could double-consume.

Source

pub fn with_conflict_snapshot( self, conflict_pages: Vec<u32>, conflict_snapshot: Option<TransactionConflictSnapshot>, ) -> Self

Attach cross-process conflict metadata for the submitting transaction.

Source

pub fn with_conflict_page_baselines( self, conflict_page_baselines: Vec<TransactionConflictPageBaseline>, ) -> Self

Attach snapshot-bound full-page hashes for WAL-generation transitions.

Source

pub fn with_context(self, context: TransactionFrameBatchContext) -> Self

Attach lane-local staging context to this batch.

Source

pub fn frame_count(&self) -> usize

Number of frames in this batch.

Source

pub fn has_commit_frame(&self) -> bool

Whether this batch contains a commit frame (last frame has db_size > 0).

Trait Implementations§

Source§

impl Clone for TransactionFrameBatch

Source§

fn clone(&self) -> TransactionFrameBatch

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransactionFrameBatch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more