{"modulePath":"github.com/AlaudaDevops/distribution","version":"v2.8.3+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package distribution\n\nPackage distribution will define the interfaces for the components of docker distribution. The goal is to allow users to reliably package, ship and store content related to docker images.\n\nThis is currently a work in progress. More details are available in the README.md.\n\n## Variables\n\n```go\nvar (\n\t// ErrBlobExists returned when blob already exists\n\tErrBlobExists = errors.New(\"blob exists\")\n\n\t// ErrBlobDigestUnsupported when blob digest is an unsupported version.\n\tErrBlobDigestUnsupported = errors.New(\"unsupported blob digest\")\n\n\t// ErrBlobUnknown when blob is not found.\n\tErrBlobUnknown = errors.New(\"unknown blob\")\n\n\t// ErrBlobUploadUnknown returned when upload is not found.\n\tErrBlobUploadUnknown = errors.New(\"blob upload unknown\")\n\n\t// ErrBlobInvalidLength returned when the blob has an expected length on\n\t// commit, meaning mismatched with the descriptor or an invalid value.\n\tErrBlobInvalidLength = errors.New(\"blob invalid length\")\n)\n```\n\n```go\nvar ErrAccessDenied = errors.New(\"access denied\")\n```\nErrAccessDenied is returned when an access to a requested resource is denied.\n\n```go\nvar ErrManifestNotModified = errors.New(\"manifest not modified\")\n```\nErrManifestNotModified is returned when a conditional manifest GetByTag returns nil due to the client indicating it has the latest version\n\n```go\nvar ErrSchemaV1Unsupported = errors.New(\"manifest schema v1 unsupported\")\n```\nErrSchemaV1Unsupported is returned when a client tries to upload a schema v1 manifest but the registry is configured to reject it\n\n```go\nvar ErrUnsupported = errors.New(\"operation unsupported\")\n```\nErrUnsupported is returned when an unimplemented or unsupported action is performed\n\n```go\nvar GlobalScope = Scope(fullScope{})\n```\nGlobalScope represents the full namespace scope which contains all other scopes.\n\n## Functions\n\n```go\nfunc ManifestMediaTypes() (mediaTypes []string)\n```\nManifestMediaTypes returns the supported media types for manifests.\n\n```go\nfunc RegisterManifestSchema(mediaType string, u UnmarshalFunc) error\n```\nRegisterManifestSchema registers an UnmarshalFunc for a given schema type.  This should be called from specific\n\n```go\nfunc UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error)\n```\nUnmarshalManifest looks up manifest unmarshal functions based on MediaType\n\n## Types\n\n```go\ntype BlobCreateOption interface {\n\tApply(interface{}) error\n}\n```\nBlobCreateOption is a general extensible function argument for blob creation methods. A BlobIngester may choose to honor any or none of the given BlobCreateOptions, which can be specific to the implementation of the BlobIngester receiving them. TODO (brianbland): unify this with ManifestServiceOption in the future\n\n```go\ntype BlobDeleter interface {\n\tDelete(ctx context.Context, dgst digest.Digest) error\n}\n```\nBlobDeleter enables deleting blobs from storage.\n\n```go\ntype BlobDescriptorService interface {\n\tBlobStatter\n\n\t// SetDescriptor assigns the descriptor to the digest. The provided digest and\n\t// the digest in the descriptor must map to identical content but they may\n\t// differ on their algorithm. The descriptor must have the canonical\n\t// digest of the content and the digest algorithm must match the\n\t// annotators canonical algorithm.\n\t//\n\t// Such a facility can be used to map blobs between digest domains, with\n\t// the restriction that the algorithm of the descriptor must match the\n\t// canonical algorithm (ie sha256) of the annotator.\n\tSetDescriptor(ctx context.Context, dgst digest.Digest, desc Descriptor) error\n\n\t// Clear enables descriptors to be unlinked\n\tClear(ctx context.Context, dgst digest.Digest) error\n}\n```\nBlobDescriptorService manages metadata about a blob by digest. Most implementations will not expose such an interface explicitly. Such mappings should be maintained by interacting with the BlobIngester. Hence, this is left off of BlobService and BlobStore.\n\n```go\ntype BlobDescriptorServiceFactory interface {\n\tBlobAccessController(svc BlobDescriptorService) BlobDescriptorService\n}\n```\nBlobDescriptorServiceFactory creates middleware for BlobDescriptorService.\n\n```go\ntype BlobEnumerator interface {\n\tEnumerate(ctx context.Context, ingester func(dgst digest.Digest) error) error\n}\n```\nBlobEnumerator enables iterating over blobs from storage\n\n```go\ntype BlobIngester interface {\n\t// Put inserts the content p into the blob service, returning a descriptor\n\t// or an error.\n\tPut(ctx context.Context, mediaType string, p []byte) (Descriptor, error)\n\n\t// Create allocates a new blob writer to add a blob to this service. The\n\t// returned handle can be written to and later resumed using an opaque\n\t// identifier. With this approach, one can Close and Resume a BlobWriter\n\t// multiple times until the BlobWriter is committed or cancelled.\n\tCreate(ctx context.Context, options ...BlobCreateOption) (BlobWriter, error)\n\n\t// Resume attempts to resume a write to a blob, identified by an id.\n\tResume(ctx context.Context, id string) (BlobWriter, error)\n}\n```\nBlobIngester ingests blob data.\n\n```go\ntype BlobProvider interface {\n\t// Get returns the entire blob identified by digest along with the descriptor.\n\tGet(ctx context.Context, dgst digest.Digest) ([]byte, error)\n\n\t// Open provides a ReadSeekCloser to the blob identified by the provided\n\t// descriptor. If the blob is not known to the service, an error will be\n\t// returned.\n\tOpen(ctx context.Context, dgst digest.Digest) (ReadSeekCloser, error)\n}\n```\nBlobProvider describes operations for getting blob data.\n\n```go\ntype BlobServer interface {\n\t// ServeBlob attempts to serve the blob, identified by dgst, via http. The\n\t// service may decide to redirect the client elsewhere or serve the data\n\t// directly.\n\t//\n\t// This handler only issues successful responses, such as 2xx or 3xx,\n\t// meaning it serves data or issues a redirect. If the blob is not\n\t// available, an error will be returned and the caller may still issue a\n\t// response.\n\t//\n\t// The implementation may serve the same blob from a different digest\n\t// domain. The appropriate headers will be set for the blob, unless they\n\t// have already been set by the caller.\n\tServeBlob(ctx context.Context, w http.ResponseWriter, r *http.Request, dgst digest.Digest) error\n}\n```\nBlobServer can serve blobs via http.\n\n```go\ntype BlobService interface {\n\tBlobStatter\n\tBlobProvider\n\tBlobIngester\n}\n```\nBlobService combines the operations to access, read and write blobs. This can be used to describe remote blob services.\n\n```go\ntype BlobStatter interface {\n\t// Stat provides metadata about a blob identified by the digest. If the\n\t// blob is unknown to the describer, ErrBlobUnknown will be returned.\n\tStat(ctx context.Context, dgst digest.Digest) (Descriptor, error)\n}\n```\nBlobStatter makes blob descriptors available by digest. The service may provide a descriptor of a different digest if the provided digest is not canonical.\n\n```go\ntype BlobStore interface {\n\tBlobService\n\tBlobServer\n\tBlobDeleter\n}\n```\nBlobStore represent the entire suite of blob related operations. Such an implementation can access, read, write, delete and serve blobs.\n\n```go\ntype BlobWriter interface {\n\tio.WriteCloser\n\tio.ReaderFrom\n\n\t// Size returns the number of bytes written to this blob.\n\tSize() int64\n\n\t// ID returns the identifier for this writer. The ID can be used with the\n\t// Blob service to later resume the write.\n\tID() string\n\n\t// StartedAt returns the time this blob write was started.\n\tStartedAt() time.Time\n\n\t// Commit completes the blob writer process. The content is verified\n\t// against the provided provisional descriptor, which may result in an\n\t// error. Depending on the implementation, written data may be validated\n\t// against the provisional descriptor fields. If MediaType is not present,\n\t// the implementation may reject the commit or assign \"application/octet-\n\t// stream\" to the blob. The returned descriptor may have a different\n\t// digest depending on the blob store, referred to as the canonical\n\t// descriptor.\n\tCommit(ctx context.Context, provisional Descriptor) (canonical Descriptor, err error)\n\n\t// Cancel ends the blob write without storing any data and frees any\n\t// associated resources. Any data written thus far will be lost. Cancel\n\t// implementations should allow multiple calls even after a commit that\n\t// result in a no-op. This allows use of Cancel in a defer statement,\n\t// increasing the assurance that it is correctly called.\n\tCancel(ctx context.Context) error\n}\n```\nBlobWriter provides a handle for inserting data into a blob store. Instances should be obtained from BlobWriteService.Writer and BlobWriteService.Resume. If supported by the store, a writer can be recovered with the id.\n\n```go\ntype CreateOptions struct {\n\tMount struct {\n\t\tShouldMount bool\n\t\tFrom        reference.Canonical\n\t\t// Stat allows to pass precalculated descriptor to link and return.\n\t\t// Blob access check will be skipped if set.\n\t\tStat *Descriptor\n\t}\n}\n```\nCreateOptions is a collection of blob creation modifiers relevant to general blob storage intended to be configured by the BlobCreateOption.Apply method.\n\n```go\ntype Describable interface {\n\tDescriptor() Descriptor\n}\n```\nDescribable is an interface for descriptors\n\n```go\ntype Descriptor struct {\n\t// MediaType describe the type of the content. All text based formats are\n\t// encoded as utf-8.\n\tMediaType string `json:\"mediaType,omitempty\"`\n\n\t// Size in bytes of content.\n\tSize int64 `json:\"size,omitempty\"`\n\n\t// Digest uniquely identifies the content. A byte stream can be verified\n\t// against this digest.\n\tDigest digest.Digest `json:\"digest,omitempty\"`\n\n\t// URLs contains the source URLs of this content.\n\tURLs []string `json:\"urls,omitempty\"`\n\n\t// Annotations contains arbitrary metadata relating to the targeted content.\n\tAnnotations map[string]string `json:\"annotations,omitempty\"`\n\n\t// Platform describes the platform which the image in the manifest runs on.\n\t// This should only be used when referring to a manifest.\n\tPlatform *v1.Platform `json:\"platform,omitempty\"`\n}\n```\nDescriptor describes targeted content. Used in conjunction with a blob store, a descriptor can be used to fetch, store and target any kind of blob. The struct also describes the wire protocol format. Fields should only be added but never changed.\n\n```go\nfunc (d Descriptor) Descriptor() Descriptor\n```\nDescriptor returns the descriptor, to make it satisfy the Describable interface. Note that implementations of Describable are generally objects which can be described, not simply descriptors; this exception is in place to make it more convenient to pass actual descriptors to functions that expect Describable objects.\n\n```go\ntype ErrBlobInvalidDigest struct {\n\tDigest digest.Digest\n\tReason error\n}\n```\nErrBlobInvalidDigest returned when digest check fails.\n\n```go\nfunc (err ErrBlobInvalidDigest) Error() string\n```\n\n```go\ntype ErrBlobMounted struct {\n\tFrom       reference.Canonical\n\tDescriptor Descriptor\n}\n```\nErrBlobMounted returned when a blob is mounted from another repository instead of initiating an upload session.\n\n```go\nfunc (err ErrBlobMounted) Error() string\n```\n\n```go\ntype ErrManifestBlobUnknown struct {\n\tDigest digest.Digest\n}\n```\nErrManifestBlobUnknown returned when a referenced blob cannot be found.\n\n```go\nfunc (err ErrManifestBlobUnknown) Error() string\n```\n\n```go\ntype ErrManifestNameInvalid struct {\n\tName   string\n\tReason error\n}\n```\nErrManifestNameInvalid should be used to denote an invalid manifest name. Reason may set, indicating the cause of invalidity.\n\n```go\nfunc (err ErrManifestNameInvalid) Error() string\n```\n\n```go\ntype ErrManifestUnknown struct {\n\tName string\n\tTag  string\n}\n```\nErrManifestUnknown is returned if the manifest is not known by the registry.\n\n```go\nfunc (err ErrManifestUnknown) Error() string\n```\n\n```go\ntype ErrManifestUnknownRevision struct {\n\tName     string\n\tRevision digest.Digest\n}\n```\nErrManifestUnknownRevision is returned when a manifest cannot be found by revision within a repository.\n\n```go\nfunc (err ErrManifestUnknownRevision) Error() string\n```\n\n```go\ntype ErrManifestUnverified struct{}\n```\nErrManifestUnverified is returned when the registry is unable to verify the manifest.\n\n```go\nfunc (ErrManifestUnverified) Error() string\n```\n\n```go\ntype ErrManifestVerification []error\n```\nErrManifestVerification 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.\n\n```go\nfunc (errs ErrManifestVerification) Error() string\n```\n\n```go\ntype ErrRepositoryNameInvalid struct {\n\tName   string\n\tReason error\n}\n```\nErrRepositoryNameInvalid should be used to denote an invalid repository name. Reason may set, indicating the cause of invalidity.\n\n```go\nfunc (err ErrRepositoryNameInvalid) Error() string\n```\n\n```go\ntype ErrRepositoryUnknown struct {\n\tName string\n}\n```\nErrRepositoryUnknown is returned if the named repository is not known by the registry.\n\n```go\nfunc (err ErrRepositoryUnknown) Error() string\n```\n\n```go\ntype ErrTagUnknown struct {\n\tTag string\n}\n```\nErrTagUnknown is returned if the given tag is not known by the tag service\n\n```go\nfunc (err ErrTagUnknown) Error() string\n```\n\n```go\ntype Manifest interface {\n\t// References returns a list of objects which make up this manifest.\n\t// A reference is anything which can be represented by a\n\t// distribution.Descriptor. These can consist of layers, resources or other\n\t// manifests.\n\t//\n\t// While no particular order is required, implementations should return\n\t// them from highest to lowest priority. For example, one might want to\n\t// return the base layer before the top layer.\n\tReferences() []Descriptor\n\n\t// Payload provides the serialized format of the manifest, in addition to\n\t// the media type.\n\tPayload() (mediaType string, payload []byte, err error)\n}\n```\nManifest represents a registry object specifying a set of references and an optional target\n\n```go\ntype ManifestBuilder interface {\n\t// Build creates the manifest from his builder.\n\tBuild(ctx context.Context) (Manifest, error)\n\n\t// References returns a list of objects which have been added to this\n\t// builder. The dependencies are returned in the order they were added,\n\t// which should be from base to head.\n\tReferences() []Descriptor\n\n\t// AppendReference includes the given object in the manifest after any\n\t// existing dependencies. If the add fails, such as when adding an\n\t// unsupported dependency, an error may be returned.\n\t//\n\t// The destination of the reference is dependent on the manifest type and\n\t// the dependency type.\n\tAppendReference(dependency Describable) error\n}\n```\nManifestBuilder creates a manifest allowing one to include dependencies. Instances can be obtained from a version-specific manifest package.  Manifest specific data is passed into the function which creates the builder.\n\n```go\ntype ManifestEnumerator interface {\n\t// Enumerate calls ingester for each manifest.\n\tEnumerate(ctx context.Context, ingester func(digest.Digest) error) error\n}\n```\nManifestEnumerator enables iterating over manifests\n\n```go\ntype ManifestService interface {\n\t// Exists returns true if the manifest exists.\n\tExists(ctx context.Context, dgst digest.Digest) (bool, error)\n\n\t// Get retrieves the manifest specified by the given digest\n\tGet(ctx context.Context, dgst digest.Digest, options ...ManifestServiceOption) (Manifest, error)\n\n\t// Put creates or updates the given manifest returning the manifest digest\n\tPut(ctx context.Context, manifest Manifest, options ...ManifestServiceOption) (digest.Digest, error)\n\n\t// Delete removes the manifest specified by the given digest. Deleting\n\t// a manifest that doesn't exist will return ErrManifestNotFound\n\tDelete(ctx context.Context, dgst digest.Digest) error\n}\n```\nManifestService describes operations on image manifests.\n\n```go\ntype ManifestServiceOption interface {\n\tApply(ManifestService) error\n}\n```\nManifestServiceOption is a function argument for Manifest Service methods\n\n```go\nfunc WithManifestMediaTypes(mediaTypes []string) ManifestServiceOption\n```\nWithManifestMediaTypes lists the media types the client wishes the server to provide.\n\n```go\nfunc WithTag(tag string) ManifestServiceOption\n```\nWithTag allows a tag to be passed into Put\n\n```go\ntype Namespace interface {\n\t// Scope describes the names that can be used with this Namespace. The\n\t// global namespace will have a scope that matches all names. The scope\n\t// effectively provides an identity for the namespace.\n\tScope() Scope\n\n\t// Repository should return a reference to the named repository. The\n\t// registry may or may not have the repository but should always return a\n\t// reference.\n\tRepository(ctx context.Context, name reference.Named) (Repository, error)\n\n\t// Repositories fills 'repos' with a lexicographically sorted catalog of repositories\n\t// up to the size of 'repos' and returns the value 'n' for the number of entries\n\t// which were filled.  'last' contains an offset in the catalog, and 'err' will be\n\t// set to io.EOF if there are no more entries to obtain.\n\tRepositories(ctx context.Context, repos []string, last string) (n int, err error)\n\n\t// Blobs returns a blob enumerator to access all blobs\n\tBlobs() BlobEnumerator\n\n\t// BlobStatter returns a BlobStatter to control\n\tBlobStatter() BlobStatter\n}\n```\nNamespace represents a collection of repositories, addressable by name. Generally, a namespace is backed by a set of one or more services, providing facilities such as registry access, trust, and indexing.\n\n```go\ntype ReadSeekCloser interface {\n\tio.ReadSeeker\n\tio.Closer\n}\n```\nReadSeekCloser is the primary reader type for blob data, combining io.ReadSeeker with io.Closer.\n\n```go\ntype Repository interface {\n\t// Named returns the name of the repository.\n\tNamed() reference.Named\n\n\t// Manifests returns a reference to this repository's manifest service.\n\t// with the supplied options applied.\n\tManifests(ctx context.Context, options ...ManifestServiceOption) (ManifestService, error)\n\n\t// Blobs returns a reference to this repository's blob service.\n\tBlobs(ctx context.Context) BlobStore\n\n\t// Tags returns a reference to this repositories tag service\n\tTags(ctx context.Context) TagService\n}\n```\nRepository is a named collection of manifests and layers.\n\n```go\ntype RepositoryEnumerator interface {\n\tEnumerate(ctx context.Context, ingester func(string) error) error\n}\n```\nRepositoryEnumerator describes an operation to enumerate repositories\n\n```go\ntype RepositoryRemover interface {\n\tRemove(ctx context.Context, name reference.Named) error\n}\n```\nRepositoryRemover removes given repository\n\n```go\ntype Scope interface {\n\t// Contains returns true if the name belongs to the namespace.\n\tContains(name string) bool\n}\n```\nScope defines the set of items that match a namespace.\n\n```go\ntype TagService interface {\n\t// Get retrieves the descriptor identified by the tag. Some\n\t// implementations may differentiate between \"trusted\" tags and\n\t// \"untrusted\" tags. If a tag is \"untrusted\", the mapping will be returned\n\t// as an ErrTagUntrusted error, with the target descriptor.\n\tGet(ctx context.Context, tag string) (Descriptor, error)\n\n\t// Tag associates the tag with the provided descriptor, updating the\n\t// current association, if needed.\n\tTag(ctx context.Context, tag string, desc Descriptor) error\n\n\t// Untag removes the given tag association\n\tUntag(ctx context.Context, tag string) error\n\n\t// All returns the set of tags managed by this tag service\n\tAll(ctx context.Context) ([]string, error)\n\n\t// Lookup returns the set of tags referencing the given digest.\n\tLookup(ctx context.Context, digest Descriptor) ([]string, error)\n}\n```\nTagService provides access to information about tagged objects.\n\n```go\ntype UnmarshalFunc func([]byte) (Manifest, Descriptor, error)\n```\nUnmarshalFunc implements manifest unmarshalling a given MediaType\n\n```go\ntype WithManifestMediaTypesOption struct{ MediaTypes []string }\n```\nWithManifestMediaTypesOption holds a list of accepted media types\n\n```go\nfunc (o WithManifestMediaTypesOption) Apply(m ManifestService) error\n```\nApply conforms to the ManifestServiceOption interface\n\n```go\ntype WithTagOption struct{ Tag string }\n```\nWithTagOption holds a tag\n\n```go\nfunc (o WithTagOption) Apply(m ManifestService) error\n```\nApply conforms to the ManifestServiceOption interface\n\n","path":"github.com/AlaudaDevops/distribution","name":"distribution","synopsis":"Package distribution will define the interfaces for the components of docker distribution.","isRedistributable":true}
