store

package
v0.0.0-...-e0d31fd Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 40 Imported by: 5

Documentation

Index

Constants

View Source
const (
	MediaTypeDockerManifestListV2 = "application/vnd.docker.distribution.manifest.list.v2+json"
	MediaTypeDockerManifestV2     = "application/vnd.docker.distribution.manifest.v2+json"
	MediaTypeDockerConfigV1       = "application/vnd.docker.container.image.v1+json"
	MediaTypeDockerLayerGzip      = "application/vnd.docker.image.rootfs.diff.tar.gzip"
	MediaTypeDockerLayerTar       = "application/vnd.docker.image.rootfs.diff.tar"
)

Variables

This section is empty.

Functions

func CheckArchSummaryComplianceWithPlatform

func CheckArchSummaryComplianceWithPlatform(tarFile string, expectedOsArch string, archSummary []ImageSummary) error

func CheckOsArchCompliance

func CheckOsArchCompliance(tarFile string) error

func CheckOsArchComplianceWithPlatform

func CheckOsArchComplianceWithPlatform(tarFile string, expectedOsArch string) error

*

  • CheckOsArchComplianceWithPlatform opens the tar file and checks platform compatibility.

func CheckTagCompliance

func CheckTagCompliance(targetImage string) string

CheckTagCompliance ensures that the given image name is in a valid format by adding default values for registry and repository if they are missing.

func ImageInFile

func ImageInFile(filePath string, reader io.ReadSeeker, closer io.Closer) ([]ImageSummary, []CompatibleImage, error)

*

  • ImageInFile parses the image tarball using an external stream.
  • The caller is responsible for opening and closing the file/stream.

Types

type ArchReader

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

type CompatibleImage

type CompatibleImage struct {
	Image v1.Image
	Info  ImageInfo
}

func (CompatibleImage) Compressed

func (c CompatibleImage) Compressed() (io.ReadCloser, error)

func (CompatibleImage) ConfigFile

func (c CompatibleImage) ConfigFile() (*v1.ConfigFile, error)

func (CompatibleImage) ConfigName

func (c CompatibleImage) ConfigName() (v1.Hash, error)

func (CompatibleImage) Digest

func (c CompatibleImage) Digest() (v1.Hash, error)

func (CompatibleImage) LayerByDiffID

func (c CompatibleImage) LayerByDiffID(h v1.Hash) (v1.Layer, error)

func (CompatibleImage) LayerByDigest

func (c CompatibleImage) LayerByDigest(h v1.Hash) (v1.Layer, error)

func (CompatibleImage) Layers

func (c CompatibleImage) Layers() ([]v1.Layer, error)

func (CompatibleImage) Manifest

func (c CompatibleImage) Manifest() (*v1.Manifest, error)

func (CompatibleImage) MediaType

func (c CompatibleImage) MediaType() (types.MediaType, error)

func (CompatibleImage) RawConfigFile

func (c CompatibleImage) RawConfigFile() ([]byte, error)

func (CompatibleImage) RawManifest

func (c CompatibleImage) RawManifest() ([]byte, error)

func (CompatibleImage) Size

func (c CompatibleImage) Size() (int64, error)

func (CompatibleImage) Uncompressed

func (c CompatibleImage) Uncompressed() (io.ReadCloser, error)

type DockerManifest

type DockerManifest struct {
	Config   string   `json:"Config"`
	RepoTags []string `json:"RepoTags"`
	Layers   []string `json:"Layers"`
}

type DockerPackageManifestItem

type DockerPackageManifestItem struct {
	Config string `json:"Config"`

	RepoTags []string `json:"RepoTags"`

	// Layers is an indexed list of layers referenced by the manifest.
	Layers []string `json:"Layers"`

	Type kii.ImageType `json:"Type"`
}

type Image

type Image struct {
	Repository string
	Tag        string
	ImageID    string
	Size       string
}

type ImageConfig

type ImageConfig struct {
	Architecture string   `json:"architecture"`
	OS           string   `json:"os"`
	Variant      string   `json:"variant,omitempty"`
	DiffIDs      []string `json:"diff_ids,omitempty"`
}

type ImageInfo

type ImageInfo struct {
	Architecture string `json:"architecture"`
	OS           string `json:"os"`
	Variant      string `json:"variant,omitempty"`
	Ref          string `json:"ref"`
	Source       string `json:"source"`
}

type ImageMetaData

type ImageMetaData struct {
	OCIIndex        *OCIIndex
	DockerManifests []DockerManifest
	OCIManifests    []OCIManifest
	Configs         []ImageConfig
	RawConfigs      [][]byte
	Layers          []OCIDescriptor
	DiffIDs         []string
	RawManifest     []byte
	// contains filtered or unexported fields
}

type ImageSummary

type ImageSummary struct {
	Ref       string   `json:"ref"`
	Platforms []string `json:"platforms"`
}

type OCIDescriptor

type OCIDescriptor struct {
	MediaType   string            `json:"mediaType"`
	Digest      string            `json:"digest"`
	Size        int               `json:"size"`
	URLs        []string          `json:"urls,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

type OCIIndex

type OCIIndex struct {
	SchemaVersion int                `json:"schemaVersion"`
	MediaType     string             `json:"mediaType,omitempty"`
	Manifests     []OCIIndexManifest `json:"manifests"`
	Annotations   map[string]string  `json:"annotations,omitempty"`
}

type OCIIndexManifest

type OCIIndexManifest struct {
	MediaType   string            `json:"mediaType"`
	Digest      string            `json:"digest"`
	Size        int               `json:"size,omitempty"`
	Platform    *OCIPlatform      `json:"platform,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

type OCIManifest

type OCIManifest struct {
	SchemaVersion int               `json:"schemaVersion"`
	MediaType     string            `json:"mediaType,omitempty"`
	Config        OCIDescriptor     `json:"config"`
	Layers        []OCIDescriptor   `json:"layers"`
	Annotations   map[string]string `json:"annotations,omitempty"`
}

type OCIPlatform

type OCIPlatform struct {
	Architecture string `json:"architecture"`
	OS           string `json:"os"`
	Variant      string `json:"variant,omitempty"`
}

type Store

type Store interface {
	CheckImageExist(image *kii.ImageName) bool
	MountImage(image *kii.ImageName, workingDir, targetDir string) error
	UmountImage(workingDir string) error
	GetImageManifest(image *kii.ImageName, auth *runtimeapi.AuthConfig) (*kii.Manifest, error)
	TagImage(sourceImage, targetImage *kii.ImageName) error
	LoadImage(tarFile string) error
	RegisterImage(image, manifest string) error
	PullImage(image string, auth *runtimeapi.AuthConfig) error
	ListImage() ([]*Image, error)
	RemoveImage(imageNameOrIDs []string) error
}

func NewDockerStore

func NewDockerStore(rootDir string, mountType mounter.MountType) (Store, error)

func NewOCIStore

func NewOCIStore(rootDir string, mountType mounter.MountType) (Store, error)

type TarReader

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

*

  • TarReader provides methods to extract files from tar/gzip streams, with cache for non-layer blobs.
  • The file handle is passed in from the caller and its lifecycle is managed externally.

func (*TarReader) Close

func (tr *TarReader) Close() error

*

  • Close the underlying resource if a closer is provided.

func (*TarReader) ExtractFileAsStream

func (tr *TarReader) ExtractFileAsStream(filePath string) (io.ReadCloser, error)

func (*TarReader) ReadJSONFile

func (tr *TarReader) ReadJSONFile(filePath string, v interface{}, shouldCache bool) error

type TarfileOsArchUnsupportedError

type TarfileOsArchUnsupportedError struct {
	Source          string
	CurrentPlatform string
	ArchSummary     []ImageSummary
	Cause           error
}

func (*TarfileOsArchUnsupportedError) Error

func (*TarfileOsArchUnsupportedError) Unwrap

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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