github.com/moby/docker@v26.1.3+incompatible/daemon/containerd/platform_matchers.go (about) 1 package containerd 2 3 import ( 4 "github.com/containerd/containerd/platforms" 5 ocispec "github.com/opencontainers/image-spec/specs-go/v1" 6 ) 7 8 type allPlatformsWithPreferenceMatcher struct { 9 preferred platforms.MatchComparer 10 } 11 12 // matchAllWithPreference will return a platform matcher that matches all 13 // platforms but will order platforms matching the preferred matcher first. 14 func matchAllWithPreference(preferred platforms.MatchComparer) platforms.MatchComparer { 15 return allPlatformsWithPreferenceMatcher{ 16 preferred: preferred, 17 } 18 } 19 20 func (c allPlatformsWithPreferenceMatcher) Match(_ ocispec.Platform) bool { 21 return true 22 } 23 24 func (c allPlatformsWithPreferenceMatcher) Less(p1, p2 ocispec.Platform) bool { 25 return c.preferred.Less(p1, p2) 26 }