pub struct MountSpec {
pub mode: MountSpecMode,
pub write_bytes_limit: Option<u64>,
pub memory_usage_limit: u64,
/* private fields */
}Expand description
A host directory mounted into the sandbox for one feed. Mounts are handled
entirely on the parent: the checkout services covered filesystem OS calls
from the host path itself (so mounts work even when the worker runs on a
remote machine). Every OS call still surfaces as a TurnEvent::OsCall;
mounts are consulted only when the caller asks, via
Checkout::resume_from_mounts.
Fields§
§mode: MountSpecModeAccess mode.
write_bytes_limit: Option<u64>Cap on total bytes written through this mount.
memory_usage_limit: u64Aggregate budget for retained overlay data and transient results.
Implementations§
Source§impl MountSpec
impl MountSpec
Sourcepub fn new(
virtual_path: &str,
host_path: impl AsRef<Path>,
mode: MountSpecMode,
) -> Result<Self, PoolError>
pub fn new( virtual_path: &str, host_path: impl AsRef<Path>, mode: MountSpecMode, ) -> Result<Self, PoolError>
Opens host_path and creates mount configuration with the default
memory budget (monty_fs::DEFAULT_MEMORY_USAGE_LIMIT) and no cumulative write limit.
Build this once and reuse it; each call resolves the path afresh. The
open is blocking filesystem I/O, so an async caller opening a directory
that may stall (NFS, FUSE) should either build the spec before entering
the runtime or open the MountRoot under spawn_blocking and pass it
to Self::from_root. Feeds never reopen it, so this cost is paid once
per mount rather than once per feed.
§Errors
Returns PoolError::Runtime if the virtual path is not absolute, or
the host path cannot be opened as a directory.
Sourcepub fn from_root(root: MountRoot, mode: MountSpecMode) -> Self
pub fn from_root(root: MountRoot, mode: MountSpecMode) -> Self
Creates mount configuration from an already-opened MountRoot, for
hosts that open it themselves to map failures their own way.
Sourcepub fn virtual_path(&self) -> &str
pub fn virtual_path(&self) -> &str
Returns the normalized virtual path this mount answers on.