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: TransactionFrameBatchContextLane-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
impl TransactionFrameBatch
Sourcepub fn new(frames: Vec<FrameSubmission>) -> Self
pub fn new(frames: Vec<FrameSubmission>) -> Self
Create a new batch with the given frames.
Sourcepub 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
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.
Sourcepub fn with_conflict_snapshot(
self,
conflict_pages: Vec<u32>,
conflict_snapshot: Option<TransactionConflictSnapshot>,
) -> Self
pub fn with_conflict_snapshot( self, conflict_pages: Vec<u32>, conflict_snapshot: Option<TransactionConflictSnapshot>, ) -> Self
Attach cross-process conflict metadata for the submitting transaction.
Sourcepub fn with_conflict_page_baselines(
self,
conflict_page_baselines: Vec<TransactionConflictPageBaseline>,
) -> Self
pub fn with_conflict_page_baselines( self, conflict_page_baselines: Vec<TransactionConflictPageBaseline>, ) -> Self
Attach snapshot-bound full-page hashes for WAL-generation transitions.
Sourcepub fn with_context(self, context: TransactionFrameBatchContext) -> Self
pub fn with_context(self, context: TransactionFrameBatchContext) -> Self
Attach lane-local staging context to this batch.
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Number of frames in this batch.
Sourcepub fn has_commit_frame(&self) -> bool
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
impl Clone for TransactionFrameBatch
Source§fn clone(&self) -> TransactionFrameBatch
fn clone(&self) -> TransactionFrameBatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more