ociutil

package
v0.0.0-...-1c9e867 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerHashFromManifest

func DockerHashFromManifest(imageManifest []byte) (string, error)

DockerHashFromManifest get the sha256 hash as a string from a raw image manifest. The "docker hash" is what is used for the image, i.e. the topmost layer.

func LayersFromManifest

func LayersFromManifest(imageManifest []byte) ([]v1.Descriptor, error)

LayersFromManifest get the descriptors for layers from a raw image manifest

func Manifest

func Manifest(registry, repo, username, apiKey string, client *http.Client, prgchan types.StatsNotifChan) ([]byte, []byte, int64, error)

Manifest retrieves the manifest for a repo from a registry and returns it. Optionally, can use authentication of username and apiKey as provided, else defaults to the local user config. Also can use a given http client, else uses the default. Returns the manifest of the repo passed to it, the manifest of the resolved image, which either is the same as the repo manifest if an image, or the repo resolved from a manifest index, the size of the entire image, and error, if any.

func Pull

func Pull(registry, repo, localFile, username, apiKey string, client *http.Client, prgchan types.StatsNotifChan) ([]byte, []byte, int64, error)

Pull downloads an entire image from a registry and saves it as a tar file at the provided location. Optionally, can use authentication of username and apiKey as provided, else defaults to the local user config. Also can use a given http client, else uses the default. Returns the manifest of the repo passed to it, the manifest of the resolved image, which either is the same as the repo manifest if an image, or the repo resolved from a manifest index, the size of the entire download, and error, if any.

func PullBlob

func PullBlob(registry, repo, hash, localFile, username, apiKey string, maxsize int64, client *http.Client, prgchan types.StatsNotifChan) (int64, string, error)

PullBlob downloads a blob from a registry and save it as a file as-is.

func Tags

func Tags(registry, repository, username, apiKey string, client *http.Client, prgchan types.StatsNotifChan) ([]string, error)

Tags return all known tags for a given repository on a given registry. Optionally, can use authentication of username and apiKey as provided, else defaults to the local user config. Also can use a given http client, else uses the default. Returns a slice of tags of the repo passed to it, and error, if any.

Types

type ProgressWriter

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

ProgressWriter is a writer which will send the download progress

func (*ProgressWriter) Close

func (pw *ProgressWriter) Close() error

Close close the writer

func (*ProgressWriter) Error

func (pw *ProgressWriter) Error(err error) error

Error set an error

func (*ProgressWriter) Write

func (pw *ProgressWriter) Write(p []byte) (int, error)

Write write bytes and update the progress channel. Returns number of bytes written and error, if any

type Update

type Update struct {
	Total    int64
	Complete int64
	Error    error
}

Update represents an update to send on a channel

Jump to

Keyboard shortcuts

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