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§
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§
Sourcefn is_locally_available(&self, _image_ref: &str, digest: &str) -> bool
fn is_locally_available(&self, _image_ref: &str, digest: &str) -> bool
Check whether image_ref@digest is already in the local Docker cache.
Sourcefn ensure_layers(
&self,
_layers: &[LayerSpec],
_progress: &dyn ProgressReporter,
) -> Result<()>
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).
Sourcefn assemble_image(
&self,
image: &OciRef,
_layers: &[LayerSpec],
progress: &dyn ProgressReporter,
) -> Result<ImageRef>
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.