sync

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 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)

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.

func NewSynchronizedBlobRecorder added in v1.0.3

func NewSynchronizedBlobRecorder(onDisk string) error

NewSynchronizedBlobRecorder initialize a SynchronizedBlobRecorder.

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) 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 destinate image

func (*ImageDestination) PutABlob

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

PutABlob push a blob to destinate 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(manifestByte []byte, manifestType string) ([]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 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

type SynchronizedBlobRecorder added in v1.0.3

type SynchronizedBlobRecorder struct {
	Blobs map[string](map[string]int64)
	// contains filtered or unexported fields
}

SynchronizedBlobRecorder describes a recorder of synchronized blobs

var (
	// SynchronizedBlobs is a map record the synchronized layer for the same registry
	// the map is going to look something like: <registry>:<digest>:<size>
	SynchronizedBlobs *SynchronizedBlobRecorder

	// NoCache used to disable a blobinfocache
	NoCache = none.NoCache
)

func (*SynchronizedBlobRecorder) Flush added in v1.0.3

func (slr *SynchronizedBlobRecorder) Flush()

Flush records to disk

func (*SynchronizedBlobRecorder) GetRegistryRecords added in v1.0.3

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

GetRegistryRecords gets records according related to the registry

func (*SynchronizedBlobRecorder) LockRecorder added in v1.0.3

func (slr *SynchronizedBlobRecorder) LockRecorder()

LockRecorder locks the syncC mutex

func (*SynchronizedBlobRecorder) Query added in v1.0.3

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

Query the recorder if a layer has been synchronized

func (*SynchronizedBlobRecorder) Record added in v1.0.3

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

Record information of a layer that has been synchronized

func (*SynchronizedBlobRecorder) UnlockRecorder added in v1.0.3

func (slr *SynchronizedBlobRecorder) UnlockRecorder()

UnlockRecorder unlocks the syncC mutex

func (*SynchronizedBlobRecorder) UpdateRegistryRecords added in v1.0.3

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

UpdateRegistryRecords updates records related to the registry

type Task added in v1.0.3

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

func NewTask(source *ImageSource, destination *ImageDestination, 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

Jump to

Keyboard shortcuts

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