manifest

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package manifest defines OCI manifest types and artifact classification.

Index

Constants

View Source
const (
	// OCI / Docker manifest envelopes.
	MediaTypeOCIManifest    = "application/vnd.oci.image.manifest.v1+json"
	MediaTypeOCIIndex       = "application/vnd.oci.image.index.v1+json"
	MediaTypeDockerManifest = "application/vnd.docker.distribution.manifest.v2+json"
	MediaTypeDockerIndex    = "application/vnd.docker.distribution.manifest.list.v2+json"

	// OCI / Docker config blob types.
	MediaTypeOCIImageConfig = "application/vnd.oci.image.config.v1+json"
	MediaTypeDockerConfig   = "application/vnd.docker.container.image.v1+json"
	MediaTypeOCIEmpty       = "application/vnd.oci.empty.v1+json"

	// Cocoonstack artifactType discriminators.
	// WindowsImage is the legacy name; epoch recognizes both.
	ArtifactTypeOSImage      = "application/vnd.cocoonstack.os-image.v1+json"
	ArtifactTypeWindowsImage = "application/vnd.cocoonstack.windows-image.v1+json"
	ArtifactTypeSnapshot     = "application/vnd.cocoonstack.snapshot.v1+json"

	MediaTypeSnapshotConfig = "application/vnd.cocoonstack.snapshot.config.v1+json"

	// Disk layer media types. *Part variants are for split disks (GHCR per-layer limit).
	MediaTypeDiskQcow2     = "application/vnd.cocoonstack.disk.qcow2"
	MediaTypeDiskQcow2Part = "application/vnd.cocoonstack.disk.qcow2.part"
	MediaTypeDiskRaw       = "application/vnd.cocoonstack.disk.raw"
	MediaTypeDiskRawPart   = "application/vnd.cocoonstack.disk.raw.part"

	// Legacy windows-specific disk media types.
	MediaTypeWindowsDiskQcow2     = "application/vnd.cocoonstack.windows.disk.qcow2"
	MediaTypeWindowsDiskQcow2Part = "application/vnd.cocoonstack.windows.disk.qcow2.part"
	MediaTypeWindowsDiskRaw       = "application/vnd.cocoonstack.windows.disk.raw"
	MediaTypeWindowsDiskRawPart   = "application/vnd.cocoonstack.windows.disk.raw.part"

	// Snapshot-specific layer media types.
	MediaTypeVMConfig = "application/vnd.cocoonstack.vm.config+json"
	MediaTypeVMState  = "application/vnd.cocoonstack.vm.state+json"
	MediaTypeVMMemory = "application/vnd.cocoonstack.vm.memory"
	MediaTypeVMCidata = "application/vnd.cocoonstack.vm.cidata"

	MediaTypeGeneric = "application/octet-stream"
	MediaTypeTar     = "application/x-tar"

	// OCI standard annotation keys.
	AnnotationTitle       = "org.opencontainers.image.title"
	AnnotationCreated     = "org.opencontainers.image.created"
	AnnotationSource      = "org.opencontainers.image.source"
	AnnotationRevision    = "org.opencontainers.image.revision"
	AnnotationDescription = "org.opencontainers.image.description"

	// Cocoonstack annotation keys.
	AnnotationSnapshotID        = "cocoonstack.snapshot.id"
	AnnotationSnapshotBaseImage = "cocoonstack.snapshot.baseimage"
)

Variables

This section is empty.

Functions

func IsDiskMediaType added in v0.1.7

func IsDiskMediaType(mt string) bool

IsDiskMediaType reports whether mt is a disk layer mediaType.

func MediaTypeForCocoonFile added in v0.1.7

func MediaTypeForCocoonFile(name string) string

MediaTypeForCocoonFile returns the layer mediaType for a cocoon snapshot tar file.

Types

type Catalog

type Catalog struct {
	Repositories map[string]*Repository `json:"repositories"`
	UpdatedAt    time.Time              `json:"updatedAt"`
}

Catalog is the global index of all repositories and their tags.

type Descriptor added in v0.1.7

type Descriptor struct {
	MediaType    string            `json:"mediaType"`
	Digest       string            `json:"digest"`
	Size         int64             `json:"size"`
	Annotations  map[string]string `json:"annotations,omitempty"`
	ArtifactType string            `json:"artifactType,omitempty"`
}

Descriptor is an OCI content descriptor (mediaType + digest + size).

func (Descriptor) Title added in v0.1.7

func (d Descriptor) Title() string

Title returns the org.opencontainers.image.title annotation, if any.

type IndexManifest added in v0.1.7

type IndexManifest struct {
	MediaType string    `json:"mediaType"`
	Digest    string    `json:"digest"`
	Size      int64     `json:"size"`
	Platform  *Platform `json:"platform,omitempty"`
}

IndexManifest describes one platform entry inside an OCI image index.

type Kind added in v0.1.7

type Kind int

Kind identifies the artifact classification of an OCI manifest.

const (
	KindUnknown Kind = iota
	KindContainerImage
	KindCloudImage
	KindSnapshot
	KindImageIndex
)

func Classify added in v0.1.7

func Classify(raw []byte) (Kind, error)

Classify returns the artifact kind from raw manifest JSON.

func ClassifyParsed added in v0.1.7

func ClassifyParsed(m *OCIManifest) Kind

ClassifyParsed classifies an already-parsed manifest.

func (Kind) String added in v0.1.7

func (k Kind) String() string

String returns the human-readable name of the artifact kind.

type OCIManifest added in v0.1.7

type OCIManifest struct {
	SchemaVersion int               `json:"schemaVersion"`
	MediaType     string            `json:"mediaType,omitempty"`
	ArtifactType  string            `json:"artifactType,omitempty"`
	Config        Descriptor        `json:"config"`
	Layers        []Descriptor      `json:"layers"`
	Manifests     []IndexManifest   `json:"manifests,omitempty"`
	Subject       *Descriptor       `json:"subject,omitempty"`
	Annotations   map[string]string `json:"annotations,omitempty"`
}

OCIManifest represents both OCI image manifests and image indexes.

func Parse added in v0.1.7

func Parse(raw []byte) (*OCIManifest, error)

Parse unmarshals raw JSON into an OCIManifest.

type Platform added in v0.1.7

type Platform struct {
	Architecture string `json:"architecture,omitempty"`
	OS           string `json:"os,omitempty"`
	OSVersion    string `json:"os.version,omitempty"`
	Variant      string `json:"variant,omitempty"`
}

Platform describes OS and architecture for an index entry.

type Repository

type Repository struct {
	Tags      map[string]string `json:"tags"`
	UpdatedAt time.Time         `json:"updatedAt"`
}

Repository maps tag names to their manifest keys in the object store.

type SnapshotConfig added in v0.1.7

type SnapshotConfig struct {
	SchemaVersion string                  `json:"schemaVersion"`
	SnapshotID    string                  `json:"snapshotId"`
	Description   string                  `json:"description,omitempty"`
	Image         string                  `json:"image,omitempty"`
	ImageBlobIDs  map[string]struct{}     `json:"imageBlobIds,omitempty"`
	Hypervisor    string                  `json:"hypervisor,omitempty"`
	CPU           int                     `json:"cpu,omitempty"`
	Memory        int64                   `json:"memory,omitempty"`
	Storage       int64                   `json:"storage,omitempty"`
	NICs          int                     `json:"nics,omitempty"`
	Network       string                  `json:"network,omitempty"`
	Windows       bool                    `json:"windows,omitempty"`
	Files         map[string]SnapshotFile `json:"files,omitempty"`
	CreatedAt     time.Time               `json:"createdAt"`
}

SnapshotConfig is the OCI config blob for snapshot manifests.

type SnapshotFile added in v0.1.8

type SnapshotFile struct {
	Mode       int64  `json:"mode,omitempty"`
	SparseMap  string `json:"sparseMap,omitempty"`
	SparseSize int64  `json:"sparseSize,omitempty"`
}

SnapshotFile holds per-file metadata stored in the snapshot config blob.

Jump to

Keyboard shortcuts

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