MCPcopy Create free account
hub / github.com/containers/image / tryReusingExactBlob

Method tryReusingExactBlob

docker/docker_image_dest.go:311–321  ·  view source on GitHub ↗

tryReusingExactBlob is a subset of TryReusingBlob which _only_ looks for exactly the specified blob in the current repository, with no cross-repo reuse or mounting; cache may be updated, it is not read. The caller must ensure info.Digest is set.

(ctx context.Context, info types.BlobInfo, cache blobinfocache.BlobInfoCache2)

Source from the content-addressed store, hash-verified

309// blob in the current repository, with no cross-repo reuse or mounting; cache may be updated, it is not read.
310// The caller must ensure info.Digest is set.
311func (d *dockerImageDestination) tryReusingExactBlob(ctx context.Context, info types.BlobInfo, cache blobinfocache.BlobInfoCache2) (bool, private.ReusedBlob, error) {
312 exists, size, err := d.blobExists(ctx, d.ref.ref, info.Digest, nil)
313 if err != nil {
314 return false, private.ReusedBlob{}, err
315 }
316 if exists {
317 cache.RecordKnownLocation(d.ref.Transport(), bicTransportScope(d.ref), info.Digest, newBICLocationReference(d.ref))
318 return true, private.ReusedBlob{Digest: info.Digest, Size: size}, nil
319 }
320 return false, private.ReusedBlob{}, nil
321}
322
323func optionalCompressionName(algo *compressiontypes.Algorithm) string {
324 if algo != nil {

Callers 2

PutBlobWithOptionsMethod · 0.95

Calls 5

blobExistsMethod · 0.95
bicTransportScopeFunction · 0.85
newBICLocationReferenceFunction · 0.85
RecordKnownLocationMethod · 0.65
TransportMethod · 0.65

Tested by

no test coverage detected