Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pkg/registry/blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type BlobHandler interface {
// backend that can serve metadata about blobs.
type BlobStatHandler interface {
// Stat returns the size of the blob, or errNotFound if the blob wasn't
// found, or redirectError if the blob can be found elsewhere.
// found, or RedirectError if the blob can be found elsewhere.
Stat(ctx context.Context, repo string, h v1.Hash) (int64, error)
}

Expand All @@ -82,10 +82,10 @@ type BlobDeleteHandler interface {
Delete(ctx context.Context, repo string, h v1.Hash) error
}

// redirectError represents a signal that the blob handler doesn't have the blob
// RedirectError represents a signal that the blob handler doesn't have the blob
// contents, but that those contents are at another location which registry
// clients should redirect to.
type redirectError struct {
type RedirectError struct {
// Location is the location to find the contents.
Location string

Expand All @@ -101,7 +101,7 @@ func (r *bytesCloser) Close() error {
return nil
}

func (e redirectError) Error() string { return fmt.Sprintf("redirecting (%d): %s", e.Code, e.Location) }
func (e RedirectError) Error() string { return fmt.Sprintf("redirecting (%d): %s", e.Code, e.Location) }

// errNotFound represents an error locating the blob.
var errNotFound = errors.New("not found")
Expand Down Expand Up @@ -209,7 +209,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
if errors.Is(err, errNotFound) {
return regErrBlobUnknown
} else if err != nil {
var rerr redirectError
var rerr RedirectError
if errors.As(err, &rerr) {
http.Redirect(resp, req, rerr.Location, rerr.Code)
return nil
Expand All @@ -221,7 +221,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
if errors.Is(err, errNotFound) {
return regErrBlobUnknown
} else if err != nil {
var rerr redirectError
var rerr RedirectError
if errors.As(err, &rerr) {
http.Redirect(resp, req, rerr.Location, rerr.Code)
return nil
Expand Down Expand Up @@ -257,7 +257,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
if errors.Is(err, errNotFound) {
return regErrBlobUnknown
} else if err != nil {
var rerr redirectError
var rerr RedirectError
if errors.As(err, &rerr) {
http.Redirect(resp, req, rerr.Location, rerr.Code)
return nil
Expand All @@ -269,7 +269,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
if errors.Is(err, errNotFound) {
return regErrBlobUnknown
} else if err != nil {
var rerr redirectError
var rerr RedirectError
if errors.As(err, &rerr) {
http.Redirect(resp, req, rerr.Location, rerr.Code)
return nil
Expand All @@ -286,7 +286,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
if errors.Is(err, errNotFound) {
return regErrBlobUnknown
} else if err != nil {
var rerr redirectError
var rerr RedirectError
if errors.As(err, &rerr) {
http.Redirect(resp, req, rerr.Location, rerr.Code)
return nil
Expand Down