pub trait CheckpointTarget {
// Required methods
fn write_page(
&mut self,
cx: &Cx,
page_no: PageNumber,
data: &[u8],
) -> Result<()>;
fn truncate_db(&mut self, cx: &Cx, n_pages: u32) -> Result<()>;
fn sync_db(&mut self, cx: &Cx) -> Result<()>;
// Provided method
fn read_page_if_supported(
&self,
_cx: &Cx,
_page_no: PageNumber,
_buf: &mut [u8],
) -> Result<Option<usize>> { ... }
}Expand description
Write-back interface for checkpoint page transfers.
Implementors push WAL frame content into the main database file.
This trait is intentionally not sealed so that fsqlite-core can
provide the concrete adapter at runtime.
Required Methods§
Sourcefn write_page(
&mut self,
cx: &Cx,
page_no: PageNumber,
data: &[u8],
) -> Result<()>
fn write_page( &mut self, cx: &Cx, page_no: PageNumber, data: &[u8], ) -> Result<()>
Write data for page_no directly to the database file.
Provided Methods§
Sourcefn read_page_if_supported(
&self,
_cx: &Cx,
_page_no: PageNumber,
_buf: &mut [u8],
) -> Result<Option<usize>>
fn read_page_if_supported( &self, _cx: &Cx, _page_no: PageNumber, _buf: &mut [u8], ) -> Result<Option<usize>>
Read back a page’s current on-disk content, if the target supports it. Used by the post-checkpoint checksum verification path (bd-yfdb6) to confirm that the DB file matches the expected state before the WAL is truncated.
The default implementation returns None, which skips verification.
Concrete CheckpointTargets that back a real VFS file should
override this with the equivalent of vfs.read(db_fd, buf, offset).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".