SochFS

Struct SochFS 

Source
pub struct SochFS { /* private fields */ }
Expand description

SochFS - Complete filesystem layer

Implementations§

Source§

impl SochFS

Source

pub fn new<W, L, BW, BR>( write_fn: W, wal_fn: L, block_write_fn: BW, block_read_fn: BR, ) -> Self
where W: Fn(&[u8], &[u8]) -> Result<()> + Send + Sync + 'static, L: Fn(&FsWalOp) -> Result<()> + Send + Sync + 'static, BW: Fn(u64, &[u8]) -> Result<u64> + Send + Sync + 'static, BR: Fn(u64, usize) -> Result<Vec<u8>> + Send + Sync + 'static,

Create new SochFS instance

Source

pub fn init(&self) -> Result<()>

Initialize filesystem

Source

pub fn resolve(&self, path: &str) -> Result<InodeId>

Resolve path to inode

Source

pub fn get_inode(&self, id: InodeId) -> Option<Inode>

Get inode

Source

pub fn create_file(&self, path: &str) -> Result<Inode>

Create file

Source

pub fn mkdir(&self, path: &str) -> Result<Inode>

Create directory

Source

pub fn delete(&self, path: &str) -> Result<()>

Delete file or empty directory

Source

pub fn readdir(&self, path: &str) -> Result<Vec<DirEntry>>

List directory

Source

pub fn write_file(&self, path: &str, data: &[u8]) -> Result<usize>

Write file data

Source

pub fn read_file(&self, path: &str) -> Result<Vec<u8>>

Read file data

Source

pub fn stat(&self, path: &str) -> Result<Inode>

Get file stat

Auto Trait Implementations§

§

impl !Freeze for SochFS

§

impl !RefUnwindSafe for SochFS

§

impl Send for SochFS

§

impl Sync for SochFS

§

impl Unpin for SochFS

§

impl !UnwindSafe for SochFS

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

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

Source§

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.