Trait avrox_storage::fs::FileSystemRead
source · pub trait FileSystemRead {
type FID: Copy;
const BLOCK_DATA_SIZE: usize;
// Required methods
fn read_from_location(
&self,
file: Self::FID,
block: BlockNumber,
offset: usize,
buf: &mut [u8]
) -> FileSystemResult<(usize, (BlockNumber, usize))>;
fn check_exists(&self, file: Self::FID) -> bool;
fn get_file_size(&self, file: Self::FID) -> FileSystemResult<FileAddr>;
fn get_free_space(&self) -> FileSystemResult<u64>;
fn block_and_offset_for_file_location(
&self,
file: Self::FID,
addr: FileAddr
) -> FileSystemResult<(BlockNumber, usize)>;
fn get_next_file_in_directory(
&self,
parent: Option<Self::FID>,
previous: Option<Self::FID>
) -> Option<Self::FID>;
}
Required Associated Types§
Required Associated Constants§
const BLOCK_DATA_SIZE: usize
Required Methods§
sourcefn read_from_location(
&self,
file: Self::FID,
block: BlockNumber,
offset: usize,
buf: &mut [u8]
) -> FileSystemResult<(usize, (BlockNumber, usize))>
fn read_from_location( &self, file: Self::FID, block: BlockNumber, offset: usize, buf: &mut [u8] ) -> FileSystemResult<(usize, (BlockNumber, usize))>
Read from the given file location into the buffer. The number of bytes read, and the new location at the end of the read, are returned.
This method does not guarantee to read all the bytes requested, you must pay attention to the number of bytes read returned.
sourcefn check_exists(&self, file: Self::FID) -> bool
fn check_exists(&self, file: Self::FID) -> bool
Check if the given file exists
sourcefn get_file_size(&self, file: Self::FID) -> FileSystemResult<FileAddr>
fn get_file_size(&self, file: Self::FID) -> FileSystemResult<FileAddr>
Return the size of the given file
sourcefn get_free_space(&self) -> FileSystemResult<u64>
fn get_free_space(&self) -> FileSystemResult<u64>
Return the approximate amount of free space, in bytes
sourcefn block_and_offset_for_file_location(
&self,
file: Self::FID,
addr: FileAddr
) -> FileSystemResult<(BlockNumber, usize)>
fn block_and_offset_for_file_location( &self, file: Self::FID, addr: FileAddr ) -> FileSystemResult<(BlockNumber, usize)>
Return the (block,offset) address for the given absolute file location (bytes since start of file).
Object Safety§
This trait is not object safe.