transfer

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NoCache used to disable a blobinfocache
	NoCache = none.NoCache
	// Memory cache to enable a blobinfocache
	Memory = memory.New()
)

Functions

func ManifestHandler

func ManifestHandler(m []byte, t string, i *ImageSource) ([]manifest.Manifest, error)

ManifestHandler expends the ability of handling manifest list in schema2, but it's not finished yet return the digest array of manifests in the manifest list if exist.

Types

type ImageSource

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

ImageSource is a reference to a remote image need to be pulled.

func NewImageSource

func NewImageSource(registry, repository, tag, username, password string, insecure bool) (*ImageSource, error)

NewImageSource generates a PullJob by repository, the repository string must include "tag", if username or password is empty, access to repository will be anonymous. a repository string is the rest part of the images url except "tag" and "registry"

func (*ImageSource) Close

func (i *ImageSource) Close() error

Close an ImageSource

func (*ImageSource) GetABlob

func (i *ImageSource) GetABlob(blobInfo types.BlobInfo) (io.ReadCloser, int64, error)

GetABlob gets a blob from remote image

func (*ImageSource) GetBlobInfos

func (i *ImageSource) GetBlobInfos(manifestByte []byte, manifestType string) ([]types.BlobInfo, error)

GetBlobInfos get blobs from source image.

func (*ImageSource) GetImageDigest added in v1.2.0

func (i *ImageSource) GetImageDigest() (digest.Digest, error)

GetImageDigest checks if a tag exist for target, return target tag of digest

func (*ImageSource) GetManifest

func (i *ImageSource) GetManifest() ([]byte, string, error)

GetManifest get manifest file from source image

func (*ImageSource) GetRegistry

func (i *ImageSource) GetRegistry() string

GetRegistry returns the registry of a ImageSource

func (*ImageSource) GetRepository

func (i *ImageSource) GetRepository() string

GetRepository returns the repository of a ImageSource

func (*ImageSource) GetSourceRepoTags

func (i *ImageSource) GetSourceRepoTags() ([]string, error)

GetSourceRepoTags gets all the tags of a repository which ImageSource belongs to

func (*ImageSource) GetTag

func (i *ImageSource) GetTag() string

GetTag returns the tag of a ImageSource

type ImageTarget

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

ImageTarget is a reference of a remote image we will push to

func NewImageTarget

func NewImageTarget(registry, repository, tag, username, password string, insecure bool) (*ImageTarget, error)

NewImageTarget generates a ImageTarget by repository, the repository string must include "tag". If username or password is empty, access to repository will be anonymous.

func (*ImageTarget) CheckBlobExist

func (i *ImageTarget) CheckBlobExist(blobInfo types.BlobInfo) (bool, error)

CheckBlobExist checks if a blob exist for target and reuse exist blobs

func (*ImageTarget) Close

func (i *ImageTarget) Close() error

Close a ImageTarget

func (*ImageTarget) GetImageDigest added in v1.2.0

func (i *ImageTarget) GetImageDigest() (digest.Digest, error)

GetImageDigest checks if a tag exist for target, return target tag of digest

func (*ImageTarget) GetRegistry

func (i *ImageTarget) GetRegistry() string

GetRegistry returns the registry of a ImageTarget

func (*ImageTarget) GetRepository

func (i *ImageTarget) GetRepository() string

GetRepository returns the repository of a ImageTarget

func (*ImageTarget) GetTag

func (i *ImageTarget) GetTag() string

GetTag return the tag of a ImageTarget

func (*ImageTarget) GetTargetRepoTags added in v1.2.0

func (i *ImageTarget) GetTargetRepoTags() ([]string, error)

GetTargetRepoTags gets all the tags of a repository which ImageTarget belongs to

func (*ImageTarget) PushManifest

func (i *ImageTarget) PushManifest(manifestByte []byte) error

PushManifest push a manifest file to target image

func (*ImageTarget) PutABlob

func (i *ImageTarget) PutABlob(blob io.ReadCloser, blobInfo types.BlobInfo) error

PutABlob push a blob to target image

type Job

type Job struct {
	Source *ImageSource
	Target *ImageTarget
}

Job act as a sync action, it will pull a images from source to target

func NewJob

func NewJob(source *ImageSource, target *ImageTarget) *Job

NewJob creates a transfer job

func (*Job) Run

func (j *Job) Run() error

Run is the main function of a transfer job

type ManifestSchemaV2Info

type ManifestSchemaV2Info struct {
	Digest string `json:"digest"`
}

ManifestSchemaV2Info includes of the imformation needes of a schema V2 manifest file

type ManifestSchemaV2List

type ManifestSchemaV2List struct {
	Manifests []ManifestSchemaV2Info `json:"manifests"`
}

ManifestSchemaV2List describes a schema V2 manifest list

Jump to

Keyboard shortcuts

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