replication

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateInitialize ...
	StateInitialize = "initialize"
	// StateCheck ...
	StateCheck = "check"
	// StatePullManifest ...
	StatePullManifest = "pull_manifest"
	// StateTransferBlob ...
	StateTransferBlob = "transfer_blob"
	// StatePushManifest ...
	StatePushManifest = "push_manifest"
)
View Source
const (
	// StateDelete ...
	StateDelete = "delete"
)

Variables

View Source
var (
	// ErrConflict represents http 409 error
	ErrConflict = errors.New("conflict")
)

Functions

This section is empty.

Types

type BaseHandler

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

BaseHandler holds informations shared by other state handlers

func InitBaseHandler

func InitBaseHandler(repository, srcURL, srcSecret,
	dstURL, dstUsr, dstPwd string, insecure bool, tags []string, logger *log.Logger) *BaseHandler

InitBaseHandler initializes a BaseHandler.

func (*BaseHandler) Exit

func (b *BaseHandler) Exit() error

Exit ...

type BlobTransfer

type BlobTransfer struct {
	*BaseHandler
}

BlobTransfer transfers blobs of a tag

func (*BlobTransfer) Enter

func (b *BlobTransfer) Enter() (string, error)

Enter pulls blobs and then pushs them to destination registry.

type Checker

type Checker struct {
	*BaseHandler
}

Checker checks the existence of project and the user's privlege to the project

func (*Checker) Enter

func (c *Checker) Enter() (string, error)

Enter check existence of project, if it does not exist, create it, if it exists, check whether the user has write privilege to it.

type Deleter

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

Deleter deletes repository or tags

func NewDeleter

func NewDeleter(repository string, tags []string, dstURL, dstUsr, dstPwd string, insecure bool, logger *log.Logger) *Deleter

NewDeleter returns a Deleter

func (*Deleter) Enter

func (d *Deleter) Enter() (string, error)

Enter deletes repository or tags

func (*Deleter) Exit

func (d *Deleter) Exit() error

Exit ...

type Initializer

type Initializer struct {
	*BaseHandler
}

Initializer creates clients for source and destination registry, lists tags of the repository if parameter tags is nil.

func (*Initializer) Enter

func (i *Initializer) Enter() (string, error)

Enter ...

type ManifestPuller

type ManifestPuller struct {
	*BaseHandler
}

ManifestPuller pulls the manifest of a tag. And if no tag needs to be pulled, the next state that state machine should enter is "finished".

func (*ManifestPuller) Enter

func (m *ManifestPuller) Enter() (string, error)

Enter pulls manifest of a tag and checks if all blobs exist in the destination registry

type ManifestPusher

type ManifestPusher struct {
	*BaseHandler
}

ManifestPusher pushs the manifest to destination registry

func (*ManifestPusher) Enter

func (m *ManifestPusher) Enter() (string, error)

Enter checks the existence of manifest in the source registry first, and if it exists, pushs it to destination registry. The checking operation is to avoid the situation that the tag is deleted during the blobs transfering

Jump to

Keyboard shortcuts

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