diff --git a/layer.go b/layer.go index 129a5f76..dedc0538 100644 --- a/layer.go +++ b/layer.go @@ -17,9 +17,6 @@ type Layer interface { io.ReadSeeker io.Closer - // Name returns the repository under which this layer is linked. - Name() string // TODO(stevvooe): struggling with nomenclature: should this be "repo" or "name"? - // Digest returns the unique digest of the blob, which is the tarsum for // layers. Digest() digest.Digest @@ -36,9 +33,6 @@ type LayerUpload interface { io.ReaderFrom io.Closer - // Name of the repository under which the layer will be linked. - Name() string - // UUID returns the identifier for this upload. UUID() string diff --git a/registry/handlers/layerupload.go b/registry/handlers/layerupload.go index fa854449..63a9e776 100644 --- a/registry/handlers/layerupload.go +++ b/registry/handlers/layerupload.go @@ -215,7 +215,7 @@ func (luh *layerUploadHandler) PutLayerUploadComplete(w http.ResponseWriter, r * } // Build our canonical layer url - layerURL, err := luh.urlBuilder.BuildBlobURL(layer.Name(), layer.Digest()) + layerURL, err := luh.urlBuilder.BuildBlobURL(luh.Repository.Name(), layer.Digest()) if err != nil { luh.Errors.Push(v2.ErrorCodeUnknown, err) w.WriteHeader(http.StatusInternalServerError) @@ -268,7 +268,7 @@ func (luh *layerUploadHandler) layerUploadResponse(w http.ResponseWriter, r *htt } uploadURL, err := luh.urlBuilder.BuildBlobUploadChunkURL( - luh.Upload.Name(), luh.Upload.UUID(), + luh.Repository.Name(), luh.Upload.UUID(), url.Values{ "_state": []string{token}, }) diff --git a/registry/storage/layerreader.go b/registry/storage/layerreader.go index c539b769..2d8e588d 100644 --- a/registry/storage/layerreader.go +++ b/registry/storage/layerreader.go @@ -12,16 +12,11 @@ import ( type layerReader struct { fileReader - name string // repo name of this layer digest digest.Digest } var _ distribution.Layer = &layerReader{} -func (lrs *layerReader) Name() string { - return lrs.name -} - func (lrs *layerReader) Digest() digest.Digest { return lrs.digest } diff --git a/registry/storage/layerstore.go b/registry/storage/layerstore.go index 1769eb43..153e42a8 100644 --- a/registry/storage/layerstore.go +++ b/registry/storage/layerstore.go @@ -48,7 +48,6 @@ func (ls *layerStore) Fetch(dgst digest.Digest) (distribution.Layer, error) { return &layerReader{ fileReader: *fr, - name: ls.repository.Name(), digest: dgst, }, nil } diff --git a/registry/storage/layerupload.go b/registry/storage/layerupload.go index fe3a0721..369a9bd5 100644 --- a/registry/storage/layerupload.go +++ b/registry/storage/layerupload.go @@ -27,11 +27,6 @@ type layerUploadController struct { var _ distribution.LayerUpload = &layerUploadController{} -// Name of the repository under which the layer will be linked. -func (luc *layerUploadController) Name() string { - return luc.layerStore.repository.Name() -} - // UUID returns the identifier for this upload. func (luc *layerUploadController) UUID() string { return luc.uuid @@ -194,7 +189,7 @@ func (luc *layerUploadController) moveLayer(dgst digest.Digest) error { // named repository for the upload controller. func (luc *layerUploadController) linkLayer(digest digest.Digest) error { layerLinkPath, err := luc.layerStore.repository.registry.pm.path(layerLinkPathSpec{ - name: luc.Name(), + name: luc.layerStore.repository.Name(), digest: digest, }) @@ -210,7 +205,7 @@ func (luc *layerUploadController) linkLayer(digest digest.Digest) error { // resources are already not present, no error will be returned. func (luc *layerUploadController) removeResources() error { dataPath, err := luc.layerStore.repository.registry.pm.path(uploadDataPathSpec{ - name: luc.Name(), + name: luc.layerStore.repository.Name(), uuid: luc.uuid, })