Struct FsVolume

Source
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

Source

pub(crate) const METADATA: &'static str = "metadata"

The name of the volume used to store metadata files.

Source

pub(crate) fn new_metadata( manifest: &Manifest, base_dir: impl Into<PathBuf>, ) -> Result<Self, Error>

Create a new metadata volume.

Source

pub(crate) fn new_assets( manifest: &Manifest, base_dir: &Path, walker_factory: WalkBuilderFactory, ) -> Result<BTreeMap<String, Self>, Error>

Source

pub(crate) fn new_with_intermediate_dirs( name: String, base_dir: PathBuf, whitelisted_files: BTreeSet<PathBuf>, whitelisted_directories: BTreeSet<PathBuf>, walker_factory: WalkBuilderFactory, ) -> Self

Source

pub(crate) fn new( name: String, base_dir: PathBuf, whitelisted_files: BTreeSet<PathBuf>, whitelisted_directories: BTreeSet<PathBuf>, walker_factory: WalkBuilderFactory, ) -> Self

Source

fn is_accessible(&self, path: &Path) -> bool

Source

fn resolve(&self, path: &PathSegments) -> Option<PathBuf>

Source

pub fn name(&self) -> &str

Returns the name of the volume

Source

pub fn read_file(&self, path: &PathSegments) -> Option<OwnedBuffer>

Read a file from the volume.

Source

pub fn read_dir( &self, path: &PathSegments, ) -> Option<Vec<(PathSegment, Option<[u8; 32]>, Metadata)>>

Read the contents of a directory.

Source

pub fn metadata(&self, path: &PathSegments) -> Option<Metadata>

Get the metadata for a particular item.

Source

pub(crate) fn as_directory_tree( &self, strictness: Strictness, ) -> Result<Directory<'_>, Error>

Trait Implementations§

Source§

impl AbstractVolume for FsVolume

Source§

fn read_file( &self, path: &PathSegments, ) -> Option<(OwnedBuffer, Option<[u8; 32]>)>

Returnes the contents of the file associated with path and optionally, its hash
Source§

fn read_dir( &self, path: &PathSegments, ) -> Option<Vec<(PathSegment, Option<[u8; 32]>, Metadata)>>

Returns the entries of path
Source§

fn metadata(&self, path: &PathSegments) -> Option<Metadata>

Returns the metadata of the entry associated with path
Source§

impl Debug for FsVolume

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl WasmerPackageVolume for FsVolume

Source§

fn as_directory_tree( &self, strictness: Strictness, ) -> Result<Directory<'_>, Error>

Serialize the volume as a [webc::v3::write::Directory].
Source§

fn as_volume(self: Arc<Self>) -> Arc<dyn AbstractVolume + Send + Sync + 'static>

Auto Trait Implementations§

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
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoSuper<dyn AbstractVolume + Send + Sync> for T
where T: AbstractVolume + Send + Sync + 'static,

Source§

fn into_super(self: Arc<T>) -> Arc<dyn AbstractVolume + Send + Sync>

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> ErasedDestructor for T
where T: 'static,