Skip to main content

PathRefreshingWalBackend

Struct PathRefreshingWalBackend 

Source
pub struct PathRefreshingWalBackend<V: Vfs>
where V::File: Send + Sync + 'static,
{ /* private fields */ }
Expand description

WAL backend that can recover when the path-visible -wal sidecar is removed or replaced while this process still owns an old file descriptor.

Real SQLite can checkpoint and unlink/reset db-wal when it does not know about a live FrankenSQLite handle. WalFile::refresh is intentionally descriptor-local, so it cannot notice that path-level mutation. This wrapper performs a path probe before mutable WAL operations and swaps in a freshly opened/created WalFile when the path-visible sidecar no longer matches the open handle.

Implementations§

Source§

impl<V> PathRefreshingWalBackend<V>
where V: Vfs + 'static, V::File: Send + Sync + 'static,

Source

pub fn new( vfs: V, db_path: impl AsRef<Path>, wal_path: impl AsRef<Path>, page_size: u32, wal: WalFile<V::File>, create_missing: bool, namespace_binding: Option<Arc<DatabaseNamespaceBinding>>, ) -> Self

Source

pub fn into_inner(self) -> WalBackendAdapter<V::File>

Trait Implementations§

Source§

impl<V> WalBackend for PathRefreshingWalBackend<V>
where V: Vfs + 'static, V::File: Send + Sync + 'static,

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 pinned_logical_read_snapshot<'a>( &'a self, cx: &'a Cx, ) -> WalFuture<'a, Option<WalLogicalReadSnapshot>>

Return an authorized logical horizon for the currently pinned reader snapshot, if the backend can prove one. 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 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, ) -> WalFuture<'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, ) -> WalFuture<'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, ) -> WalFuture<'a, ParallelWalCommitReconciliation>

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, ) -> WalFuture<'a, Option<ParallelWalCommitCertificate>>

Return the newest durable certificate usable to seed the next logical commit clock. Read more
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

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> 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