pub struct FsVolume {
name: String,
intermediate_directories: BTreeSet<PathBuf>,
metadata_files: BTreeSet<PathBuf>,
mapped_directories: BTreeSet<PathBuf>,
base_dir: PathBuf,
walker_factory: WalkBuilderFactory,
}Expand description
A lazily loaded volume in a Wasmer package.
Note that it is the package resolver’s role to interpret a package’s filesystem mappings. A volume contains directories as they were when the package was published.
Fields§
§name: StringName of the volume
intermediate_directories: BTreeSet<PathBuf>A pre-computed set of intermediate directories that are needed to allow access to the whitelisted files and directories.
metadata_files: BTreeSet<PathBuf>Specific files that this volume has access to.
mapped_directories: BTreeSet<PathBuf>Directories that allow the user to access anything inside them.
base_dir: PathBufThe base directory all [PathSegments] will be resolved relative to.
walker_factory: WalkBuilderFactoryThe walker builder factory to use when reading directories.
Implementations§
Source§impl FsVolume
impl FsVolume
Sourcepub(crate) const METADATA: &'static str = "metadata"
pub(crate) const METADATA: &'static str = "metadata"
The name of the volume used to store metadata files.
Sourcepub(crate) fn new_metadata(
manifest: &Manifest,
base_dir: impl Into<PathBuf>,
) -> Result<Self, Error>
pub(crate) fn new_metadata( manifest: &Manifest, base_dir: impl Into<PathBuf>, ) -> Result<Self, Error>
Create a new metadata volume.
pub(crate) fn new_assets( manifest: &Manifest, base_dir: &Path, walker_factory: WalkBuilderFactory, ) -> Result<BTreeMap<String, Self>, Error>
pub(crate) fn new_with_intermediate_dirs( name: String, base_dir: PathBuf, whitelisted_files: BTreeSet<PathBuf>, whitelisted_directories: BTreeSet<PathBuf>, walker_factory: WalkBuilderFactory, ) -> Self
pub(crate) fn new( name: String, base_dir: PathBuf, whitelisted_files: BTreeSet<PathBuf>, whitelisted_directories: BTreeSet<PathBuf>, walker_factory: WalkBuilderFactory, ) -> Self
fn is_accessible(&self, path: &Path) -> bool
fn resolve(&self, path: &PathSegments) -> Option<PathBuf>
Sourcepub fn read_file(&self, path: &PathSegments) -> Option<OwnedBuffer>
pub fn read_file(&self, path: &PathSegments) -> Option<OwnedBuffer>
Read a file from the volume.
Sourcepub fn read_dir(
&self,
path: &PathSegments,
) -> Option<Vec<(PathSegment, Option<[u8; 32]>, Metadata)>>
pub fn read_dir( &self, path: &PathSegments, ) -> Option<Vec<(PathSegment, Option<[u8; 32]>, Metadata)>>
Read the contents of a directory.
Sourcepub fn metadata(&self, path: &PathSegments) -> Option<Metadata>
pub fn metadata(&self, path: &PathSegments) -> Option<Metadata>
Get the metadata for a particular item.
pub(crate) fn as_directory_tree( &self, strictness: Strictness, ) -> Result<Directory<'_>, Error>
Trait Implementations§
Source§impl AbstractVolume for FsVolume
impl AbstractVolume for FsVolume
Source§fn read_file(
&self,
path: &PathSegments,
) -> Option<(OwnedBuffer, Option<[u8; 32]>)>
fn read_file( &self, path: &PathSegments, ) -> Option<(OwnedBuffer, Option<[u8; 32]>)>
path and optionally, its hashAuto Trait Implementations§
impl Freeze for FsVolume
impl RefUnwindSafe for FsVolume
impl Send for FsVolume
impl Sync for FsVolume
impl Unpin for FsVolume
impl UnwindSafe for FsVolume
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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