sync

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const Oauth2User = "_oauth2_"

Variables

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

Functions

func ManifestHandler

func ManifestHandler(manifestBytes []byte, manifestType string, osFilterList, archFilterList []string,
	i *ImageSource, parent *manifest.Schema2List) ([]manifest.Manifest, interface{}, 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 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 a ImageDestination by repository, the repository string must include "tag". If username or password is empty, access to repository will be anonymous.

func (*ImageDestination) CheckBlobExist

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

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

func (*ImageDestination) Close

func (i *ImageDestination) Close() error

Close a ImageDestination

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

GetBlobInfos get blobs from source image.

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 Task

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

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

func NewTask

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

NewTask creates a sync task

func (*Task) Errorf

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

Errorf logs error to logger

func (*Task) Infof

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

Infof logs info to logger

func (*Task) Run

func (t *Task) Run() error

Run is the main function of a sync task

Jump to

Keyboard shortcuts

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