diff --git a/registry/storage/manifestlisthandler.go b/registry/storage/manifestlisthandler.go index 42027d13..e24062cd 100644 --- a/registry/storage/manifestlisthandler.go +++ b/registry/storage/manifestlisthandler.go @@ -12,8 +12,8 @@ import ( // manifestListHandler is a ManifestHandler that covers schema2 manifest lists. type manifestListHandler struct { - repository *repository - blobStore *linkedBlobStore + repository distribution.Repository + blobStore distribution.BlobStore ctx context.Context } @@ -53,11 +53,6 @@ func (ms *manifestListHandler) Put(ctx context.Context, manifestList distributio return "", err } - // Link the revision into the repository. - if err := ms.blobStore.linkBlob(ctx, revision); err != nil { - return "", err - } - return revision.Digest, nil } @@ -72,6 +67,7 @@ func (ms *manifestListHandler) verifyManifest(ctx context.Context, mnfst manifes // This manifest service is different from the blob service // returned by Blob. It uses a linked blob store to ensure that // only manifests are accessible. + manifestService, err := ms.repository.Manifests(ctx) if err != nil { return err diff --git a/registry/storage/registry.go b/registry/storage/registry.go index 94034b26..bc3ee9c9 100644 --- a/registry/storage/registry.go +++ b/registry/storage/registry.go @@ -217,9 +217,10 @@ func (repo *repository) Manifests(ctx context.Context, options ...distribution.M repository: repo, blobStore: blobStore, schema1Handler: &signedManifestHandler{ - ctx: ctx, - repository: repo, - blobStore: blobStore, + ctx: ctx, + schema1SigningKey: repo.schema1SigningKey, + repository: repo, + blobStore: blobStore, }, schema2Handler: &schema2ManifestHandler{ ctx: ctx, diff --git a/registry/storage/schema2manifesthandler.go b/registry/storage/schema2manifesthandler.go index fc7cc6eb..d8b70dee 100644 --- a/registry/storage/schema2manifesthandler.go +++ b/registry/storage/schema2manifesthandler.go @@ -21,8 +21,8 @@ var ( //schema2ManifestHandler is a ManifestHandler that covers schema2 manifests. type schema2ManifestHandler struct { - repository *repository - blobStore *linkedBlobStore + repository distribution.Repository + blobStore distribution.BlobStore ctx context.Context } @@ -62,11 +62,6 @@ func (ms *schema2ManifestHandler) Put(ctx context.Context, manifest distribution return "", err } - // Link the revision into the repository. - if err := ms.blobStore.linkBlob(ctx, revision); err != nil { - return "", err - } - return revision.Digest, nil } diff --git a/registry/storage/signedmanifesthandler.go b/registry/storage/signedmanifesthandler.go index df6369f3..30d33082 100644 --- a/registry/storage/signedmanifesthandler.go +++ b/registry/storage/signedmanifesthandler.go @@ -15,9 +15,10 @@ import ( // signedManifestHandler is a ManifestHandler that covers schema1 manifests. It // can unmarshal and put schema1 manifests that have been signed by libtrust. type signedManifestHandler struct { - repository *repository - blobStore *linkedBlobStore - ctx context.Context + repository distribution.Repository + schema1SigningKey libtrust.PrivateKey + blobStore distribution.BlobStore + ctx context.Context } var _ ManifestHandler = &signedManifestHandler{} @@ -35,8 +36,8 @@ func (ms *signedManifestHandler) Unmarshal(ctx context.Context, dgst digest.Dige return nil, err } - if ms.repository.schema1SigningKey != nil { - if err := jsig.Sign(ms.repository.schema1SigningKey); err != nil { + if ms.schema1SigningKey != nil { + if err := jsig.Sign(ms.schema1SigningKey); err != nil { return nil, err } } @@ -75,11 +76,6 @@ func (ms *signedManifestHandler) Put(ctx context.Context, manifest distribution. return "", err } - // Link the revision into the repository. - if err := ms.blobStore.linkBlob(ctx, revision); err != nil { - return "", err - } - return revision.Digest, nil }