pub trait DatabaseStorage: Send + Sync {
// Required methods
fn read_header(&self, c: Completion) -> Result<Completion>;
fn read_page(
&self,
page_idx: usize,
io_ctx: &IOContext,
c: Completion,
) -> Result<Completion>;
fn write_page(
&self,
page_idx: usize,
buffer: Arc<Buffer>,
io_ctx: &IOContext,
c: Completion,
) -> Result<Completion>;
fn write_pages(
&self,
first_page_idx: usize,
page_size: usize,
buffers: Vec<Arc<Buffer>>,
io_ctx: &IOContext,
c: Completion,
) -> Result<Completion>;
fn sync(&self, c: Completion, sync_type: FileSyncType) -> Result<Completion>;
fn size(&self) -> Result<u64>;
fn truncate(&self, len: usize, c: Completion) -> Result<Completion>;
}Expand description
DatabaseStorage is an interface a database file that consists of pages.
The purpose of this trait is to abstract the upper layers of Limbo from the storage medium. A database can either be a file on disk, like in SQLite, or something like a remote page server service.
Required Methods§
fn read_header(&self, c: Completion) -> Result<Completion>
fn read_page( &self, page_idx: usize, io_ctx: &IOContext, c: Completion, ) -> Result<Completion>
fn write_page( &self, page_idx: usize, buffer: Arc<Buffer>, io_ctx: &IOContext, c: Completion, ) -> Result<Completion>
fn write_pages( &self, first_page_idx: usize, page_size: usize, buffers: Vec<Arc<Buffer>>, io_ctx: &IOContext, c: Completion, ) -> Result<Completion>
fn sync(&self, c: Completion, sync_type: FileSyncType) -> Result<Completion>
fn size(&self) -> Result<u64>
fn truncate(&self, len: usize, c: Completion) -> Result<Completion>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".