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§
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§
Sourcefn metadata_flags(&self) -> u32
fn metadata_flags(&self) -> u32
Immutable physical format; the default preserves single-copy bytes.
fn read_checked_page( &mut self, index: u64, _expected: u64, ) -> Result<[u8; 4096], LinkError>
Sourcefn complete_recovery(&mut self) -> Result<(), LinkError>
fn complete_recovery(&mut self) -> Result<(), LinkError>
Called only after the complete committed prefix validates.
fn supports_durable_flush(&self) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".