schema2

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2025 License: Apache-2.0 Imports: 9 Imported by: 21

Documentation

Index

Constants

View Source
const (
	// MediaTypeManifest specifies the mediaType for the current version.
	MediaTypeManifest = "application/vnd.docker.distribution.manifest.v2+json"

	// MediaTypeImageConfig specifies the mediaType for the image configuration.
	MediaTypeImageConfig = "application/vnd.docker.container.image.v1+json"

	// MediaTypePluginConfig specifies the mediaType for plugin configuration.
	MediaTypePluginConfig = "application/vnd.docker.plugin.v1+json"

	// MediaTypeLayer is the mediaType used for layers referenced by the
	// manifest.
	MediaTypeLayer = "application/vnd.docker.image.rootfs.diff.tar.gzip"

	// MediaTypeForeignLayer is the mediaType used for layers that must be
	// downloaded from foreign URLs.
	MediaTypeForeignLayer = "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip"

	// MediaTypeUncompressedLayer is the mediaType used for layers which
	// are not compressed.
	MediaTypeUncompressedLayer = "application/vnd.docker.image.rootfs.diff.tar"
)

Variables

View Source
var SchemaVersion = manifest.Versioned{
	SchemaVersion: defaultSchemaVersion,
	MediaType:     defaultMediaType,
}

SchemaVersion provides a pre-initialized version structure for this packages version of the manifest.

Deprecated: use specs.Versioned and set MediaType on the manifest to MediaTypeManifest.

Functions

This section is empty.

Types

type Builder

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

Builder is a type for constructing manifests.

func NewManifestBuilder

func NewManifestBuilder(configDescriptor v1.Descriptor, configJSON []byte) *Builder

NewManifestBuilder is used to build new manifests for the current schema version. It takes a BlobService so it can publish the configuration blob as part of the Build process.

func (*Builder) AppendReference

func (mb *Builder) AppendReference(ref v1.Descriptor) error

AppendReference adds a reference to the current ManifestBuilder.

func (*Builder) Build

func (mb *Builder) Build(ctx context.Context) (distribution.Manifest, error)

Build produces a final manifest from the given references.

func (*Builder) References

func (mb *Builder) References() []v1.Descriptor

References returns the current references added to this builder.

type DeserializedManifest

type DeserializedManifest struct {
	Manifest
	// contains filtered or unexported fields
}

DeserializedManifest wraps Manifest with a copy of the original JSON. It satisfies the distribution.Manifest interface.

func FromStruct

func FromStruct(m Manifest) (*DeserializedManifest, error)

FromStruct takes a Manifest structure, marshals it to JSON, and returns a DeserializedManifest which contains the manifest and its JSON representation.

func (*DeserializedManifest) MarshalJSON

func (m *DeserializedManifest) MarshalJSON() ([]byte, error)

MarshalJSON returns the contents of canonical. If canonical is empty, marshals the inner contents.

func (DeserializedManifest) Payload

func (m DeserializedManifest) Payload() (string, []byte, error)

Payload returns the raw content of the manifest. The contents can be used to calculate the content identifier.

func (*DeserializedManifest) UnmarshalJSON

func (m *DeserializedManifest) UnmarshalJSON(b []byte) error

UnmarshalJSON populates a new Manifest struct from JSON data.

type Manifest

type Manifest struct {
	specs.Versioned

	// MediaType is the media type of this schema.
	MediaType string `json:"mediaType,omitempty"`

	// Config references the image configuration as a blob.
	Config v1.Descriptor `json:"config"`

	// Layers lists descriptors for the layers referenced by the
	// configuration.
	Layers []v1.Descriptor `json:"layers"`
}

Manifest defines a schema2 manifest.

func (Manifest) References

func (m Manifest) References() []v1.Descriptor

References returns the descriptors of this manifests references.

func (Manifest) Target

func (m Manifest) Target() v1.Descriptor

Target returns the target of this manifest.

Jump to

Keyboard shortcuts

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