Image::* methods use the active default backend and return Unsupported when that backend is cloud. The *_local variants take an explicit LocalBackend and never consult ambient backend state.
Ambient cache methods5
Image::get()one cached imageImage::list()all cached imagesImage::inspect()config + layer detailImage::remove()delete a cached imageImage::prune()reclaim unused dataExplicit local variants5
Image::*_local()operate on a LocalBackendTypes
Typical flow
Ambient cache methods
These methods resolve the active backend withmicrosandbox::backend::default_backend(). They are convenient for normal local programs and fail with Unsupported when the active backend is cloud.
Image::get()
ImageNotFound when the reference is not present in the local cache.
Example
Example
Image::list()
Example
Example
Image::inspect()
Example
Example
Image::remove()
force is false, an image still referenced by one or more sandboxes returns ImageInUse.
Example
Example
Image::prune()
bytes_reclaimed is reported when deleted files could be measured.
Example
Example
Explicit local variants
Use these when your program owns a specificLocalBackend and should not depend on the process default backend.
| Method | Signature |
|---|---|
get_local | async fn get_local(local: &LocalBackend, reference: &str) -> MicrosandboxResult<ImageHandle> |
list_local | async fn list_local(local: &LocalBackend) -> MicrosandboxResult<Vec<ImageHandle>> |
inspect_local | async fn inspect_local(local: &LocalBackend, reference: &str) -> MicrosandboxResult<ImageDetail> |
remove_local | async fn remove_local(local: &LocalBackend, reference: &str, force: bool) -> MicrosandboxResult<()> |
prune_local | async fn prune_local(local: &LocalBackend) -> MicrosandboxResult<ImagePruneReport> |
Types
ImageHandle
A lightweight metadata handle for a cached OCI image.| Method | Returns | Description |
|---|---|---|
reference() | &str | Image reference |
size_bytes() | Option<i64> | Total image size in bytes, when known |
manifest_digest() | Option<&str> | Content-addressable manifest digest |
architecture() | Option<&str> | Resolved architecture |
os() | Option<&str> | Resolved operating system |
layer_count() | usize | Number of layers |
last_used_at() | Option<DateTime<Utc>> | Last referenced time |
created_at() | Option<DateTime<Utc>> | First-pulled time |
ImageDetail
Returned by inspect()
Full detail for a cached image.| Field | Type | Description |
|---|---|---|
handle | ImageHandle | Core cached image metadata |
config | Option<ImageConfigDetail> | Parsed OCI config block |
layers | Vec<ImageLayerDetail> | Layers in bottom-to-top order |
ImageConfigDetail
Used by ImageDetail.config
OCI image config fields extracted from the local cache.| Field | Type | Description |
|---|---|---|
digest | String | Config blob digest |
env | Vec<String> | Environment variables in KEY=value form |
cmd | Option<Vec<String>> | Default command |
entrypoint | Option<Vec<String>> | Image entrypoint |
working_dir | Option<String> | Default working directory |
user | Option<String> | Default user |
labels | Option<serde_json::Value> | OCI labels |
stop_signal | Option<String> | Configured stop signal |
ImageLayerDetail
Used by ImageDetail.layers
Metadata for one image layer.| Field | Type | Description |
|---|---|---|
diff_id | String | Uncompressed diff ID |
blob_digest | String | Compressed blob digest |
media_type | Option<String> | OCI media type |
compressed_size_bytes | Option<i64> | Compressed blob size in bytes |
erofs_size_bytes | Option<i64> | EROFS image size in bytes |
position | i32 | Layer position, where 0 is the bottom |
ImagePruneReport
Returned by prune()
Summary of cached image data removed byImage::prune().
| Field | Type | Description |
|---|---|---|
image_refs_removed | u32 | Cached image references removed from the local image index |
manifests_removed | u32 | OCI manifests removed from the local image index |
layers_removed | u32 | Layer records removed from the local image index |
fsmeta_removed | u32 | Merged fsmeta EROFS artifacts removed from disk |
vmdk_removed | u32 | VMDK descriptor artifacts removed from disk |
bytes_reclaimed | Option<u64> | Best-effort measured bytes reclaimed from deleted artifacts |