github.com/xdlianrong208/docker-ce-comments@v17.12.1-ce-rc2+incompatible/components/engine/distribution/pull_v2_unix.go (about)

     1  // +build !windows
     2  
     3  package distribution
     4  
     5  import (
     6  	"runtime"
     7  
     8  	"github.com/docker/distribution"
     9  	"github.com/docker/distribution/context"
    10  	"github.com/docker/distribution/manifest/manifestlist"
    11  	"github.com/sirupsen/logrus"
    12  )
    13  
    14  func (ld *v2LayerDescriptor) open(ctx context.Context) (distribution.ReadSeekCloser, error) {
    15  	blobs := ld.repo.Blobs(ctx)
    16  	return blobs.Open(ctx, ld.digest)
    17  }
    18  
    19  func filterManifests(manifests []manifestlist.ManifestDescriptor, os string) []manifestlist.ManifestDescriptor {
    20  	var matches []manifestlist.ManifestDescriptor
    21  	for _, manifestDescriptor := range manifests {
    22  		if manifestDescriptor.Platform.Architecture == runtime.GOARCH && manifestDescriptor.Platform.OS == os {
    23  			matches = append(matches, manifestDescriptor)
    24  
    25  			logrus.Debugf("found match for %s/%s with media type %s, digest %s", os, runtime.GOARCH, manifestDescriptor.MediaType, manifestDescriptor.Digest.String())
    26  		}
    27  	}
    28  	return matches
    29  }