ociserver

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OCIError added in v0.0.20

type OCIError struct {
	Code    string `json:"code"`
	Message string `json:"message,omitempty"`
	Detail  string `json:"detail,omitempty"`
	// contains filtered or unexported fields
}

OCIError is a struct that implements the error interface, and formats errors in a way that adheres to the OCI distribution spec

func ErrBadRequest added in v0.0.20

func ErrBadRequest(msg string) *OCIError

ErrBadRequest is not an OCI error... just added for a catch-all for now

func ErrBlobUnknown added in v0.0.20

func ErrBlobUnknown(digest string) *OCIError

ErrBlobUnknown is for when a blob is not found in the registry

func ErrBlobUploadInvalid added in v0.0.20

func ErrBlobUploadInvalid(msg string) *OCIError

ErrBlobUploadInvalid is a generic error message if something is invalid on upload

func ErrBlobUploadOutOfOrder added in v0.0.20

func ErrBlobUploadOutOfOrder() *OCIError

ErrBlobUploadOutOfOrder is an error when blobs are uploaded out of order

func ErrBlobUploadUnknown added in v0.0.20

func ErrBlobUploadUnknown(session string) *OCIError

ErrBlobUploadUnknown is an error for when the upload session is not found

func ErrDenied added in v0.0.20

func ErrDenied(msg string) *OCIError

ErrDenied is an error for when access is denied

func ErrDigestInvalid added in v0.0.20

func ErrDigestInvalid(msg string) *OCIError

ErrDigestInvalid is sent if the digest is invalid

func ErrManifestBlobUnknown added in v0.0.20

func ErrManifestBlobUnknown(digest string) *OCIError

ErrManifestBlobUnknown is an error for when the registry has not received a blob referenced by a manifest

func ErrManifestInvalid added in v0.0.20

func ErrManifestInvalid(details string) *OCIError

ErrManifestInvalid is an error for when a manifest is invalid in some way

func ErrManifestTooLarge added in v0.0.20

func ErrManifestTooLarge() *OCIError

ErrManifestTooLarge is returned when the pushed manifest exceeds the registry size limit.

func ErrManifestUnknown added in v0.0.20

func ErrManifestUnknown(digest string) *OCIError

ErrManifestUnknown is an error for if a manifest is not found in the registry

func ErrMediaTypeUnsupported added in v0.0.20

func ErrMediaTypeUnsupported(mediaType string) *OCIError

ErrMediaTypeUnsupported is an error for when a pushed mediatype is unsupported

func ErrMethodNotAllowed added in v0.0.20

func ErrMethodNotAllowed(msg string) *OCIError

ErrMethodNotAllowed is returned when an operation is not permitted on the target resource.

func ErrNameInvalid added in v0.0.20

func ErrNameInvalid(name string) *OCIError

ErrNameInvalid is returned when the repository name is invalid.

func ErrNameUnknown added in v0.0.20

func ErrNameUnknown(name string) *OCIError

ErrNameUnknown is returned when the repository name is not known to the registry

func ErrNotAcceptable added in v0.0.20

func ErrNotAcceptable(mediaType string) *OCIError

ErrNotAcceptable is returned when a stored representation cannot satisfy the Accept header.

func ErrNotImplemented added in v0.0.20

func ErrNotImplemented() *OCIError

ErrNotImplemented is returned when an endpoint or operation has not been implemented.

func ErrRangeNotSatisfiable added in v0.0.20

func ErrRangeNotSatisfiable(msg string) *OCIError

ErrRangeNotSatisfiable is returned when a requested byte range cannot be satisfied.

func ErrReferrersUnknown added in v0.0.20

func ErrReferrersUnknown(digest string) *OCIError

ErrReferrersUnknown is an error for if there are no referrers for a given digest

func ErrServerError added in v0.0.20

func ErrServerError() *OCIError

ErrServerError is returned when an unexpected internal error occurs.

func ErrTooManyRequests added in v0.0.20

func ErrTooManyRequests() *OCIError

ErrTooManyRequests is an error if too many requests have been sent

func ErrUnauthorized added in v0.0.20

func ErrUnauthorized() *OCIError

ErrUnauthorized is a generic error for if a request is unauthorized

func (*OCIError) Error added in v0.0.20

func (e *OCIError) Error() string

Error implements the error interface

func (*OCIError) Status added in v0.0.20

func (e *OCIError) Status() int

Status returns the http status code associated with the error

type Redirecter added in v0.0.20

type Redirecter interface {
	// Redirect returns whether the request should redirect, the redirect URL, and
	// any error encountered while deciding.
	Redirect(r *http.Request, desc oci.Descriptor, repo string) (bool, string, error)
}

Redirecter provides storage-backed URL generation for blob redirects.

type Server added in v0.0.20

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

Server contains everything necessary to run the API portion of the service

func New

func New(pers oci.Interface, cfg0 *ServerConfig) (*Server, error)

New returns a new server backed by pers. A nil cfg is equivalent to a pointer to a zero ServerConfig. The configuration is copied before New returns and may be modified by the caller afterward.

func (*Server) Mux added in v0.0.20

func (s *Server) Mux() *mux.Mux

Mux returns the server's root router. Callers may use it to add routes outside the built-in /v2 namespace, which is owned by a mounted child router. Root middleware must be configured through ServerConfig.Middlewares because the router does not allow middleware to be added after routes are registered.

func (*Server) ServeHTTP added in v0.0.20

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

type ServerConfig added in v0.0.20

type ServerConfig struct {
	// Logger receives diagnostics for unexpected internal failures. A nil
	// Logger disables logging.
	Logger *slog.Logger

	// Middlewares are applied to all routes on the server's root mux, including
	// routes added through [Server.Mux]. They are applied in the order provided;
	// the first middleware is the outermost middleware.
	Middlewares []func(http.Handler) http.Handler

	// AuthMiddleware, when non-nil, is applied only to the built-in OCI routes.
	AuthMiddleware func(http.Handler) http.Handler
}

ServerConfig configures a Server.

Directories

Path Synopsis
Package mux routes HTTP requests using path templates compiled to Go regular expressions.
Package mux routes HTTP requests using path templates compiled to Go regular expressions.

Jump to

Keyboard shortcuts

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