Rename Name method of Repository to Named
This makes code that gets the name as a string read like repo.Named().Name() instead of repo.Name().Name(). Requested in https://github.com/docker/docker/pull/19887#discussion_r51479753 Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
f2164294f7
commit
b0989446eb
@ -78,7 +78,7 @@ type manifestServiceListener struct {
|
|||||||
func (msl *manifestServiceListener) Get(ctx context.Context, dgst digest.Digest, options ...distribution.ManifestServiceOption) (distribution.Manifest, error) {
|
func (msl *manifestServiceListener) Get(ctx context.Context, dgst digest.Digest, options ...distribution.ManifestServiceOption) (distribution.Manifest, error) {
|
||||||
sm, err := msl.ManifestService.Get(ctx, dgst)
|
sm, err := msl.ManifestService.Get(ctx, dgst)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if err := msl.parent.listener.ManifestPulled(msl.parent.Repository.Name(), sm); err != nil {
|
if err := msl.parent.listener.ManifestPulled(msl.parent.Repository.Named(), sm); err != nil {
|
||||||
logrus.Errorf("error dispatching manifest pull to listener: %v", err)
|
logrus.Errorf("error dispatching manifest pull to listener: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ func (msl *manifestServiceListener) Put(ctx context.Context, sm distribution.Man
|
|||||||
dgst, err := msl.ManifestService.Put(ctx, sm, options...)
|
dgst, err := msl.ManifestService.Put(ctx, sm, options...)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if err := msl.parent.listener.ManifestPushed(msl.parent.Repository.Name(), sm); err != nil {
|
if err := msl.parent.listener.ManifestPushed(msl.parent.Repository.Named(), sm); err != nil {
|
||||||
logrus.Errorf("error dispatching manifest push to listener: %v", err)
|
logrus.Errorf("error dispatching manifest push to listener: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ func (bsl *blobServiceListener) Get(ctx context.Context, dgst digest.Digest) ([]
|
|||||||
if desc, err := bsl.Stat(ctx, dgst); err != nil {
|
if desc, err := bsl.Stat(ctx, dgst); err != nil {
|
||||||
context.GetLogger(ctx).Errorf("error resolving descriptor in ServeBlob listener: %v", err)
|
context.GetLogger(ctx).Errorf("error resolving descriptor in ServeBlob listener: %v", err)
|
||||||
} else {
|
} else {
|
||||||
if err := bsl.parent.listener.BlobPulled(bsl.parent.Repository.Name(), desc); err != nil {
|
if err := bsl.parent.listener.BlobPulled(bsl.parent.Repository.Named(), desc); err != nil {
|
||||||
context.GetLogger(ctx).Errorf("error dispatching layer pull to listener: %v", err)
|
context.GetLogger(ctx).Errorf("error dispatching layer pull to listener: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ func (bsl *blobServiceListener) Open(ctx context.Context, dgst digest.Digest) (d
|
|||||||
if desc, err := bsl.Stat(ctx, dgst); err != nil {
|
if desc, err := bsl.Stat(ctx, dgst); err != nil {
|
||||||
context.GetLogger(ctx).Errorf("error resolving descriptor in ServeBlob listener: %v", err)
|
context.GetLogger(ctx).Errorf("error resolving descriptor in ServeBlob listener: %v", err)
|
||||||
} else {
|
} else {
|
||||||
if err := bsl.parent.listener.BlobPulled(bsl.parent.Repository.Name(), desc); err != nil {
|
if err := bsl.parent.listener.BlobPulled(bsl.parent.Repository.Named(), desc); err != nil {
|
||||||
context.GetLogger(ctx).Errorf("error dispatching layer pull to listener: %v", err)
|
context.GetLogger(ctx).Errorf("error dispatching layer pull to listener: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ func (bsl *blobServiceListener) ServeBlob(ctx context.Context, w http.ResponseWr
|
|||||||
if desc, err := bsl.Stat(ctx, dgst); err != nil {
|
if desc, err := bsl.Stat(ctx, dgst); err != nil {
|
||||||
context.GetLogger(ctx).Errorf("error resolving descriptor in ServeBlob listener: %v", err)
|
context.GetLogger(ctx).Errorf("error resolving descriptor in ServeBlob listener: %v", err)
|
||||||
} else {
|
} else {
|
||||||
if err := bsl.parent.listener.BlobPulled(bsl.parent.Repository.Name(), desc); err != nil {
|
if err := bsl.parent.listener.BlobPulled(bsl.parent.Repository.Named(), desc); err != nil {
|
||||||
context.GetLogger(ctx).Errorf("error dispatching layer pull to listener: %v", err)
|
context.GetLogger(ctx).Errorf("error dispatching layer pull to listener: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ func (bsl *blobServiceListener) ServeBlob(ctx context.Context, w http.ResponseWr
|
|||||||
func (bsl *blobServiceListener) Put(ctx context.Context, mediaType string, p []byte) (distribution.Descriptor, error) {
|
func (bsl *blobServiceListener) Put(ctx context.Context, mediaType string, p []byte) (distribution.Descriptor, error) {
|
||||||
desc, err := bsl.BlobStore.Put(ctx, mediaType, p)
|
desc, err := bsl.BlobStore.Put(ctx, mediaType, p)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if err := bsl.parent.listener.BlobPushed(bsl.parent.Repository.Name(), desc); err != nil {
|
if err := bsl.parent.listener.BlobPushed(bsl.parent.Repository.Named(), desc); err != nil {
|
||||||
context.GetLogger(ctx).Errorf("error dispatching layer pull to listener: %v", err)
|
context.GetLogger(ctx).Errorf("error dispatching layer pull to listener: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ func (bsl *blobServiceListener) Create(ctx context.Context, options ...distribut
|
|||||||
wr, err := bsl.BlobStore.Create(ctx, options...)
|
wr, err := bsl.BlobStore.Create(ctx, options...)
|
||||||
switch err := err.(type) {
|
switch err := err.(type) {
|
||||||
case distribution.ErrBlobMounted:
|
case distribution.ErrBlobMounted:
|
||||||
if err := bsl.parent.listener.BlobMounted(bsl.parent.Repository.Name(), err.Descriptor, err.From); err != nil {
|
if err := bsl.parent.listener.BlobMounted(bsl.parent.Repository.Named(), err.Descriptor, err.From); err != nil {
|
||||||
context.GetLogger(ctx).Errorf("error dispatching blob mount to listener: %v", err)
|
context.GetLogger(ctx).Errorf("error dispatching blob mount to listener: %v", err)
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -193,7 +193,7 @@ type blobWriterListener struct {
|
|||||||
func (bwl *blobWriterListener) Commit(ctx context.Context, desc distribution.Descriptor) (distribution.Descriptor, error) {
|
func (bwl *blobWriterListener) Commit(ctx context.Context, desc distribution.Descriptor) (distribution.Descriptor, error) {
|
||||||
committed, err := bwl.BlobWriter.Commit(ctx, desc)
|
committed, err := bwl.BlobWriter.Commit(ctx, desc)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if err := bwl.parent.parent.listener.BlobPushed(bwl.parent.parent.Repository.Name(), committed); err != nil {
|
if err := bwl.parent.parent.listener.BlobPushed(bwl.parent.parent.Repository.Named(), committed); err != nil {
|
||||||
context.GetLogger(ctx).Errorf("error dispatching blob push to listener: %v", err)
|
context.GetLogger(ctx).Errorf("error dispatching blob push to listener: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ func checkExerciseRepository(t *testing.T, repository distribution.Repository) {
|
|||||||
Versioned: manifest.Versioned{
|
Versioned: manifest.Versioned{
|
||||||
SchemaVersion: 1,
|
SchemaVersion: 1,
|
||||||
},
|
},
|
||||||
Name: repository.Name().Name(),
|
Name: repository.Named().Name(),
|
||||||
Tag: tag,
|
Tag: tag,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ type ManifestServiceOption interface {
|
|||||||
|
|
||||||
// Repository is a named collection of manifests and layers.
|
// Repository is a named collection of manifests and layers.
|
||||||
type Repository interface {
|
type Repository interface {
|
||||||
// Name returns the name of the repository.
|
// Named returns the name of the repository.
|
||||||
Name() reference.Named
|
Named() reference.Named
|
||||||
|
|
||||||
// Manifests returns a reference to this repository's manifest service.
|
// Manifests returns a reference to this repository's manifest service.
|
||||||
// with the supplied options applied.
|
// with the supplied options applied.
|
||||||
|
@ -146,7 +146,7 @@ type repository struct {
|
|||||||
name reference.Named
|
name reference.Named
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repository) Name() reference.Named {
|
func (r *repository) Named() reference.Named {
|
||||||
return r.name
|
return r.name
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ func (r *repository) Tags(ctx context.Context) distribution.TagService {
|
|||||||
client: r.client,
|
client: r.client,
|
||||||
ub: r.ub,
|
ub: r.ub,
|
||||||
context: r.context,
|
context: r.context,
|
||||||
name: r.Name(),
|
name: r.Named(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ func TestAppDispatcher(t *testing.T) {
|
|||||||
varCheckingDispatcher := func(expectedVars map[string]string) dispatchFunc {
|
varCheckingDispatcher := func(expectedVars map[string]string) dispatchFunc {
|
||||||
return func(ctx *Context, r *http.Request) http.Handler {
|
return func(ctx *Context, r *http.Request) http.Handler {
|
||||||
// Always checks the same name context
|
// Always checks the same name context
|
||||||
if ctx.Repository.Name().Name() != getName(ctx) {
|
if ctx.Repository.Named().Name() != getName(ctx) {
|
||||||
t.Fatalf("unexpected name: %q != %q", ctx.Repository.Name(), "foo/bar")
|
t.Fatalf("unexpected name: %q != %q", ctx.Repository.Named().Name(), "foo/bar")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that we have all that is expected
|
// Check that we have all that is expected
|
||||||
|
@ -46,9 +46,9 @@ func blobUploadDispatcher(ctx *Context, r *http.Request) http.Handler {
|
|||||||
}
|
}
|
||||||
buh.State = state
|
buh.State = state
|
||||||
|
|
||||||
if state.Name != ctx.Repository.Name().Name() {
|
if state.Name != ctx.Repository.Named().Name() {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
ctxu.GetLogger(ctx).Infof("mismatched repository name in upload state: %q != %q", state.Name, buh.Repository.Name())
|
ctxu.GetLogger(ctx).Infof("mismatched repository name in upload state: %q != %q", state.Name, buh.Repository.Named().Name())
|
||||||
buh.Errors = append(buh.Errors, v2.ErrorCodeBlobUploadInvalid.WithDetail(err))
|
buh.Errors = append(buh.Errors, v2.ErrorCodeBlobUploadInvalid.WithDetail(err))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -312,7 +312,7 @@ func (buh *blobUploadHandler) blobUploadResponse(w http.ResponseWriter, r *http.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO(stevvooe): Need a better way to manage the upload state automatically.
|
// TODO(stevvooe): Need a better way to manage the upload state automatically.
|
||||||
buh.State.Name = buh.Repository.Name().Name()
|
buh.State.Name = buh.Repository.Named().Name()
|
||||||
buh.State.UUID = buh.Upload.ID()
|
buh.State.UUID = buh.Upload.ID()
|
||||||
buh.State.Offset = offset
|
buh.State.Offset = offset
|
||||||
buh.State.StartedAt = buh.Upload.StartedAt()
|
buh.State.StartedAt = buh.Upload.StartedAt()
|
||||||
@ -324,7 +324,7 @@ func (buh *blobUploadHandler) blobUploadResponse(w http.ResponseWriter, r *http.
|
|||||||
}
|
}
|
||||||
|
|
||||||
uploadURL, err := buh.urlBuilder.BuildBlobUploadChunkURL(
|
uploadURL, err := buh.urlBuilder.BuildBlobUploadChunkURL(
|
||||||
buh.Repository.Name(), buh.Upload.ID(),
|
buh.Repository.Named(), buh.Upload.ID(),
|
||||||
url.Values{
|
url.Values{
|
||||||
"_state": []string{token},
|
"_state": []string{token},
|
||||||
})
|
})
|
||||||
@ -372,7 +372,7 @@ func (buh *blobUploadHandler) createBlobMountOption(fromRepo, mountDigest string
|
|||||||
// created blob. A 201 Created is written as well as the canonical URL and
|
// created blob. A 201 Created is written as well as the canonical URL and
|
||||||
// blob digest.
|
// blob digest.
|
||||||
func (buh *blobUploadHandler) writeBlobCreatedHeaders(w http.ResponseWriter, desc distribution.Descriptor) error {
|
func (buh *blobUploadHandler) writeBlobCreatedHeaders(w http.ResponseWriter, desc distribution.Descriptor) error {
|
||||||
ref, err := reference.WithDigest(buh.Repository.Name(), desc.Digest)
|
ref, err := reference.WithDigest(buh.Repository.Named(), desc.Digest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -174,10 +174,10 @@ func (imh *imageManifestHandler) convertSchema2Manifest(schema2Manifest *schema2
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ref := imh.Repository.Name()
|
ref := imh.Repository.Named()
|
||||||
|
|
||||||
if imh.Tag != "" {
|
if imh.Tag != "" {
|
||||||
ref, err = reference.WithTag(imh.Repository.Name(), imh.Tag)
|
ref, err = reference.WithTag(ref, imh.Tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
imh.Errors = append(imh.Errors, v2.ErrorCodeTagInvalid.WithDetail(err))
|
imh.Errors = append(imh.Errors, v2.ErrorCodeTagInvalid.WithDetail(err))
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -289,7 +289,7 @@ func (imh *imageManifestHandler) PutImageManifest(w http.ResponseWriter, r *http
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct a canonical url for the uploaded manifest.
|
// Construct a canonical url for the uploaded manifest.
|
||||||
ref, err := reference.WithDigest(imh.Repository.Name(), imh.Digest)
|
ref, err := reference.WithDigest(imh.Repository.Named(), imh.Digest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
imh.Errors = append(imh.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
imh.Errors = append(imh.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
||||||
return
|
return
|
||||||
|
@ -40,7 +40,7 @@ func (th *tagsHandler) GetTags(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
switch err := err.(type) {
|
switch err := err.(type) {
|
||||||
case distribution.ErrRepositoryUnknown:
|
case distribution.ErrRepositoryUnknown:
|
||||||
th.Errors = append(th.Errors, v2.ErrorCodeNameUnknown.WithDetail(map[string]string{"name": th.Repository.Name().Name()}))
|
th.Errors = append(th.Errors, v2.ErrorCodeNameUnknown.WithDetail(map[string]string{"name": th.Repository.Named().Name()}))
|
||||||
default:
|
default:
|
||||||
th.Errors = append(th.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
th.Errors = append(th.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ func (th *tagsHandler) GetTags(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
enc := json.NewEncoder(w)
|
enc := json.NewEncoder(w)
|
||||||
if err := enc.Encode(tagsAPIResponse{
|
if err := enc.Encode(tagsAPIResponse{
|
||||||
Name: th.Repository.Name().Name(),
|
Name: th.Repository.Named().Name(),
|
||||||
Tags: tags,
|
Tags: tags,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
th.Errors = append(th.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
th.Errors = append(th.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
||||||
|
@ -179,7 +179,7 @@ func (pr *proxiedRepository) Blobs(ctx context.Context) distribution.BlobStore {
|
|||||||
return pr.blobStore
|
return pr.blobStore
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pr *proxiedRepository) Name() reference.Named {
|
func (pr *proxiedRepository) Named() reference.Named {
|
||||||
return pr.name
|
return pr.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ func TestBlobMount(t *testing.T) {
|
|||||||
t.Fatalf("unexpected non-error stating unmounted blob: %v", desc)
|
t.Fatalf("unexpected non-error stating unmounted blob: %v", desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
canonicalRef, err := reference.WithDigest(sourceRepository.Name(), desc.Digest)
|
canonicalRef, err := reference.WithDigest(sourceRepository.Named(), desc.Digest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ func (bw *blobWriter) moveBlob(ctx context.Context, desc distribution.Descriptor
|
|||||||
// resources are already not present, no error will be returned.
|
// resources are already not present, no error will be returned.
|
||||||
func (bw *blobWriter) removeResources(ctx context.Context) error {
|
func (bw *blobWriter) removeResources(ctx context.Context) error {
|
||||||
dataPath, err := pathFor(uploadDataPathSpec{
|
dataPath, err := pathFor(uploadDataPathSpec{
|
||||||
name: bw.blobStore.repository.Name().Name(),
|
name: bw.blobStore.repository.Named().Name(),
|
||||||
id: bw.id,
|
id: bw.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ type hashStateEntry struct {
|
|||||||
// getStoredHashStates returns a slice of hashStateEntries for this upload.
|
// getStoredHashStates returns a slice of hashStateEntries for this upload.
|
||||||
func (bw *blobWriter) getStoredHashStates(ctx context.Context) ([]hashStateEntry, error) {
|
func (bw *blobWriter) getStoredHashStates(ctx context.Context) ([]hashStateEntry, error) {
|
||||||
uploadHashStatePathPrefix, err := pathFor(uploadHashStatePathSpec{
|
uploadHashStatePathPrefix, err := pathFor(uploadHashStatePathSpec{
|
||||||
name: bw.blobStore.repository.Name().String(),
|
name: bw.blobStore.repository.Named().String(),
|
||||||
id: bw.id,
|
id: bw.id,
|
||||||
alg: bw.digester.Digest().Algorithm(),
|
alg: bw.digester.Digest().Algorithm(),
|
||||||
list: true,
|
list: true,
|
||||||
@ -159,7 +159,7 @@ func (bw *blobWriter) storeHashState(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uploadHashStatePath, err := pathFor(uploadHashStatePathSpec{
|
uploadHashStatePath, err := pathFor(uploadHashStatePathSpec{
|
||||||
name: bw.blobStore.repository.Name().String(),
|
name: bw.blobStore.repository.Named().String(),
|
||||||
id: bw.id,
|
id: bw.id,
|
||||||
alg: bw.digester.Digest().Algorithm(),
|
alg: bw.digester.Digest().Algorithm(),
|
||||||
offset: int64(h.Len()),
|
offset: int64(h.Len()),
|
||||||
|
@ -153,7 +153,7 @@ func (lbs *linkedBlobStore) Create(ctx context.Context, options ...distribution.
|
|||||||
startedAt := time.Now().UTC()
|
startedAt := time.Now().UTC()
|
||||||
|
|
||||||
path, err := pathFor(uploadDataPathSpec{
|
path, err := pathFor(uploadDataPathSpec{
|
||||||
name: lbs.repository.Name().Name(),
|
name: lbs.repository.Named().Name(),
|
||||||
id: uuid,
|
id: uuid,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ func (lbs *linkedBlobStore) Create(ctx context.Context, options ...distribution.
|
|||||||
}
|
}
|
||||||
|
|
||||||
startedAtPath, err := pathFor(uploadStartedAtPathSpec{
|
startedAtPath, err := pathFor(uploadStartedAtPathSpec{
|
||||||
name: lbs.repository.Name().Name(),
|
name: lbs.repository.Named().Name(),
|
||||||
id: uuid,
|
id: uuid,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ func (lbs *linkedBlobStore) Resume(ctx context.Context, id string) (distribution
|
|||||||
context.GetLogger(ctx).Debug("(*linkedBlobStore).Resume")
|
context.GetLogger(ctx).Debug("(*linkedBlobStore).Resume")
|
||||||
|
|
||||||
startedAtPath, err := pathFor(uploadStartedAtPathSpec{
|
startedAtPath, err := pathFor(uploadStartedAtPathSpec{
|
||||||
name: lbs.repository.Name().Name(),
|
name: lbs.repository.Named().Name(),
|
||||||
id: id,
|
id: id,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ func (lbs *linkedBlobStore) Resume(ctx context.Context, id string) (distribution
|
|||||||
}
|
}
|
||||||
|
|
||||||
path, err := pathFor(uploadDataPathSpec{
|
path, err := pathFor(uploadDataPathSpec{
|
||||||
name: lbs.repository.Name().Name(),
|
name: lbs.repository.Named().Name(),
|
||||||
id: id,
|
id: id,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ func (lbs *linkedBlobStore) linkBlob(ctx context.Context, canonical distribution
|
|||||||
}
|
}
|
||||||
seenDigests[dgst] = struct{}{}
|
seenDigests[dgst] = struct{}{}
|
||||||
|
|
||||||
blobLinkPath, err := linkPathFn(lbs.repository.Name().Name(), dgst)
|
blobLinkPath, err := linkPathFn(lbs.repository.Named().Name(), dgst)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ func (lbs *linkedBlobStatter) Stat(ctx context.Context, dgst digest.Digest) (dis
|
|||||||
func (lbs *linkedBlobStatter) Clear(ctx context.Context, dgst digest.Digest) (err error) {
|
func (lbs *linkedBlobStatter) Clear(ctx context.Context, dgst digest.Digest) (err error) {
|
||||||
// clear any possible existence of a link described in linkPathFns
|
// clear any possible existence of a link described in linkPathFns
|
||||||
for _, linkPathFn := range lbs.linkPathFns {
|
for _, linkPathFn := range lbs.linkPathFns {
|
||||||
blobLinkPath, err := linkPathFn(lbs.repository.Name().Name(), dgst)
|
blobLinkPath, err := linkPathFn(lbs.repository.Named().Name(), dgst)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -391,7 +391,7 @@ func (lbs *linkedBlobStatter) Clear(ctx context.Context, dgst digest.Digest) (er
|
|||||||
// linkPathFuncs to let us try a few different paths before returning not
|
// linkPathFuncs to let us try a few different paths before returning not
|
||||||
// found.
|
// found.
|
||||||
func (lbs *linkedBlobStatter) resolveWithLinkFunc(ctx context.Context, dgst digest.Digest, linkPathFn linkPathFunc) (digest.Digest, error) {
|
func (lbs *linkedBlobStatter) resolveWithLinkFunc(ctx context.Context, dgst digest.Digest, linkPathFn linkPathFunc) (digest.Digest, error) {
|
||||||
blobLinkPath, err := linkPathFn(lbs.repository.Name().Name(), dgst)
|
blobLinkPath, err := linkPathFn(lbs.repository.Named().Name(), dgst)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ func (ms *manifestStore) Get(ctx context.Context, dgst digest.Digest, options ..
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if err == distribution.ErrBlobUnknown {
|
if err == distribution.ErrBlobUnknown {
|
||||||
return nil, distribution.ErrManifestUnknownRevision{
|
return nil, distribution.ErrManifestUnknownRevision{
|
||||||
Name: ms.repository.Name().Name(),
|
Name: ms.repository.Named().Name(),
|
||||||
Revision: dgst,
|
Revision: dgst,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ type repository struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Name returns the name of the repository.
|
// Name returns the name of the repository.
|
||||||
func (repo *repository) Name() reference.Named {
|
func (repo *repository) Named() reference.Named {
|
||||||
return repo.name
|
return repo.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ type signatureStore struct {
|
|||||||
|
|
||||||
func (s *signatureStore) Get(dgst digest.Digest) ([][]byte, error) {
|
func (s *signatureStore) Get(dgst digest.Digest) ([][]byte, error) {
|
||||||
signaturesPath, err := pathFor(manifestSignaturesPathSpec{
|
signaturesPath, err := pathFor(manifestSignaturesPathSpec{
|
||||||
name: s.repository.Name().Name(),
|
name: s.repository.Named().Name(),
|
||||||
revision: dgst,
|
revision: dgst,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ func (ts *tagStore) All(ctx context.Context) ([]string, error) {
|
|||||||
var tags []string
|
var tags []string
|
||||||
|
|
||||||
pathSpec, err := pathFor(manifestTagPathSpec{
|
pathSpec, err := pathFor(manifestTagPathSpec{
|
||||||
name: ts.repository.Name().Name(),
|
name: ts.repository.Named().Name(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return tags, err
|
return tags, err
|
||||||
@ -36,7 +36,7 @@ func (ts *tagStore) All(ctx context.Context) ([]string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
switch err := err.(type) {
|
switch err := err.(type) {
|
||||||
case storagedriver.PathNotFoundError:
|
case storagedriver.PathNotFoundError:
|
||||||
return tags, distribution.ErrRepositoryUnknown{Name: ts.repository.Name().Name()}
|
return tags, distribution.ErrRepositoryUnknown{Name: ts.repository.Named().Name()}
|
||||||
default:
|
default:
|
||||||
return tags, err
|
return tags, err
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ func (ts *tagStore) All(ctx context.Context) ([]string, error) {
|
|||||||
// exists returns true if the specified manifest tag exists in the repository.
|
// exists returns true if the specified manifest tag exists in the repository.
|
||||||
func (ts *tagStore) exists(ctx context.Context, tag string) (bool, error) {
|
func (ts *tagStore) exists(ctx context.Context, tag string) (bool, error) {
|
||||||
tagPath, err := pathFor(manifestTagCurrentPathSpec{
|
tagPath, err := pathFor(manifestTagCurrentPathSpec{
|
||||||
name: ts.repository.Name().Name(),
|
name: ts.repository.Named().Name(),
|
||||||
tag: tag,
|
tag: tag,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ func (ts *tagStore) exists(ctx context.Context, tag string) (bool, error) {
|
|||||||
// the current tag. The digest must point to a manifest.
|
// the current tag. The digest must point to a manifest.
|
||||||
func (ts *tagStore) Tag(ctx context.Context, tag string, desc distribution.Descriptor) error {
|
func (ts *tagStore) Tag(ctx context.Context, tag string, desc distribution.Descriptor) error {
|
||||||
currentPath, err := pathFor(manifestTagCurrentPathSpec{
|
currentPath, err := pathFor(manifestTagCurrentPathSpec{
|
||||||
name: ts.repository.Name().Name(),
|
name: ts.repository.Named().Name(),
|
||||||
tag: tag,
|
tag: tag,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ func (ts *tagStore) Tag(ctx context.Context, tag string, desc distribution.Descr
|
|||||||
// resolve the current revision for name and tag.
|
// resolve the current revision for name and tag.
|
||||||
func (ts *tagStore) Get(ctx context.Context, tag string) (distribution.Descriptor, error) {
|
func (ts *tagStore) Get(ctx context.Context, tag string) (distribution.Descriptor, error) {
|
||||||
currentPath, err := pathFor(manifestTagCurrentPathSpec{
|
currentPath, err := pathFor(manifestTagCurrentPathSpec{
|
||||||
name: ts.repository.Name().Name(),
|
name: ts.repository.Named().Name(),
|
||||||
tag: tag,
|
tag: tag,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ func (ts *tagStore) Get(ctx context.Context, tag string) (distribution.Descripto
|
|||||||
// Untag removes the tag association
|
// Untag removes the tag association
|
||||||
func (ts *tagStore) Untag(ctx context.Context, tag string) error {
|
func (ts *tagStore) Untag(ctx context.Context, tag string) error {
|
||||||
tagPath, err := pathFor(manifestTagPathSpec{
|
tagPath, err := pathFor(manifestTagPathSpec{
|
||||||
name: ts.repository.Name().Name(),
|
name: ts.repository.Named().Name(),
|
||||||
tag: tag,
|
tag: tag,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ func (ts *tagStore) Lookup(ctx context.Context, desc distribution.Descriptor) ([
|
|||||||
var tags []string
|
var tags []string
|
||||||
for _, tag := range allTags {
|
for _, tag := range allTags {
|
||||||
tagLinkPathSpec := manifestTagCurrentPathSpec{
|
tagLinkPathSpec := manifestTagCurrentPathSpec{
|
||||||
name: ts.repository.Name().Name(),
|
name: ts.repository.Named().Name(),
|
||||||
tag: tag,
|
tag: tag,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user