sync

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ManifestHandler

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

Expend 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.

func NewSyncBlobRecorder

func NewSyncBlobRecorder(onDisk string) error

Initialize a SyncBlobRecorder.

Types

type ImageDestination

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

A PushTask reference to a remote image we will push to

func NewImageDestination

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

Generate a PullTask by repository, the repository string must include "tag", if username or password is empty, access to repository will be anonymous.

func (*ImageDestination) Close

func (i *ImageDestination) Close() error

func (*ImageDestination) GetRegistry

func (i *ImageDestination) GetRegistry() string

func (*ImageDestination) GetRepository

func (i *ImageDestination) GetRepository() string

func (*ImageDestination) GetTag

func (i *ImageDestination) GetTag() string

func (*ImageDestination) PushManifest

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

Push a manifest file to destinate image

func (*ImageDestination) PutABlob

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

Push a blob to destinate image

type ImageSource

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

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

func NewImageSource

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

Generate 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

func (*ImageSource) GetABlob

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

func (*ImageSource) GetBlobInfos

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

Get blobs from source image.

func (*ImageSource) GetManifest

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

Get manifest file from source image

func (*ImageSource) GetRegistry

func (i *ImageSource) GetRegistry() string

func (*ImageSource) GetRepository

func (i *ImageSource) GetRepository() string

func (*ImageSource) GetSourceRepoTags

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

func (*ImageSource) GetTag

func (i *ImageSource) GetTag() string

type ManifestSchemaV2Info

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

type ManifestSchemaV2List

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

type SyncBlobRecorder

type SyncBlobRecorder struct {
	Blobs map[string](map[string]int64)
	// contains filtered or unexported fields
}
var (
	// a map record the synchronized layer for the same registry
	// the map is going to look something like: <registry>:<digest>:<size>
	SynchronizedBlobs *SyncBlobRecorder

	NoCache = none.NoCache
)

func (*SyncBlobRecorder) Flush

func (slr *SyncBlobRecorder) Flush()

func (*SyncBlobRecorder) GetRegistryRecords

func (slr *SyncBlobRecorder) GetRegistryRecords(registry string) map[string]int64

func (*SyncBlobRecorder) LockRecorder

func (slr *SyncBlobRecorder) LockRecorder()

func (*SyncBlobRecorder) Query

func (slr *SyncBlobRecorder) Query(registry, digest string) (int64, bool)

Query the recorder if a layer has been synchronized

func (*SyncBlobRecorder) Record

func (slr *SyncBlobRecorder) Record(registry, digest string, size int64) error

Record infomation of a layer that has been synchronized

func (*SyncBlobRecorder) UnlockRecorder

func (slr *SyncBlobRecorder) UnlockRecorder()

func (*SyncBlobRecorder) UpdateRegistryRecords

func (slr *SyncBlobRecorder) UpdateRegistryRecords(registry string, recordList map[string]int64) error

type SyncTask

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

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

func NewSyncTask

func NewSyncTask(source *ImageSource, destination *ImageDestination, logger *logrus.Logger) *SyncTask

func (*SyncTask) Errorf

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

func (*SyncTask) Infof

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

func (*SyncTask) Run

func (t *SyncTask) Run() error

Jump to

Keyboard shortcuts

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