pub struct ProjectedFs { /* private fields */ }Expand description
A projected filesystem that resolves paths against the DAG and serves file content from the CAS. An overlay captures writes.
Implementations§
Source§impl ProjectedFs
impl ProjectedFs
pub fn new(dag: Dag, root: ContentHash) -> Self
Sourcepub fn read_file(&self, path: &str) -> Result<Vec<u8>, ProjectedError>
pub fn read_file(&self, path: &str) -> Result<Vec<u8>, ProjectedError>
Read a file’s contents. Checks the overlay first, then the DAG/CAS.
Sourcepub fn list_dir(&self, path: &str) -> Result<Vec<String>, ProjectedError>
pub fn list_dir(&self, path: &str) -> Result<Vec<String>, ProjectedError>
List entries in a directory.
Sourcepub fn overlay_mut(&mut self) -> &mut Overlay
pub fn overlay_mut(&mut self) -> &mut Overlay
Get a mutable reference to the overlay.
Sourcepub fn root(&self) -> &ContentHash
pub fn root(&self) -> &ContentHash
Get the current root hash.
Sourcepub fn set_root(&mut self, root: ContentHash)
pub fn set_root(&mut self, root: ContentHash)
Update the root hash (after DAG invalidation).
Auto Trait Implementations§
impl Freeze for ProjectedFs
impl RefUnwindSafe for ProjectedFs
impl Send for ProjectedFs
impl Sync for ProjectedFs
impl Unpin for ProjectedFs
impl UnsafeUnpin for ProjectedFs
impl UnwindSafe for ProjectedFs
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