Struct avrox_storage::fs::SnafusFileSystem
source · pub struct SnafusFileSystem<SD>where
SD: Storage,{ /* private fields */ }
Implementations§
source§impl<SD> SnafusFileSystem<SD>where
SD: Storage,
impl<SD> SnafusFileSystem<SD>where
SD: Storage,
pub fn with_driver(driver: SD) -> Self
sourcepub fn is_formatted(&self) -> FileSystemResult<bool>where
SD: RandomRead,
pub fn is_formatted(&self) -> FileSystemResult<bool>where
SD: RandomRead,
True iff the filesystem is formatted and ready for use.
sourcepub fn format(&self) -> OxideResult<(), IoError>where
SD: RandomWrite + RandomRead,
pub fn format(&self) -> OxideResult<(), IoError>where
SD: RandomWrite + RandomRead,
Format the filesystem. All data will be lost.
Trait Implementations§
source§impl<SD> FileSystemRead for SnafusFileSystem<SD>where
SD: Storage + RandomRead,
impl<SD> FileSystemRead for SnafusFileSystem<SD>where
SD: Storage + RandomRead,
type FID = FileUid
const BLOCK_DATA_SIZE: usize = 250usize
source§fn 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. Read more
source§fn check_exists(&self, file: Self::FID) -> bool
fn check_exists(&self, file: Self::FID) -> bool
Check if the given file exists
source§fn 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
source§fn get_free_space(&self) -> FileSystemResult<u64>
fn get_free_space(&self) -> FileSystemResult<u64>
Return the approximate amount of free space, in bytes
source§fn 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).
source§impl<SD> FileSystemWrite for SnafusFileSystem<SD>where
SD: Storage + RandomRead + RandomWrite,
impl<SD> FileSystemWrite for SnafusFileSystem<SD>where
SD: Storage + RandomRead + RandomWrite,
source§fn open<P: Into<Self::FID>>(
&self,
fid: P,
options: &OpenOptions
) -> OxideResult<File<'_, Self>, IoError>where
Self: Sized,
fn open<P: Into<Self::FID>>(
&self,
fid: P,
options: &OpenOptions
) -> OxideResult<File<'_, Self>, IoError>where
Self: Sized,
Open or create the identified file with the options given.
See the
OpenOptions
documentation for further details.source§fn create_file(&self, file: Self::FID) -> OxideResult<(), IoError>
fn create_file(&self, file: Self::FID) -> OxideResult<(), IoError>
Create the given file, with zero length
source§fn write_at_location(
&self,
file: Self::FID,
block: BlockNumber,
offset: usize,
buf: &[u8]
) -> FileSystemResult<(usize, (BlockNumber, usize))>
fn write_at_location( &self, file: Self::FID, block: BlockNumber, offset: usize, buf: &[u8] ) -> FileSystemResult<(usize, (BlockNumber, usize))>
Write from the given buffer to the given file location. The number
of bytes written, and the new location at the end of the last write,
are returned. Read more
source§fn truncate_at(
&self,
file: Self::FID,
new_last_block: BlockNumber,
offset: usize
) -> FileSystemResult<()>
fn truncate_at( &self, file: Self::FID, new_last_block: BlockNumber, offset: usize ) -> FileSystemResult<()>
Truncate the given file so the location given points to the end of
the file. All remaining space is freed for re-allocation.
source§fn remove_file(&self, file: Self::FID) -> FileSystemResult<()>
fn remove_file(&self, file: Self::FID) -> FileSystemResult<()>
Delete the given file. The directory entry and all space associated
with the file is freed for reallocation.
source§fn sync(&self) -> FileSystemResult<()>
fn sync(&self) -> FileSystemResult<()>
Sync all data to the underlying storage
impl<SD> Sync for SnafusFileSystem<SD>where
SD: Storage,
Auto Trait Implementations§
impl<SD> !Freeze for SnafusFileSystem<SD>
impl<SD> RefUnwindSafe for SnafusFileSystem<SD>
impl<SD> Send for SnafusFileSystem<SD>where
SD: Send,
impl<SD> Unpin for SnafusFileSystem<SD>where
SD: Unpin,
impl<SD> UnwindSafe for SnafusFileSystem<SD>
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