Struct wasmer_package::package::FsVolume
source · pub struct FsVolume {
name: String,
intermediate_directories: BTreeSet<PathBuf>,
metadata_files: BTreeSet<PathBuf>,
mapped_directories: BTreeSet<PathBuf>,
base_dir: PathBuf,
}
Expand description
A lazily loaded volume in a Wasmer package.
Note that it is the package resolver’s role to interpret a package’s
[crate::metadata::annotations::FileSystemMappings
]. 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.
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, ) -> 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>, ) -> Self
pub(crate) fn new( name: String, base_dir: PathBuf, whitelisted_files: BTreeSet<PathBuf>, whitelisted_directories: BTreeSet<PathBuf>, ) -> 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]>)>
Returnes the contents of the file associated with
path
and optionally, its hashsource§impl PartialEq for FsVolume
impl PartialEq for FsVolume
source§impl WasmerPackageVolume for FsVolume
impl WasmerPackageVolume for FsVolume
impl StructuralPartialEq for FsVolume
Auto 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 = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.