mirror of
https://github.com/containers/podman.git
synced 2025-06-23 10:38:20 +08:00
Merge pull request #2439 from vrothberg/vendor-image
vendor containers/image v1.5
This commit is contained in:
@ -15,7 +15,7 @@ github.com/containerd/cgroups 39b18af02c4120960f517a3a4c2588fabb61d02c
|
|||||||
github.com/containerd/continuity 004b46473808b3e7a4a3049c20e4376c91eb966d
|
github.com/containerd/continuity 004b46473808b3e7a4a3049c20e4376c91eb966d
|
||||||
github.com/containernetworking/cni v0.7.0-alpha1
|
github.com/containernetworking/cni v0.7.0-alpha1
|
||||||
github.com/containernetworking/plugins v0.7.4
|
github.com/containernetworking/plugins v0.7.4
|
||||||
github.com/containers/image v1.4
|
github.com/containers/image v1.5
|
||||||
github.com/vbauerster/mpb v3.3.4
|
github.com/vbauerster/mpb v3.3.4
|
||||||
github.com/mattn/go-isatty v0.0.4
|
github.com/mattn/go-isatty v0.0.4
|
||||||
github.com/VividCortex/ewma v1.1.1
|
github.com/VividCortex/ewma v1.1.1
|
||||||
|
20
vendor/github.com/containers/image/pkg/blobinfocache/memory.go
generated
vendored
20
vendor/github.com/containers/image/pkg/blobinfocache/memory.go
generated
vendored
@ -1,6 +1,7 @@
|
|||||||
package blobinfocache
|
package blobinfocache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
@ -17,6 +18,7 @@ type locationKey struct {
|
|||||||
|
|
||||||
// memoryCache implements an in-memory-only BlobInfoCache
|
// memoryCache implements an in-memory-only BlobInfoCache
|
||||||
type memoryCache struct {
|
type memoryCache struct {
|
||||||
|
mutex *sync.Mutex // synchronizes concurrent accesses
|
||||||
uncompressedDigests map[digest.Digest]digest.Digest
|
uncompressedDigests map[digest.Digest]digest.Digest
|
||||||
digestsByUncompressed map[digest.Digest]map[digest.Digest]struct{} // stores a set of digests for each uncompressed digest
|
digestsByUncompressed map[digest.Digest]map[digest.Digest]struct{} // stores a set of digests for each uncompressed digest
|
||||||
knownLocations map[locationKey]map[types.BICLocationReference]time.Time // stores last known existence time for each location reference
|
knownLocations map[locationKey]map[types.BICLocationReference]time.Time // stores last known existence time for each location reference
|
||||||
@ -28,6 +30,7 @@ type memoryCache struct {
|
|||||||
// Manual users of types.{ImageSource,ImageDestination} might also use this instead of a persistent cache.
|
// Manual users of types.{ImageSource,ImageDestination} might also use this instead of a persistent cache.
|
||||||
func NewMemoryCache() types.BlobInfoCache {
|
func NewMemoryCache() types.BlobInfoCache {
|
||||||
return &memoryCache{
|
return &memoryCache{
|
||||||
|
mutex: new(sync.Mutex),
|
||||||
uncompressedDigests: map[digest.Digest]digest.Digest{},
|
uncompressedDigests: map[digest.Digest]digest.Digest{},
|
||||||
digestsByUncompressed: map[digest.Digest]map[digest.Digest]struct{}{},
|
digestsByUncompressed: map[digest.Digest]map[digest.Digest]struct{}{},
|
||||||
knownLocations: map[locationKey]map[types.BICLocationReference]time.Time{},
|
knownLocations: map[locationKey]map[types.BICLocationReference]time.Time{},
|
||||||
@ -38,6 +41,15 @@ func NewMemoryCache() types.BlobInfoCache {
|
|||||||
// May return anyDigest if it is known to be uncompressed.
|
// May return anyDigest if it is known to be uncompressed.
|
||||||
// Returns "" if nothing is known about the digest (it may be compressed or uncompressed).
|
// Returns "" if nothing is known about the digest (it may be compressed or uncompressed).
|
||||||
func (mem *memoryCache) UncompressedDigest(anyDigest digest.Digest) digest.Digest {
|
func (mem *memoryCache) UncompressedDigest(anyDigest digest.Digest) digest.Digest {
|
||||||
|
mem.mutex.Lock()
|
||||||
|
defer mem.mutex.Unlock()
|
||||||
|
return mem.uncompressedDigest(anyDigest)
|
||||||
|
}
|
||||||
|
|
||||||
|
// uncompressedDigest returns an uncompressed digest corresponding to anyDigest.
|
||||||
|
// May return anyDigest if it is known to be uncompressed.
|
||||||
|
// Returns "" if nothing is known about the digest (it may be compressed or uncompressed).
|
||||||
|
func (mem *memoryCache) uncompressedDigest(anyDigest digest.Digest) digest.Digest {
|
||||||
if d, ok := mem.uncompressedDigests[anyDigest]; ok {
|
if d, ok := mem.uncompressedDigests[anyDigest]; ok {
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
@ -56,6 +68,8 @@ func (mem *memoryCache) UncompressedDigest(anyDigest digest.Digest) digest.Diges
|
|||||||
// because a manifest/config pair exists); otherwise the cache could be poisoned and allow substituting unexpected blobs.
|
// because a manifest/config pair exists); otherwise the cache could be poisoned and allow substituting unexpected blobs.
|
||||||
// (Eventually, the DiffIDs in image config could detect the substitution, but that may be too late, and not all image formats contain that data.)
|
// (Eventually, the DiffIDs in image config could detect the substitution, but that may be too late, and not all image formats contain that data.)
|
||||||
func (mem *memoryCache) RecordDigestUncompressedPair(anyDigest digest.Digest, uncompressed digest.Digest) {
|
func (mem *memoryCache) RecordDigestUncompressedPair(anyDigest digest.Digest, uncompressed digest.Digest) {
|
||||||
|
mem.mutex.Lock()
|
||||||
|
defer mem.mutex.Unlock()
|
||||||
if previous, ok := mem.uncompressedDigests[anyDigest]; ok && previous != uncompressed {
|
if previous, ok := mem.uncompressedDigests[anyDigest]; ok && previous != uncompressed {
|
||||||
logrus.Warnf("Uncompressed digest for blob %s previously recorded as %s, now %s", anyDigest, previous, uncompressed)
|
logrus.Warnf("Uncompressed digest for blob %s previously recorded as %s, now %s", anyDigest, previous, uncompressed)
|
||||||
}
|
}
|
||||||
@ -72,6 +86,8 @@ func (mem *memoryCache) RecordDigestUncompressedPair(anyDigest digest.Digest, un
|
|||||||
// RecordKnownLocation records that a blob with the specified digest exists within the specified (transport, scope) scope,
|
// RecordKnownLocation records that a blob with the specified digest exists within the specified (transport, scope) scope,
|
||||||
// and can be reused given the opaque location data.
|
// and can be reused given the opaque location data.
|
||||||
func (mem *memoryCache) RecordKnownLocation(transport types.ImageTransport, scope types.BICTransportScope, blobDigest digest.Digest, location types.BICLocationReference) {
|
func (mem *memoryCache) RecordKnownLocation(transport types.ImageTransport, scope types.BICTransportScope, blobDigest digest.Digest, location types.BICLocationReference) {
|
||||||
|
mem.mutex.Lock()
|
||||||
|
defer mem.mutex.Unlock()
|
||||||
key := locationKey{transport: transport.Name(), scope: scope, blobDigest: blobDigest}
|
key := locationKey{transport: transport.Name(), scope: scope, blobDigest: blobDigest}
|
||||||
locationScope, ok := mem.knownLocations[key]
|
locationScope, ok := mem.knownLocations[key]
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -103,11 +119,13 @@ func (mem *memoryCache) appendReplacementCandidates(candidates []candidateWithTi
|
|||||||
// data from previous RecordDigestUncompressedPair calls is used to also look up variants of the blob which have the same
|
// data from previous RecordDigestUncompressedPair calls is used to also look up variants of the blob which have the same
|
||||||
// uncompressed digest.
|
// uncompressed digest.
|
||||||
func (mem *memoryCache) CandidateLocations(transport types.ImageTransport, scope types.BICTransportScope, primaryDigest digest.Digest, canSubstitute bool) []types.BICReplacementCandidate {
|
func (mem *memoryCache) CandidateLocations(transport types.ImageTransport, scope types.BICTransportScope, primaryDigest digest.Digest, canSubstitute bool) []types.BICReplacementCandidate {
|
||||||
|
mem.mutex.Lock()
|
||||||
|
defer mem.mutex.Unlock()
|
||||||
res := []candidateWithTime{}
|
res := []candidateWithTime{}
|
||||||
res = mem.appendReplacementCandidates(res, transport, scope, primaryDigest)
|
res = mem.appendReplacementCandidates(res, transport, scope, primaryDigest)
|
||||||
var uncompressedDigest digest.Digest // = ""
|
var uncompressedDigest digest.Digest // = ""
|
||||||
if canSubstitute {
|
if canSubstitute {
|
||||||
if uncompressedDigest = mem.UncompressedDigest(primaryDigest); uncompressedDigest != "" {
|
if uncompressedDigest = mem.uncompressedDigest(primaryDigest); uncompressedDigest != "" {
|
||||||
otherDigests := mem.digestsByUncompressed[uncompressedDigest] // nil if not present in the map
|
otherDigests := mem.digestsByUncompressed[uncompressedDigest] // nil if not present in the map
|
||||||
for d := range otherDigests {
|
for d := range otherDigests {
|
||||||
if d != primaryDigest && d != uncompressedDigest {
|
if d != primaryDigest && d != uncompressedDigest {
|
||||||
|
2
vendor/github.com/containers/image/version/version.go
generated
vendored
2
vendor/github.com/containers/image/version/version.go
generated
vendored
@ -11,7 +11,7 @@ const (
|
|||||||
VersionPatch = 5
|
VersionPatch = 5
|
||||||
|
|
||||||
// VersionDev indicates development branch. Releases will be empty string.
|
// VersionDev indicates development branch. Releases will be empty string.
|
||||||
VersionDev = "-dev"
|
VersionDev = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version is the specification version that the package types support.
|
// Version is the specification version that the package types support.
|
||||||
|
Reference in New Issue
Block a user