pub struct DiskManager { /* private fields */ }Expand description
Manages page-level I/O to a single data file. Each page is PAGE_SIZE bytes at offset = page_id * PAGE_SIZE.
Implementations§
Source§impl DiskManager
impl DiskManager
pub fn create(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Sourcepub fn allocate_page(&mut self) -> Result<u32>
pub fn allocate_page(&mut self) -> Result<u32>
Allocate a new page and extend the file. Returns the new page_id.
pub fn write_page(&mut self, page_id: u32, data: &[u8]) -> Result<()>
pub fn read_page(&self, page_id: u32) -> Result<[u8; 4096]>
pub fn flush(&mut self) -> Result<()>
pub fn num_pages(&self) -> u32
Auto Trait Implementations§
impl Freeze for DiskManager
impl RefUnwindSafe for DiskManager
impl Send for DiskManager
impl Sync for DiskManager
impl Unpin for DiskManager
impl UnsafeUnpin for DiskManager
impl UnwindSafe for DiskManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more