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: String
Name 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: PathBuf
The base directory all [PathSegments
] will be resolved relative to.
walker_factory: WalkBuilderFactory
The 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 hash