sync

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NoCache used to disable a blobinfocache
	NoCache = none.NoCache
)

Functions

This section is empty.

Types

type ImageDestination

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

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

func NewImageDestination

func NewImageDestination(registry, repository, tag, username, password string, insecure bool) (*ImageDestination, error)

NewImageDestination generates an ImageDestination by repository, the repository string must include "tag". If username or password is empty, access to repository will be anonymous.

func (*ImageDestination) CheckBlobExist added in v1.1.0

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

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

func (*ImageDestination) CheckManifestChanged added in v1.4.0

func (i *ImageDestination) CheckManifestChanged(destManifestBytes []byte, tagOrDigest string) bool

CheckManifestChanged checks if manifest of destination (tag) has changed.

func (*ImageDestination) Close

func (i *ImageDestination) Close() error

Close a ImageDestination

func (*ImageDestination) GetManifest added in v1.4.0

func (i *ImageDestination) GetManifest(tagOrDigest string) []byte

func (*ImageDestination) GetRegistry

func (i *ImageDestination) GetRegistry() string

GetRegistry returns the registry of a ImageDestination

func (*ImageDestination) GetRepository

func (i *ImageDestination) GetRepository() string

GetRepository returns the repository of a ImageDestination

func (*ImageDestination) GetTag

func (i *ImageDestination) GetTag() string

GetTag return the tag of a ImageDestination

func (*ImageDestination) PushManifest

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

PushManifest push a manifest file to destination image

func (*ImageDestination) PutABlob

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

PutABlob push a blob to destination image

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 PullTask 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(manifestObjSlice ...manifest.Manifest) ([]types.BlobInfo, error)

GetBlobInfos get blob infos from non-list type manifests.

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 ManifestInfo added in v1.4.0

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

func GenerateManifestObj added in v1.4.0

func GenerateManifestObj(manifestBytes []byte, manifestType string, osFilterList, archFilterList []string,
	i *ImageSource, parent *manifest.Schema2List) (interface{}, []byte, []*ManifestInfo, error)

GenerateManifestObj returns a new manifest object along with its byte serialization, and a sub manifest object array, and a digest array of sub manifests for list-type manifests. For list type manifest, the origin manifest info might be modified because of platform filters, and a nil manifest object will be returned if no sub manifest need to transport. For non-list type manifests, which doesn't match the filters, a nil manifest object will be returned.

type Task added in v1.0.3

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

Task act as a sync action, it will pull images from source to destination

func NewTask added in v1.0.3

func NewTask(source *ImageSource, destination *ImageDestination,
	osFilterList, archFilterList []string, logger *logrus.Logger) *Task

NewTask creates a sync task

func (*Task) Errorf added in v1.0.3

func (t *Task) Errorf(format string, args ...interface{}) error

Errorf logs error to logger

func (*Task) Infof added in v1.0.3

func (t *Task) Infof(format string, args ...interface{})

Infof logs info to logger

func (*Task) Run added in v1.0.3

func (t *Task) Run() error

Run is the main function of a sync task

func (*Task) SyncBlobs added in v1.4.0

func (t *Task) SyncBlobs(blobInfos ...types.BlobInfo) error

func (*Task) SyncListTypeImageByManifest added in v1.4.0

func (t *Task) SyncListTypeImageByManifest(manifestBytes []byte, subManifestInfoSlice []*ManifestInfo) error

func (*Task) SyncNonListTypeImageByManifest added in v1.4.0

func (t *Task) SyncNonListTypeImageByManifest(manifestObj interface{}, manifestBytes []byte,
	srcTagOrDigest, dstTagOrDigest string) error

Jump to

Keyboard shortcuts

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