Skip to main content

PageDevice

Trait PageDevice 

Source
pub trait PageDevice {
Show 13 methods // Required methods fn new_database_id(&mut self) -> Result<[u8; 16], LinkError>; fn data_length(&mut self) -> Result<u64, LinkError>; fn read_metadata( &mut self, slot: usize, ) -> Result<Option<Vec<u8>>, LinkError>; fn write_metadata( &mut self, slot: usize, bytes: &[u8; 128], ) -> Result<(), LinkError>; fn sync_metadata(&mut self, slot: usize) -> Result<(), LinkError>; fn read_page(&mut self, index: u64) -> Result<[u8; 4096], LinkError>; fn write_page( &mut self, index: u64, bytes: &[u8; 4096], ) -> Result<(), LinkError>; fn sync_data(&mut self) -> Result<(), LinkError>; fn truncate_data(&mut self, length: u64) -> Result<(), LinkError>; // Provided methods fn metadata_flags(&self) -> u32 { ... } fn read_checked_page( &mut self, index: u64, _expected: u64, ) -> Result<[u8; 4096], LinkError> { ... } fn complete_recovery(&mut self) -> Result<(), LinkError> { ... } fn supports_durable_flush(&self) -> bool { ... }
}
Expand description

Caller-owned exclusive synchronous storage. Successful sync must persist all preceding writes in that file. Mutation failure requires reopening the log.

Required Methods§

Source

fn new_database_id(&mut self) -> Result<[u8; 16], LinkError>

Source

fn data_length(&mut self) -> Result<u64, LinkError>

Source

fn read_metadata(&mut self, slot: usize) -> Result<Option<Vec<u8>>, LinkError>

Source

fn write_metadata( &mut self, slot: usize, bytes: &[u8; 128], ) -> Result<(), LinkError>

Source

fn sync_metadata(&mut self, slot: usize) -> Result<(), LinkError>

Source

fn read_page(&mut self, index: u64) -> Result<[u8; 4096], LinkError>

Source

fn write_page( &mut self, index: u64, bytes: &[u8; 4096], ) -> Result<(), LinkError>

Source

fn sync_data(&mut self) -> Result<(), LinkError>

Source

fn truncate_data(&mut self, length: u64) -> Result<(), LinkError>

Provided Methods§

Source

fn metadata_flags(&self) -> u32

Immutable physical format; the default preserves single-copy bytes.

Source

fn read_checked_page( &mut self, index: u64, _expected: u64, ) -> Result<[u8; 4096], LinkError>

Source

fn complete_recovery(&mut self) -> Result<(), LinkError>

Called only after the complete committed prefix validates.

Source

fn supports_durable_flush(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§