@@ -51,14 +51,14 @@ func isBlob(req *http.Request) bool {
5151// BlobHandler represents a minimal blob storage backend, capable of serving
5252// blob contents.
5353type BlobHandler interface {
54- // Get gets the blob contents, or errNotFound if the blob wasn't found.
54+ // Get gets the blob contents, or ErrNotFound if the blob wasn't found.
5555 Get (ctx context.Context , repo string , h v1.Hash ) (io.ReadCloser , error )
5656}
5757
5858// BlobStatHandler is an extension interface representing a blob storage
5959// backend that can serve metadata about blobs.
6060type BlobStatHandler interface {
61- // Stat returns the size of the blob, or errNotFound if the blob wasn't
61+ // Stat returns the size of the blob, or ErrNotFound if the blob wasn't
6262 // found, or redirectError if the blob can be found elsewhere.
6363 Stat (ctx context.Context , repo string , h v1.Hash ) (int64 , error )
6464}
@@ -103,8 +103,8 @@ func (r *bytesCloser) Close() error {
103103
104104func (e redirectError ) Error () string { return fmt .Sprintf ("redirecting (%d): %s" , e .Code , e .Location ) }
105105
106- // errNotFound represents an error locating the blob.
107- var errNotFound = errors .New ("not found" )
106+ // ErrNotFound represents an error locating the blob.
107+ var ErrNotFound = errors .New ("not found" )
108108
109109type memHandler struct {
110110 m map [string ][]byte
@@ -119,7 +119,7 @@ func (m *memHandler) Stat(_ context.Context, _ string, h v1.Hash) (int64, error)
119119
120120 b , found := m .m [h .String ()]
121121 if ! found {
122- return 0 , errNotFound
122+ return 0 , ErrNotFound
123123 }
124124 return int64 (len (b )), nil
125125}
@@ -130,7 +130,7 @@ func (m *memHandler) Get(_ context.Context, _ string, h v1.Hash) (io.ReadCloser,
130130
131131 b , found := m .m [h .String ()]
132132 if ! found {
133- return nil , errNotFound
133+ return nil , ErrNotFound
134134 }
135135 return & bytesCloser {bytes .NewReader (b )}, nil
136136}
@@ -153,7 +153,7 @@ func (m *memHandler) Delete(_ context.Context, _ string, h v1.Hash) error {
153153 defer m .lock .Unlock ()
154154
155155 if _ , found := m .m [h .String ()]; ! found {
156- return errNotFound
156+ return ErrNotFound
157157 }
158158
159159 delete (m .m , h .String ())
@@ -206,7 +206,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
206206 var size int64
207207 if bsh , ok := b .blobHandler .(BlobStatHandler ); ok {
208208 size , err = bsh .Stat (req .Context (), repo , h )
209- if errors .Is (err , errNotFound ) {
209+ if errors .Is (err , ErrNotFound ) {
210210 return regErrBlobUnknown
211211 } else if err != nil {
212212 var rerr redirectError
@@ -218,7 +218,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
218218 }
219219 } else {
220220 rc , err := b .blobHandler .Get (req .Context (), repo , h )
221- if errors .Is (err , errNotFound ) {
221+ if errors .Is (err , ErrNotFound ) {
222222 return regErrBlobUnknown
223223 } else if err != nil {
224224 var rerr redirectError
@@ -254,7 +254,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
254254 var r io.Reader
255255 if bsh , ok := b .blobHandler .(BlobStatHandler ); ok {
256256 size , err = bsh .Stat (req .Context (), repo , h )
257- if errors .Is (err , errNotFound ) {
257+ if errors .Is (err , ErrNotFound ) {
258258 return regErrBlobUnknown
259259 } else if err != nil {
260260 var rerr redirectError
@@ -266,7 +266,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
266266 }
267267
268268 rc , err := b .blobHandler .Get (req .Context (), repo , h )
269- if errors .Is (err , errNotFound ) {
269+ if errors .Is (err , ErrNotFound ) {
270270 return regErrBlobUnknown
271271 } else if err != nil {
272272 var rerr redirectError
@@ -283,7 +283,7 @@ func (b *blobs) handle(resp http.ResponseWriter, req *http.Request) *regError {
283283
284284 } else {
285285 tmp , err := b .blobHandler .Get (req .Context (), repo , h )
286- if errors .Is (err , errNotFound ) {
286+ if errors .Is (err , ErrNotFound ) {
287287 return regErrBlobUnknown
288288 } else if err != nil {
289289 var rerr redirectError
0 commit comments