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

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, ) -> 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>, ) -> Self

source

pub(crate) fn new( name: String, base_dir: PathBuf, whitelisted_files: BTreeSet<PathBuf>, whitelisted_directories: BTreeSet<PathBuf>, ) -> 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 Clone for FsVolume

source§

fn clone(&self) -> FsVolume

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FsVolume

source§

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

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

impl PartialEq for FsVolume

source§

fn eq(&self, other: &FsVolume) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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>

source§

impl StructuralPartialEq for FsVolume

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

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

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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,

§

impl<T> MaybeSendSync for T