repository_fetcher

package
v0.0.0-...-6c5b0a6 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_ATTEMPTS = 3

Variables

View Source
var DefaultVerifier = VerifyFunc(Verify)
View Source
var ErrInvalidDockerURL = errors.New("invalid docker url")
View Source
var RegistryNewEndpoint = registry.NewEndpoint

apes dockers registry.NewEndpoint

View Source
var RegistryNewSession = registry.NewSession

apes dockers registry.NewSession

Functions

func FetchError

func FetchError(context, registry, reponame string, err error) error

func Verify

func Verify(r io.Reader, d digest.Digest) (io.ReadCloser, int64, error)

Verify reads the given reader in to a temporary file and validates that it matches the digest. If it does, it returns a reader for that allows access to the data. Otherwise, it returns an error. The caller is responsible for closing the returned reader, in order to ensure the temporary file is deleted.

Types

type CompositeFetcher

type CompositeFetcher struct {
	// fetcher used for requests without a scheme
	LocalFetcher RepositoryFetcher

	// fetchers used for docker:// urls, depending on the version
	RemoteFetcher RepositoryFetcher
}

func (*CompositeFetcher) Fetch

func (f *CompositeFetcher) Fetch(log lager.Logger, repoURL *url.URL, username, password string, diskQuota int64) (*Image, error)

func (*CompositeFetcher) FetchID

func (f *CompositeFetcher) FetchID(log lager.Logger, repoURL *url.URL) (layercake.ID, error)

type ContainerIDProvider

type ContainerIDProvider interface {
	ProvideID(path string) layercake.ID
}

type Dialer

type Dialer interface {
	Dial(logger lager.Logger, host, repo, username, password string) (distclient.Conn, error)
}

type FetchLock

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

func NewFetchLock

func NewFetchLock() *FetchLock

func (*FetchLock) Acquire

func (l *FetchLock) Acquire(key string)

func (*FetchLock) Release

func (l *FetchLock) Release(key string) error

type FetchRequest

type FetchRequest struct {
	Session    *registry.Session
	Endpoint   *registry.Endpoint
	Repository distribution.Repository
	Path       string
	RemotePath string
	Tag        string
	Logger     lager.Logger
	MaxSize    int64
}

type Image

type Image struct {
	ImageID string
	Env     []string
	Volumes []string
	Size    int64
}

type ImageRetainer

type ImageRetainer struct {
	DirectoryRootfsIDProvider ContainerIDProvider
	DockerImageIDFetcher      RemoteImageIDFetcher
	GraphRetainer             layercake.Retainer
	NamespaceCacheKey         string

	Logger lager.Logger
}

func (*ImageRetainer) Retain

func (i *ImageRetainer) Retain(imageList []string)

type LayerIDProvider

type LayerIDProvider struct {
}

func (LayerIDProvider) ProvideID

func (LayerIDProvider) ProvideID(path string) layercake.ID

type Local

type Local struct {
	Cake              layercake.Cake
	DefaultRootFSPath string
	IDProvider        ContainerIDProvider
	// contains filtered or unexported fields
}

func (*Local) Fetch

func (l *Local) Fetch(log lager.Logger, repoURL *url.URL, _, _ string, _ int64) (*Image, error)

func (*Local) FetchID

func (l *Local) FetchID(log lager.Logger, repoURL *url.URL) (layercake.ID, error)

type Lock

type Lock interface {
	Acquire(key string)
	Release(key string) error
}

type Registry

type Registry interface {
	// v1 methods
	GetRepositoryData(repoName string) (*registry.RepositoryData, error)
	GetRemoteTags(registries []string, repository string) (map[string]string, error)
	GetRemoteHistory(imageID string, registry string) ([]string, error)
	GetRemoteImageJSON(imageID string, registry string) ([]byte, int, error)
	GetRemoteImageLayer(imageID string, registry string, size int64) (io.ReadCloser, error)
}

apes docker's *registry.Registry

type Remote

type Remote struct {
	DefaultHost string
	Dial        Dialer
	Cake        layercake.Cake
	Verifier    Verifier

	FetchLock *FetchLock
}

func NewRemote

func NewRemote(defaultHost string, cake layercake.Cake, dialer Dialer, verifier Verifier) *Remote

func (*Remote) Fetch

func (r *Remote) Fetch(log lager.Logger, u *url.URL, username, password string, diskQuota int64) (*Image, error)

func (*Remote) FetchID

func (r *Remote) FetchID(log lager.Logger, u *url.URL) (layercake.ID, error)

type RemoteFetcher

type RemoteFetcher interface {
	Fetch(request *FetchRequest) (*Image, error)
}

type RemoteImageIDFetcher

type RemoteImageIDFetcher interface {
	FetchID(log lager.Logger, u *url.URL) (layercake.ID, error)
}

type RepositoryFetcher

type RepositoryFetcher interface {
	Fetch(log lager.Logger, u *url.URL, username, password string, diskQuota int64) (*Image, error)
	FetchID(log lager.Logger, u *url.URL) (layercake.ID, error)
}

type Retryable

type Retryable struct {
	RepositoryFetcher
}

func (Retryable) Fetch

func (retryable Retryable) Fetch(log lager.Logger, repoName *url.URL, username, password string, diskQuota int64) (*Image, error)

func (Retryable) FetchID

func (retryable Retryable) FetchID(log lager.Logger, repoURL *url.URL) (layercake.ID, error)

type Verifier

type Verifier interface {
	Verify(io.Reader, digest.Digest) (io.ReadCloser, int64, error)
}

type VerifyFunc

type VerifyFunc func(io.Reader, digest.Digest) (io.ReadCloser, int64, error)

func (VerifyFunc) Verify

func (fn VerifyFunc) Verify(r io.Reader, d digest.Digest) (io.ReadCloser, int64, error)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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