Skip to main content

GitFs

Struct GitFs 

Source
pub struct GitFs {
    pub repos_dir: PathBuf,
    pub mount_point: PathBuf,
    pub repos_map: DashMap<String, u16>,
    pub handles: FileHandles,
    /* private fields */
}

Fields§

§repos_dir: PathBuf§mount_point: PathBuf

Use helpers self.insert_repo and self.delete_repo <repo_id, repo>

§repos_map: DashMap<String, u16>

Use helpers self.insert_repo and self.delete_repo <repo_name, repo_id>

§handles: FileHandles

Implementations§

Source§

impl GitFs

Source

pub fn new( repos_dir: PathBuf, mount_point: PathBuf, read_only: bool, notifier: Arc<OnceLock<Notifier>>, ) -> Result<Arc<Self>>

Source

pub fn load_repo(&self, repo_name: &str) -> Result<()>

Source

pub fn new_repo( &self, repo_name: &str, url: Option<&str>, ) -> Result<Arc<GitRepo>>

Source

pub fn open( &self, ino: u64, read: bool, write: bool, truncate: bool, ) -> Result<u64>

Source

pub fn opendir(&self, ino: u64) -> Result<u64>

Source

pub fn read( &self, ino: u64, offset: u64, buf: &mut [u8], fh: u64, ) -> Result<usize>

Source

pub fn write(&self, ino: u64, offset: u64, buf: &[u8], fh: u64) -> Result<usize>

Source

pub fn release(&self, fh: u64) -> Result<bool>

Source

pub fn getattr(&self, target: u64) -> Result<FileAttr>

Source

pub fn mkdir(&self, parent: u64, os_name: &OsStr) -> Result<FileAttr>

Source

pub fn create( &self, parent: u64, name: &OsStr, read: bool, write: bool, ) -> Result<(FileAttr, u64)>

Source

pub fn rename( &self, parent: u64, name: &OsStr, new_parent: u64, new_name: &OsStr, ) -> Result<()>

Source

pub fn rmdir(&self, parent: u64, name: &OsStr) -> Result<()>

Source

pub fn readdir(&self, parent: u64) -> Result<Vec<DirectoryEntry>>

Source

pub fn readdirplus(&self, parent: u64) -> Result<Vec<DirectoryEntryPlus>>

Source

pub fn lookup(&self, parent: u64, name: &OsStr) -> Result<Option<FileAttr>>

Source

pub fn copy_file_range( &self, ino_in: u64, fh_in: u64, off_in: u64, ino_out: u64, fh_out: u64, off_out: u64, len: u64, ) -> Result<usize>

Source

pub fn prepare_virtual_file(&self, ino: VirtualIno) -> Result<FileAttr>

Source

pub fn prepare_virtual_folder(&self, attr: FileAttr) -> Result<FileAttr>

Source§

impl GitFs

Source

pub fn insert_repo( &self, repo: &Arc<GitRepo>, repo_name: &str, repo_id: u16, ) -> Result<()>

Source

pub fn delete_repo(&self, repo_name: &str) -> Result<()>

Source

pub fn update_repo(&self, repo_name: &str, remote: Option<String>) -> Result<()>

Source

pub fn refresh_medata_using_path<P: AsRef<Path>>( &self, path: P, ino_flag: InoFlag, ) -> Result<FileAttr>

Source

pub fn refresh_metadata_from_disk(&self, ino: NormalIno) -> Result<FileAttr>

Finds the file on disk using an inode

Source

pub fn update_db_metadata( &self, stored_attr: SetFileAttr, ) -> Result<DbReturn<FileAttr>>

Source

pub fn get_repo(&self, ino: u64) -> Result<Arc<GitRepo>>

Source

pub fn get_parent_commit(&self, ino: u64) -> Result<Oid>

Used in InoFlag::InsideSnap.

Will go up the directory tree and the commit_oid from the root Snap folder

Source

pub fn is_active(&self, target_ino: u64) -> Result<bool>

Used bu release

When releasing a filehandle, returns true if the inode can safely be deleted from storage

Source

pub fn count_children(&self, parent_ino: NormalIno) -> Result<usize>

Source

pub fn read_children( &self, parent_ino: NormalIno, build_dir: bool, ) -> Result<Vec<DirectoryEntry>>

Source

pub fn get_all_parents(&self, ino: u64) -> Result<Vec<u64>>

Source

pub fn get_single_parent(&self, ino: u64) -> Result<u64>

Source

pub fn repo_id_to_ino(repo_id: u16) -> u64

Source

pub fn ino_to_repo_id(ino: u64) -> u16

Source

pub fn get_metadata_by_name( &self, parent_ino: NormalIno, child_name: &OsStr, ) -> Result<DbReturn<FileAttr>>

Source

pub fn get_metadata(&self, target_ino: u64) -> Result<DbReturn<FileAttr>>

Source

pub fn exists(&self, ino: Inodes) -> Result<bool>

Takes Inodes as virtual inodes do not “exist”

Source

pub fn is_virtual(&self, ino: u64) -> bool

Source

pub fn write_dentry(&self, dentry: Dentry) -> Result<()>

Source

pub fn parent_commit_build_session(&self, ino: NormalIno) -> Result<Oid>

Source

pub fn get_ino_flag_from_db(&self, ino: NormalIno) -> Result<InoFlag>

Source

pub fn get_name_from_db(&self, ino: u64) -> Result<OsString>

Auto Trait Implementations§

§

impl !Freeze for GitFs

§

impl !RefUnwindSafe for GitFs

§

impl !UnwindSafe for GitFs

§

impl Send for GitFs

§

impl Sync for GitFs

§

impl Unpin for GitFs

§

impl UnsafeUnpin for GitFs

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> MaybeSend for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more