Skip to main content

Vfs

Struct Vfs 

Source
pub struct Vfs { /* private fields */ }

Implementations§

Source§

impl Vfs

Source

pub fn none() -> Self

A VFS that backs no directory. Every submilli:fs.* call traps; only fs.info() works (reporting mode: none).

Source

pub fn external_with_mode(root: PathBuf, mode: VfsMode) -> Result<Self>

Mount an existing host directory the interpreter does not own. Used for named roots and for per_session dirs owned by the server.

Source

pub fn external(root: PathBuf) -> Result<Self>

An existing host directory, as submilli run --vfs exposes it.

Source

pub fn tempdir() -> Result<Self>

Source

pub fn tempdir_in(parent: &Path) -> Result<Self>

Like tempdir but allocated under parent (created if absent). Lets the host place ephemeral scratch on a chosen volume.

Source

pub fn root(&self) -> &Path

The host path backing this VFS. Server-side logging and test setup only — it is never the thing a guest path is resolved against. Empty for VfsMode::None.

Source

pub fn dir(&self) -> Option<&Arc<Dir>>

The capability handle guest paths resolve against, or None under VfsMode::None.

A handle outlives the directory it was opened on: after the root is deleted the handle still answers is_dir(), so it is not a liveness check.

Source

pub fn mode(&self) -> VfsMode

Source

pub fn with_size_limit(self, limit: u64) -> Self

Enforce limit bytes on the files this VFS holds, starting from what the directory holds now; see with_measured_limit.

Source

pub fn with_measured_limit(self, limit: u64, used: Option<u64>) -> Self

Enforce limit bytes, starting from used, what a walk of the directory found. A directory already over the limit still opens: reads and removals work, and writes that grow it are refused until it is back under. One that couldn’t be measured (None) opens the same way, as if full, so a program can still remove files and let a later run measure it.

Source

pub fn with_shared_quota(self, quota: Arc<DiskQuota>) -> Self

Charge the root to quota, a limit the server shares between every VFS that opens the same named volume.

Source

pub fn quota(&self) -> Option<&Arc<DiskQuota>>

The root’s size limit and its running count, when one applies.

Source

pub fn with_access(self, access: Access) -> Self

Whether guest code may change the root. Mounts carry their own access.

Source

pub fn access(&self) -> Access

Source

pub fn with_volume_name(self, volume: &str) -> Self

Record the named volume backing the root, for fs.info().

Source

pub fn volume(&self) -> Option<&str>

Source

pub fn mounts(&self) -> &[Mount]

Source

pub fn with_mount(self, spec: MountSpec) -> Result<Self, MountError>

Graft the volume spec describes at its guest path.

In a writable root the mount point is created as an empty directory, so listing its parent shows it like any other directory. A read-only root is never written, so there the mount point must already exist.

Source

pub fn with_mount_subpath( self, spec: MountSpec, sub_path: Option<&str>, ) -> Result<Self, MountError>

Source

pub fn with_mount_quota(self, guest_path: &str, quota: Arc<DiskQuota>) -> Self

Charge the volume mounted at guest_path to quota, the limit the server shares between every VFS that mounts it. No mount there is a no-op.

Source

pub fn locate(&self, rel: &Path) -> Option<(Arc<Dir>, PathBuf, Placement)>

Route a root-relative path (as the lexical pass produced it) to the volume that holds it: the handle to open it through, the path relative to that handle, and the volume’s placement. None under VfsMode::None.

Matching is by whole components, so /memoryx is not under /memory. A mount point itself resolves to its volume’s root, ..

Source

pub fn cwd(&self) -> &str

Guest working directory shared by I/O, policy, and introspection.

Source

pub fn with_cwd(self, cwd: &str) -> Result<Self, ContainError>

Source

pub fn with_subpath(self, sub_path: Option<&str>) -> Result<Self>

Select a directory through the volume handle, without ambient reopening.

Source

pub fn measure_usage(&self) -> Result<u64>

The bytes held by regular files under the root; see measure_dir.

Trait Implementations§

Source§

impl Clone for Vfs

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Vfs

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Vfs

§

impl RefUnwindSafe for Vfs

§

impl Send for Vfs

§

impl Sync for Vfs

§

impl Unpin for Vfs

§

impl UnsafeUnpin for Vfs

§

impl UnwindSafe for Vfs

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

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more