registry

package
v0.0.0-...-9362506 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeBlobUnknown         = ErrorCode{Code: "BLOB_UNKNOWN", Message: "blob unknown to registry"}
	ErrCodeBlobUploadInvalid   = ErrorCode{Code: "BLOB_UPLOAD_INVALID", Message: "blob upload invalid"}
	ErrCodeBlobUploadUnknown   = ErrorCode{Code: "BLOB_UPLOAD_UNKNOWN", Message: "blob upload unknown to registry"}
	ErrCodeDigestInvalid       = ErrorCode{Code: "DIGEST_INVALID", Message: "provided digest did not match uploaded content"}
	ErrCodeManifestBlobUnknown = ErrorCode{Code: "MANIFEST_BLOB_UNKNOWN", Message: "manifest references a manifest or blob unknown to registry"}
	ErrCodeManifestInvalid     = ErrorCode{Code: "MANIFEST_INVALID", Message: "manifest invalid"}
	ErrCodeManifestUnknown     = ErrorCode{Code: "MANIFEST_UNKNOWN", Message: "manifest unknown to registry"}
	ErrCodeNameInvalid         = ErrorCode{Code: "NAME_INVALID", Message: "invalid repository name"}
	ErrCodeNameUnknown         = ErrorCode{Code: "NAME_UNKNOWN", Message: "repository name not known to registry"}
	ErrCodeSizeInvalid         = ErrorCode{Code: "SIZE_INVALID", Message: "provided length did not match content length"}
	ErrCodeUnauthorized        = ErrorCode{Code: "UNAUTHORIZED", Message: "authentication required"}
	ErrCodeDenied              = ErrorCode{Code: "DENIED", Message: "requested access to the resource is denied"}
	ErrCodeUnsupported         = ErrorCode{Code: "UNSUPPORTED", Message: "the operation is unsupported"}
	ErrCodeTooManyRequests     = ErrorCode{Code: "TOOMANYREQUESTS", Message: "too many requests"}
)

TODO use distribution/.../errcode

Functions

This section is empty.

Types

type Blob

type Blob struct {
	ContentType string
	Data        []byte
}

func (*Blob) Payload

func (m *Blob) Payload() (string, []byte, error)

func (*Blob) References

func (m *Blob) References() []distribution.Descriptor

type BlobStore

type BlobStore struct {
	Repo *Repository
}

func (*BlobStore) Create

func (s *BlobStore) Create(ctx context.Context, options ...distribution.BlobCreateOption) (distribution.BlobWriter, error)

func (*BlobStore) Delete

func (s *BlobStore) Delete(ctx context.Context, dgst digest.Digest) error

func (*BlobStore) Get

func (s *BlobStore) Get(ctx context.Context, dgst digest.Digest) ([]byte, error)

func (*BlobStore) Open

func (s *BlobStore) Open(ctx context.Context, dgst digest.Digest) (io.ReadSeekCloser, error)

func (*BlobStore) Put

func (s *BlobStore) Put(ctx context.Context, mediaType string, p []byte) (distribution.Descriptor, error)

func (*BlobStore) Resume

func (s *BlobStore) Resume(ctx context.Context, id string) (distribution.BlobWriter, error)

func (*BlobStore) ServeBlob

func (s *BlobStore) ServeBlob(ctx context.Context, w http.ResponseWriter, r *http.Request, dgst digest.Digest) error

func (*BlobStore) Stat

func (s *BlobStore) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error)

type ErrorCode

type ErrorCode struct {
	Code    string  `json:"code"`
	Message string  `json:"message"`
	Detail  *string `json:"detail"`
}

type ErrorCodes

type ErrorCodes struct {
	Errors []ErrorCode `json:"errors"`
}

func NewErrorCodes

func NewErrorCodes(ec ...ErrorCode) *ErrorCodes

func (*ErrorCodes) Error

func (e *ErrorCodes) Error() string

type ManifestService

type ManifestService struct {
	Repo *Repository
}

func (*ManifestService) Delete

func (s *ManifestService) Delete(ctx context.Context, dgst digest.Digest) error

func (*ManifestService) Exists

func (s *ManifestService) Exists(ctx context.Context, dgst digest.Digest) (bool, error)

func (*ManifestService) Get

func (s *ManifestService) Get(ctx context.Context, dgst digest.Digest, options ...distribution.ManifestServiceOption) (distribution.Manifest, error)

func (*ManifestService) Put

func (s *ManifestService) Put(ctx context.Context, manifest distribution.Manifest, options ...distribution.ManifestServiceOption) (digest.Digest, error)

type Registry

type Registry struct {
	Repos map[string]*Repository
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) NewRepository

func (r *Registry) NewRepository(named reference.Named) *Repository

func (*Registry) Repository

func (r *Registry) Repository(named reference.Named) (distribution.Repository, error)

type Repository

type Repository struct {
	Storage *RepositoryStorage
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(named reference.Named) *Repository

func (*Repository) Blobs

func (r *Repository) Blobs(ctx context.Context) distribution.BlobStore

func (*Repository) Manifests

func (r *Repository) Manifests(ctx context.Context, options ...distribution.ManifestServiceOption) (distribution.ManifestService, error)

func (*Repository) Named

func (r *Repository) Named() reference.Named

func (*Repository) PopulateImage

func (r *Repository) PopulateImage() (reference.NamedTagged, distribution.Descriptor, distribution.Manifest)

func (*Repository) PopulateImageWithTag

func (r *Repository) PopulateImageWithTag(tag string) (reference.NamedTagged, distribution.Descriptor, distribution.Manifest)

func (*Repository) PopulateLayer

func (r *Repository) PopulateLayer() distribution.Descriptor

func (*Repository) PopulateManifest

func (r *Repository) PopulateManifest() (distribution.Descriptor, *schema2.DeserializedManifest)

func (*Repository) PopulateManifestList

func (r *Repository) PopulateManifestList() (distribution.Descriptor, *manifestlist.DeserializedManifestList)

func (*Repository) PopulateOciManifest

func (r *Repository) PopulateOciManifest() (distribution.Descriptor, *ocischema.DeserializedManifest)

func (*Repository) Tags

func (r *Repository) Tags(ctx context.Context) distribution.TagService

type RepositoryStorage

type RepositoryStorage struct {
	Manifests map[string]distribution.Manifest
	Blobs     map[string]Blob
	Tags      map[string]distribution.Descriptor
}

type Server

type Server struct {
	*Registry

	T *testing.T

	EnableAuth bool
}

func NewServer

func NewServer(t *testing.T, reg *Registry) *Server

func (*Server) Handler

func (s *Server) Handler() http.HandlerFunc

type TagService

type TagService struct {
	Repo *Repository
}

func (*TagService) All

func (s *TagService) All(ctx context.Context) ([]string, error)

func (*TagService) Get

func (s *TagService) Get(ctx context.Context, tag string) (distribution.Descriptor, error)

func (*TagService) Lookup

func (s *TagService) Lookup(ctx context.Context, digest distribution.Descriptor) ([]string, error)

func (*TagService) Tag

func (s *TagService) Tag(ctx context.Context, tag string, desc distribution.Descriptor) error

func (*TagService) Untag

func (s *TagService) Untag(ctx context.Context, tag string) error

Jump to

Keyboard shortcuts

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