Struct avrox_storage::fs::SnafusFileSystem

source ·
pub struct SnafusFileSystem<SD>
where SD: Storage,
{ /* private fields */ }

Implementations§

source§

impl<SD> SnafusFileSystem<SD>
where SD: Storage,

source

pub fn with_driver(driver: SD) -> Self

source

pub fn is_formatted(&self) -> FileSystemResult<bool>
where SD: RandomRead,

True iff the filesystem is formatted and ready for use.

source

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,

§

type FID = FileUid

source§

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))>

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

Check if the given file exists
source§

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>

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)>

Return the (block,offset) address for the given absolute file location (bytes since start of file).
source§

fn get_next_file_in_directory( &self, _parent: Option<Self::FID>, previous: Option<Self::FID> ) -> Option<Self::FID>

Return the filesystem entry following the given filesystem entry in the directory listing
source§

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,

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>

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))>

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<()>

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<()>

Delete the given file. The directory entry and all space associated with the file is freed for reallocation.
source§

fn sync(&self) -> FileSystemResult<()>

Sync all data to the underlying storage
source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.