From ede79c176bb257de19df2dc0b89cc27ae057c6f7 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Tue, 6 Jun 2023 12:13:43 +0200 Subject: [PATCH] storage: use the TOC digest for partial layers Signed-off-by: Giuseppe Scrivano --- storage/storage_dest.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/storage/storage_dest.go b/storage/storage_dest.go index 73f442aeed..203ec549f0 100644 --- a/storage/storage_dest.go +++ b/storage/storage_dest.go @@ -325,6 +325,14 @@ func (s *storageImageDestination) tryReusingBlobAsPending(digest digest.Digest, s.lock.Lock() defer s.lock.Unlock() + toc, err := chunked.GetTOCDigest(options.Annotations) + if err != nil { + return false, private.ReusedBlob{}, err + } + if toc != nil { + digest = *toc + } + if options.SrcRef != nil { // Check if we have the layer in the underlying additional layer store. aLayer, err := s.imageRef.transport.store.LookupAdditionalLayer(digest, options.SrcRef.String()) @@ -558,7 +566,10 @@ func (s *storageImageDestination) getDiffIDFromDigest(uncompressedDigest digest. s.lock.Lock() defer s.lock.Unlock() - d, found := s.diffOutputs[uncompressedDigest]; found { + if d, found := s.diffOutputs[uncompressedDigest]; found { + return d.TOCDigest, found + } + d, found := s.blobDiffIDs[uncompressedDigest] return d, found }