add pathspec for repo _layers directory

Signed-off-by: Guillaume Rose <guillaume.rose@docker.com>
This commit is contained in:
Manish Tomar 2018-11-01 18:24:16 -07:00 committed by Guillaume Rose
parent dee21c0394
commit cf77113795

View file

@ -87,6 +87,7 @@ const (
// Blobs: // Blobs:
// //
// layerLinkPathSpec: <root>/v2/repositories/<name>/_layers/<algorithm>/<hex digest>/link // layerLinkPathSpec: <root>/v2/repositories/<name>/_layers/<algorithm>/<hex digest>/link
// layersPathSpec: <root>/v2/repositories/<name>/_layers
// //
// Uploads: // Uploads:
// //
@ -206,6 +207,8 @@ func pathFor(spec pathSpec) (string, error) {
blobLinkPathComponents := append(repoPrefix, v.name, "_layers") blobLinkPathComponents := append(repoPrefix, v.name, "_layers")
return path.Join(path.Join(append(blobLinkPathComponents, components...)...), "link"), nil return path.Join(path.Join(append(blobLinkPathComponents, components...)...), "link"), nil
case layersPathSpec:
return append(repoPrefix, v.repo, "_layers")
case blobsPathSpec: case blobsPathSpec:
blobsPathPrefix := append(rootPrefix, "blobs") blobsPathPrefix := append(rootPrefix, "blobs")
return path.Join(blobsPathPrefix...), nil return path.Join(blobsPathPrefix...), nil
@ -335,6 +338,13 @@ type manifestTagIndexEntryLinkPathSpec struct {
func (manifestTagIndexEntryLinkPathSpec) pathSpec() {} func (manifestTagIndexEntryLinkPathSpec) pathSpec() {}
// layersPathSpec contains the path for the layers inside a repo
type layersPathSpec struct {
repo string
}
func (layersPathSpec) pathSpec() {}
// blobLinkPathSpec specifies a path for a blob link, which is a file with a // blobLinkPathSpec specifies a path for a blob link, which is a file with a
// blob id. The blob link will contain a content addressable blob id reference // blob id. The blob link will contain a content addressable blob id reference
// into the blob store. The format of the contents is as follows: // into the blob store. The format of the contents is as follows: