storage

package
v2.0.0-alpha.0+incompa... Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2015 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package storage contains storage services for use in the registry application. It should be considered an internal package, as of Go 1.4.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLayerExists returned when layer already exists
	ErrLayerExists = fmt.Errorf("layer exists")

	// ErrLayerTarSumVersionUnsupported when tarsum is unsupported version.
	ErrLayerTarSumVersionUnsupported = fmt.Errorf("unsupported tarsum version")

	// ErrLayerUploadUnknown returned when upload is not found.
	ErrLayerUploadUnknown = fmt.Errorf("layer upload unknown")

	// ErrLayerClosed returned when an operation is attempted on a closed
	// Layer or LayerUpload.
	ErrLayerClosed = fmt.Errorf("layer closed")
)

Functions

func RegisterLayerHandler

func RegisterLayerHandler(name string, initFunc LayerHandlerInitFunc) error

RegisterLayerHandler is used to register an LayerHandlerInitFunc for a LayerHandler backend with the given name.

Types

type ErrLayerInvalidDigest

type ErrLayerInvalidDigest struct {
	Digest digest.Digest
}

ErrLayerInvalidDigest returned when tarsum check fails.

func (ErrLayerInvalidDigest) Error

func (err ErrLayerInvalidDigest) Error() string

type ErrLayerInvalidSize

type ErrLayerInvalidSize struct {
	Size int64
}

ErrLayerInvalidSize returned when length check fails.

func (ErrLayerInvalidSize) Error

func (err ErrLayerInvalidSize) Error() string

type ErrManifestUnverified

type ErrManifestUnverified struct{}

ErrManifestUnverified is returned when the registry is unable to verify the manifest.

func (ErrManifestUnverified) Error

func (ErrManifestUnverified) Error() string

type ErrManifestVerification

type ErrManifestVerification []error

ErrManifestVerification provides a type to collect errors encountered during manifest verification. Currently, it accepts errors of all types, but it may be narrowed to those involving manifest verification.

func (ErrManifestVerification) Error

func (errs ErrManifestVerification) Error() string

type ErrUnknownLayer

type ErrUnknownLayer struct {
	FSLayer manifest.FSLayer
}

ErrUnknownLayer returned when layer cannot be found.

func (ErrUnknownLayer) Error

func (err ErrUnknownLayer) Error() string

type ErrUnknownManifest

type ErrUnknownManifest struct {
	Name string
	Tag  string
}

ErrUnknownManifest is returned if the manifest is not known by the registry.

func (ErrUnknownManifest) Error

func (err ErrUnknownManifest) Error() string

type ErrUnknownManifestRevision

type ErrUnknownManifestRevision struct {
	Name     string
	Revision digest.Digest
}

ErrUnknownManifestRevision is returned when a manifest cannot be found by revision within a repository.

func (ErrUnknownManifestRevision) Error

func (err ErrUnknownManifestRevision) Error() string

type ErrUnknownRepository

type ErrUnknownRepository struct {
	Name string
}

ErrUnknownRepository is returned if the named repository is not known by the registry.

func (ErrUnknownRepository) Error

func (err ErrUnknownRepository) Error() string

type Layer

type Layer interface {
	// http.ServeContent requires an efficient implementation of
	// ReadSeeker.Seek(0, os.SEEK_END).
	io.ReadSeeker
	io.Closer

	// Name returns the repository under which this layer is linked.
	Name() string // TODO(stevvooe): struggling with nomenclature: should this be "repo" or "name"?

	// Digest returns the unique digest of the blob, which is the tarsum for
	// layers.
	Digest() digest.Digest

	// CreatedAt returns the time this layer was created.
	CreatedAt() time.Time
}

Layer provides a readable and seekable layer object. Typically, implementations are *not* goroutine safe.

type LayerHandler

type LayerHandler interface {
	// Resolve returns an http.Handler which can serve the contents of a given
	// Layer if possible, or nil and an error when unsupported. This may
	// directly serve the contents of the layer or issue a redirect to another
	// URL hosting the content.
	Resolve(layer Layer) (http.Handler, error)
}

LayerHandler provides middleware for serving the contents of a Layer.

func GetLayerHandler

func GetLayerHandler(name string, options map[string]interface{}, storageDriver storagedriver.StorageDriver) (LayerHandler, error)

GetLayerHandler constructs a LayerHandler with the given options using the named backend.

type LayerHandlerInitFunc

type LayerHandlerInitFunc func(storageDriver storagedriver.StorageDriver, options map[string]interface{}) (LayerHandler, error)

LayerHandlerInitFunc is the type of a LayerHandler factory function and is used to register the contsructor for different LayerHandler backends.

type LayerService

type LayerService interface {
	// Exists returns true if the layer exists.
	Exists(digest digest.Digest) (bool, error)

	// Fetch the layer identifed by TarSum.
	Fetch(digest digest.Digest) (Layer, error)

	// Upload begins a layer upload to repository identified by name,
	// returning a handle.
	Upload() (LayerUpload, error)

	// Resume continues an in progress layer upload, returning a handle to the
	// upload. The caller should seek to the latest desired upload location
	// before proceeding.
	Resume(uuid string) (LayerUpload, error)
}

LayerService provides operations on layer files in a backend storage.

type LayerUpload

type LayerUpload interface {
	io.WriteSeeker
	io.Closer

	// Name of the repository under which the layer will be linked.
	Name() string

	// UUID returns the identifier for this upload.
	UUID() string

	// StartedAt returns the time this layer upload was started.
	StartedAt() time.Time

	// Finish marks the upload as completed, returning a valid handle to the
	// uploaded layer. The digest is validated against the contents of the
	// uploaded layer.
	Finish(digest digest.Digest) (Layer, error)

	// Cancel the layer upload process.
	Cancel() error
}

LayerUpload provides a handle for working with in-progress uploads. Instances can be obtained from the LayerService.Upload and LayerService.Resume.

type ManifestService

type ManifestService interface {
	// Tags lists the tags under the named repository.
	Tags() ([]string, error)

	// Exists returns true if the manifest exists.
	Exists(tag string) (bool, error)

	// Get retrieves the named manifest, if it exists.
	Get(tag string) (*manifest.SignedManifest, error)

	// Put creates or updates the named manifest.
	// Put(tag string, manifest *manifest.SignedManifest) (digest.Digest, error)
	Put(tag string, manifest *manifest.SignedManifest) error

	// Delete removes the named manifest, if it exists.
	Delete(tag string) error
}

ManifestService provides operations on image manifests.

type Registry

type Registry interface {
	// Repository should return a reference to the named repository. The
	// registry may or may not have the repository but should always return a
	// reference.
	Repository(name string) Repository
}

Registry represents a collection of repositories, addressable by name.

func NewRegistryWithDriver

func NewRegistryWithDriver(driver storagedriver.StorageDriver) Registry

NewRegistryWithDriver creates a new registry instance from the provided driver. The resulting registry may be shared by multiple goroutines but is cheap to allocate.

type Repository

type Repository interface {
	// Name returns the name of the repository.
	Name() string

	// Manifests returns a reference to this repository's manifest service.
	Manifests() ManifestService

	// Layers returns a reference to this repository's layers service.
	Layers() LayerService
}

Repository is a named collection of manifests and layers.

Jump to

Keyboard shortcuts

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