Skip to main content

ContainerRuntime

Trait ContainerRuntime 

Source
pub trait ContainerRuntime {
    // Required methods
    fn name(&self) -> &str;
    fn health_check(&self) -> Result<RuntimeInfo>;
    fn pull(
        &self,
        image: &OciRef,
        progress: &dyn ProgressReporter,
    ) -> Result<ImageDigest>;
    fn run(&self, spec: &RunSpec) -> Result<RunOutcome>;
    fn inspect(&self, digest: &ImageDigest) -> Result<ImageMetadata>;
    fn gpu_args(&self, profile: &GpuProfile) -> Vec<String>;
    fn mount_args(&self, mounts: &[Mount]) -> Vec<String>;

    // Provided methods
    fn is_locally_available(&self, _image_ref: &str, digest: &str) -> bool { ... }
    fn ensure_layers(
        &self,
        _layers: &[LayerSpec],
        _progress: &dyn ProgressReporter,
    ) -> Result<()> { ... }
    fn assemble_image(
        &self,
        image: &OciRef,
        _layers: &[LayerSpec],
        progress: &dyn ProgressReporter,
    ) -> Result<ImageRef> { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Source

fn health_check(&self) -> Result<RuntimeInfo>

Source

fn pull( &self, image: &OciRef, progress: &dyn ProgressReporter, ) -> Result<ImageDigest>

Source

fn run(&self, spec: &RunSpec) -> Result<RunOutcome>

Source

fn inspect(&self, digest: &ImageDigest) -> Result<ImageMetadata>

Source

fn gpu_args(&self, profile: &GpuProfile) -> Vec<String>

Source

fn mount_args(&self, mounts: &[Mount]) -> Vec<String>

Provided Methods§

Source

fn is_locally_available(&self, _image_ref: &str, digest: &str) -> bool

Check whether image_ref@digest is already in the local Docker cache.

Source

fn ensure_layers( &self, _layers: &[LayerSpec], _progress: &dyn ProgressReporter, ) -> Result<()>

Pull only the specified layers, deduplicating against the local cache.

For factored_oci tools, callers pass the per-package layer list and the runtime ensures each layer blob is present locally before assemble_image is called.

The default implementation is a no-op (runtimes that don’t support factored pulls fall back to pull).

Source

fn assemble_image( &self, image: &OciRef, _layers: &[LayerSpec], progress: &dyn ProgressReporter, ) -> Result<ImageRef>

Assemble a runnable image from a manifest whose layers are all locally available (guaranteed by a preceding ensure_layers call).

Returns a locally-addressable ImageRef. The default implementation falls back to pull for runtimes that don’t support layer assembly.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§