Skip to main content

WalBackendAdapter

Struct WalBackendAdapter 

Source
pub struct WalBackendAdapter<F: VfsFile> { /* private fields */ }

Implementations§

Source§

impl<F: VfsFile> WalBackendAdapter<F>

Source

pub fn new(wal: WalFile<F>) -> Self

Wrap an existing WalFile in the adapter (FEC disabled).

Source

pub fn with_fec_hook(wal: WalFile<F>, hook: FecCommitHook) -> Self

Wrap an existing WalFile with an FEC commit hook.

Source

pub fn has_pending_publication(&self) -> bool

Whether staged, unpublished frames remain.

Staged frames may already be durable — an intermediate sync makes them so without committing them — but they are not yet part of the published visibility plane. Callers that would discard, consume, or replace this adapter must check this first: dropping the staged metadata loses the batch, and a freshly wrapped adapter would republish those frames straight from the WAL with no knowledge of their publication state (GH #187).

Source

pub fn into_inner(self) -> Result<WalFile<F>>

Consume the adapter and return the inner WalFile.

Fails closed while staged, unpublished frames remain: consuming the adapter discards the staged publication metadata, and the WalFile can be rewrapped by an adapter that would then publish those frames without knowing whether they were ever published or fsynced (GH #187). Drain the batch with a successful commit sync first. Returns FrankenError::Busy: this is a retryable ordering condition, not database corruption.

Source

pub fn inner(&self) -> &WalFile<F>

Borrow the inner WalFile.

Source

pub fn inner_mut(&mut self) -> Result<&mut WalFile<F>>

Mutably borrow the inner WalFile for explicit external mutation.

Invalidates the publication plane, since the caller may mutate WAL state arbitrarily. That invalidation discards any staged batch, so this fails closed while one exists rather than silently dropping the commit horizon (GH #187): after the discard, a later publish would see no pending state and could expose frames that were never fsynced. Drain the batch with a successful sync first.

Source

pub fn published_snapshot(&self) -> WalPublicationSnapshot

Capture the currently published WAL visibility summary for this handle.

This is a cheap snapshot of the publication plane the adapter has already materialized. Call Self::refresh_published_snapshot first if the caller needs to bind to the latest on-disk committed prefix.

Source

pub fn pinned_read_snapshot(&self) -> Option<WalPublicationSnapshot>

Capture the currently pinned read snapshot, if this handle has one.

Source

pub async fn refresh_published_snapshot( &mut self, cx: &Cx, ) -> Result<WalPublicationSnapshot>

Refresh this handle from disk and republish the latest committed WAL visibility summary without pinning a read transaction.

Source

pub fn take_fec_pending(&mut self) -> Vec<FecCommitResult>

Take any pending FEC commit results for sidecar persistence.

Source

pub fn fec_enabled(&self) -> bool

Whether FEC encoding is active.

Source

pub fn fec_discard(&mut self)

Discard buffered FEC pages (e.g. on transaction rollback).

Trait Implementations§

Source§

impl<F: VfsFile> WalBackend for WalBackendAdapter<F>

Source§

fn begin_transaction<'a>(&'a mut self, cx: &'a Cx) -> WalFuture<'a, ()>

Prepare WAL state for a newly-started transaction. Read more
Source§

fn published_snapshot(&self) -> Option<WalPublicationSnapshot>

Capture the currently published WAL visibility summary for this handle. Read more
Source§

fn pinned_read_snapshot(&self) -> Option<WalPublicationSnapshot>

Capture the currently pinned read snapshot for this handle, if any. Read more
Source§

fn refresh_published_snapshot<'a>( &'a mut self, cx: &'a Cx, ) -> WalFuture<'a, Option<WalPublicationSnapshot>>

Refresh the published WAL visibility summary without pinning a new read transaction. Read more
Source§

fn publish_authorized_deferred_commit<'a>( &'a mut self, cx: &'a Cx, ) -> WalFuture<'a, ()>

Publish a commit batch that the pager’s parallel-WAL protocol has already authorized after every tracked write completed. Read more
Source§

fn append_frame<'a>( &'a mut self, cx: &'a Cx, page_number: u32, page_data: &'a [u8], db_size_if_commit: u32, ) -> WalFuture<'a, ()>

Append a single frame to the WAL. Read more
Source§

fn append_frames<'a>( &'a mut self, cx: &'a Cx, frames: &'a [WalFrameRef<'a>], ) -> WalFuture<'a, ()>

Append a batch of frames to the WAL. Read more
Source§

fn append_frames_tracked<'a>( &'a mut self, cx: &'a Cx, frames: &'a [WalFrameRef<'a>], completion: VfsWriteCompletion, ) -> WalFuture<'a, ()>

Append a batch while retaining a source-level completion observation. Read more
Source§

fn prepare_append_frames( &self, frames: &[WalFrameRef<'_>], ) -> Result<Option<PreparedWalFrameBatch>>

Prepare a batch of frames for a later append. Read more
Source§

fn finalize_prepared_frames( &self, _cx: &Cx, prepared: &mut PreparedWalFrameBatch, ) -> Result<()>

Optionally finalize a prepared batch before the serialized append. Read more
Source§

fn append_prepared_frames<'a>( &'a mut self, cx: &'a Cx, prepared: &'a mut PreparedWalFrameBatch, ) -> WalFuture<'a, ()>

Append a previously prepared frame batch. Read more
Source§

fn append_prepared_frames_tracked<'a>( &'a mut self, cx: &'a Cx, prepared: &'a mut PreparedWalFrameBatch, completion: VfsWriteCompletion, ) -> WalFuture<'a, ()>

Append a prepared batch with a caller-retained completion token.
Source§

fn read_page<'a>( &'a mut self, cx: &'a Cx, page_number: u32, ) -> WalFuture<'a, Option<Vec<u8>>>

Look up the latest version of a page in the current visible WAL snapshot. Read more
Source§

fn read_page_pinned<'a>( &'a self, cx: &'a Cx, page_number: u32, ) -> WalFuture<'a, Option<Vec<u8>>>

Read a page from the WAL using a previously pinned read snapshot. Read more
Source§

fn supports_pinned_reads(&self) -> bool

Whether this backend supports read_page_pinned (shared-lock reads). Read more
Source§

fn committed_txns_since_page<'a>( &'a mut self, cx: &'a Cx, page_number: u32, ) -> WalFuture<'a, u64>

Count committed transactions that occur after the latest committed frame for page_number in the current visible WAL snapshot. Read more
Source§

fn conflicting_pages_since_snapshot<'a>( &'a mut self, cx: &'a Cx, snapshot: TransactionConflictSnapshot, page_numbers: &'a [u32], _page_baselines: &'a [TransactionConflictPageBaseline], ) -> WalFuture<'a, Vec<u32>>

Return conflict pages that were committed after snapshot. Read more
Source§

fn committed_txn_count<'a>(&'a mut self, cx: &'a Cx) -> WalFuture<'a, u64>

Count committed transactions visible in the current WAL snapshot. Read more
Source§

fn sync(&mut self, cx: &Cx) -> Result<()>

Sync the WAL file to stable storage.
Source§

fn frame_count(&self) -> usize

Number of valid frames currently in the WAL.
Source§

fn checkpoint<'a>( &'a mut self, cx: &'a Cx, mode: CheckpointMode, writer: &'a mut dyn CheckpointPageWriter, backfilled_frames: u32, oldest_reader_frame: Option<u32>, ) -> WalFuture<'a, CheckpointResult>

Run a checkpoint to transfer frames from the WAL to the database. Read more
Source§

fn pinned_logical_read_snapshot<'a>( &'a self, _cx: &'a Cx, ) -> Pin<Box<dyn Future<Output = Result<Option<WalLogicalReadSnapshot>, FrankenError>> + Send + 'a>>

Return an authorized logical horizon for the currently pinned reader snapshot, if the backend can prove one. Read more
Source§

fn persist_parallel_wal_commit_certificate<'a>( &'a mut self, _cx: &'a Cx, _certificate: &'a ParallelWalCommitCertificate, _wal_frame_start: u64, _wal_frame_end: u64, _sync: bool, ) -> Pin<Box<dyn Future<Output = Result<(), FrankenError>> + Send + 'a>>

Append the certificate proof that authorizes the next WAL frame interval. Implementations must bind the record to their current WAL generation and make it durable when sync is true. Read more
Source§

fn persist_parallel_wal_commit_certificate_tracked<'a>( &'a mut self, cx: &'a Cx, certificate: &'a ParallelWalCommitCertificate, wal_frame_start: u64, wal_frame_end: u64, sync: bool, completion: VfsWriteCompletion, ) -> Pin<Box<dyn Future<Output = Result<(), FrankenError>> + Send + 'a>>

Persist the certificate sidecar write with source-level completion evidence retained independently of this future.
Source§

fn reconcile_parallel_wal_commit<'a>( &'a mut self, _cx: &'a Cx, _certificate: &'a ParallelWalCommitCertificate, _wal_frame_start: u64, _wal_frame_end: u64, _sync: bool, ) -> Pin<Box<dyn Future<Output = Result<ParallelWalCommitReconciliation, FrankenError>> + Send + 'a>>

Reconcile one exact in-doubt certificate and WAL interval while the caller retains the external writer gate. Read more
Source§

fn latest_authorized_parallel_wal_commit_certificate<'a>( &'a mut self, _cx: &'a Cx, ) -> Pin<Box<dyn Future<Output = Result<Option<ParallelWalCommitCertificate>, FrankenError>> + Send + 'a>>

Return the newest durable certificate usable to seed the next logical commit clock. Read more

Auto Trait Implementations§

§

impl<F> Freeze for WalBackendAdapter<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for WalBackendAdapter<F>
where F: RefUnwindSafe,

§

impl<F> Send for WalBackendAdapter<F>

§

impl<F> Sync for WalBackendAdapter<F>

§

impl<F> Unpin for WalBackendAdapter<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for WalBackendAdapter<F>
where F: UnsafeUnpin,

§

impl<F> UnwindSafe for WalBackendAdapter<F>
where F: UnwindSafe,

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> 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: 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> 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, 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, 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