Skip to main content

RootfsProvider

Trait RootfsProvider 

Source
pub trait RootfsProvider: Send + Sync {
    // Required methods
    fn prepare(&self, box_dir: &Path, cache_dir: &Path) -> Result<PathBuf>;
    fn cleanup(&self, box_dir: &Path, persistent: bool) -> Result<()>;
    fn name(&self) -> &'static str;
}
Expand description

Abstracts how a rootfs directory is prepared for a box from a cached lower layer.

Required Methods§

Source

fn prepare(&self, box_dir: &Path, cache_dir: &Path) -> Result<PathBuf>

Prepare a rootfs at box_dir from the cached read-only layer at cache_dir. Returns the path to use as InstanceSpec.rootfs_path.

Source

fn cleanup(&self, box_dir: &Path, persistent: bool) -> Result<()>

Cleanup after box stops.

When persistent is true, the writable layer (overlay upper dir or copy rootfs) is preserved on disk so changes survive the next start. When false, the writable layer is wiped for a clean slate.

Source

fn name(&self) -> &'static str

Human-readable name for logging.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§