FsMetadataStore

Struct FsMetadataStore 

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

SochFS Metadata Store

Manages filesystem metadata with ACID guarantees via LSCS system tables.

Implementations§

Source§

impl FsMetadataStore

Source

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

Create a new metadata store

Source

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

Initialize filesystem (create root if needed)

Source

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

Get inode by ID

Source

pub fn create_inode(&self, file_type: FileType) -> Result<Inode>

Create a new inode

Source

pub fn update_inode(&self, inode: &Inode) -> Result<()>

Update an inode

Source

pub fn delete_inode(&self, id: InodeId) -> Result<()>

Delete an inode

Source

pub fn add_dir_entry( &self, parent_id: InodeId, name: &str, child_id: InodeId, file_type: FileType, ) -> Result<()>

Add directory entry

Source

pub fn remove_dir_entry(&self, parent_id: InodeId, name: &str) -> Result<()>

Remove directory entry

Source

pub fn list_dir(&self, parent_id: InodeId) -> Vec<DirEntryRow>

List directory entries

Source

pub fn lookup(&self, parent_id: InodeId, name: &str) -> Option<InodeId>

Lookup entry in directory

Source

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

Resolve path to inode

O(d) where d = path depth

Source

pub fn create_file(&self, parent_id: InodeId, name: &str) -> Result<Inode>

Create file in directory

Source

pub fn create_dir(&self, parent_id: InodeId, name: &str) -> Result<Inode>

Create directory in parent

Source

pub fn delete(&self, parent_id: InodeId, name: &str) -> Result<()>

Delete file or empty directory

Source

pub fn superblock(&self) -> Superblock

Get superblock

Source

pub fn update_superblock(&self, sb: &Superblock) -> Result<()>

Update superblock

Source

pub fn replay_wal_op(&self, op: &FsWalOp) -> Result<()>

Recover from WAL operations

Auto Trait Implementations§

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.