Skip to content

Commit

Permalink
storage: use the TOC digest for partial layers
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information
giuseppe committed Jul 24, 2023
1 parent 7c7d381 commit 35b3f83
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion storage/storage_dest.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,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())
Expand Down Expand Up @@ -564,7 +572,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
}

Expand Down

0 comments on commit 35b3f83

Please sign in to comment.