oci

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTarFile

func IsTarFile(path string) bool

IsTarFile checks if a file is a tar archive by reading its magic bytes.

Types

type Config

type Config struct {
	images.BaseConfig
}

Config holds OCI image backend specific configuration, embedding the shared BaseConfig.

func NewConfig

func NewConfig(conf *config.Config) *Config

NewConfig creates an OCI Config from a global config.

func (*Config) BootBaseDir

func (c *Config) BootBaseDir() string

func (*Config) BootDir

func (c *Config) BootDir(layerDigestHex string) string

func (*Config) EnsureDirs

func (c *Config) EnsureDirs() error

EnsureDirs creates all required directories for the OCI backend.

func (*Config) InitrdPath

func (c *Config) InitrdPath(layerDigestHex string) string

func (*Config) KernelPath

func (c *Config) KernelPath(layerDigestHex string) string

type OCI

type OCI struct {
	// contains filtered or unexported fields
}

OCI implements the images.Images interface using OCI container images converted to EROFS filesystems for use with Cloud Hypervisor.

func New

func New(ctx context.Context, conf *config.Config) (*OCI, error)

New creates a new OCI image backend.

func (*OCI) Config

func (o *OCI) Config(ctx context.Context, vms []*types.VMConfig) (result [][]*types.StorageConfig, boot []*types.BootConfig, err error)

Config generates StorageConfig and BootConfig entries for the given VMs. Paths are derived from layer digests at runtime, not stored in the index. Image references are normalized (e.g., "ubuntu:24.04" matches "docker.io/library/ubuntu:24.04"). Returns an error if any referenced blob or boot file is missing on disk.

func (*OCI) Delete

func (o *OCI) Delete(ctx context.Context, ids []string) ([]string, error)

Delete removes images from the index. Returns the list of actually deleted refs. Images not found are logged and skipped.

func (*OCI) GCModule

func (o *OCI) GCModule() gc.Module[images.ImageGCSnapshot]

GCModule returns a typed gc.Module for the OCI backend.

func (*OCI) Import

func (o *OCI) Import(ctx context.Context, name string, tracker progress.Tracker, file ...string) error

Import imports local tar files as an OCI image. Each tar file becomes one EROFS layer (ordered by the files slice).

func (*OCI) Inspect

func (o *OCI) Inspect(ctx context.Context, id string) (*types.Image, error)

Inspect returns the record for a single image. Returns (nil, nil) if not found.

func (*OCI) List

func (o *OCI) List(ctx context.Context) ([]*types.Image, error)

List returns all locally stored images.

func (*OCI) Pull

func (o *OCI) Pull(ctx context.Context, image string, tracker progress.Tracker) error

Pull downloads an OCI image from a container registry, extracts boot files (kernel, initrd), and converts each layer to EROFS concurrently.

func (*OCI) RegisterGC

func (o *OCI) RegisterGC(orch *gc.Orchestrator)

RegisterGC registers the OCI GC module with the given Orchestrator.

func (*OCI) Type

func (o *OCI) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL