MCPcopy Index your code
hub / github.com/containerd/containerd / isImageInArchive

Function isImageInArchive

integration/client/export_test.go:289–320  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, client *Client, dstFile *os.File, mfst ocispec.Descriptor)

Source from the content-addressed store, hash-verified

287}
288
289func isImageInArchive(ctx context.Context, t *testing.T, client *Client, dstFile *os.File, mfst ocispec.Descriptor) bool {
290 dstFile.Seek(0, 0)
291 tr := tar.NewReader(dstFile)
292
293 var blobs []string
294 for {
295 h, err := tr.Next()
296 if err != nil {
297 if err == io.EOF {
298 break
299 }
300 t.Fatal(err)
301 }
302
303 digest := strings.TrimPrefix(h.Name, "blobs/sha256/")
304 if digest != h.Name && digest != "" {
305 blobs = append(blobs, digest)
306 }
307 }
308
309 allPresent := true
310 // Check if the archive contains all blobs referenced by the manifest.
311 images.Walk(ctx, images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
312 if slices.Contains(blobs, desc.Digest.Hex()) {
313 return images.Children(ctx, client.ContentStore(), desc)
314 }
315 allPresent = false
316 return nil, images.ErrStopHandler
317 }), mfst)
318
319 return allPresent
320}
321
322func getPlatformManifest(ctx context.Context, cs content.Store, target ocispec.Descriptor, platform platforms.MatchComparer) (ocispec.Descriptor, error) {
323 mfst, err := images.LimitManifests(images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {

Callers 1

TestExportAllCasesFunction · 0.85

Calls 6

WalkFunction · 0.92
HandlerFuncFuncType · 0.92
ChildrenFunction · 0.92
SeekMethod · 0.80
FatalMethod · 0.80
ContentStoreMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…