mirror of
https://github.com/mudler/luet.git
synced 2025-09-11 20:19:30 +00:00
update vendor
This commit is contained in:
16
vendor/github.com/google/go-containerregistry/pkg/v1/partial/README.md
generated
vendored
16
vendor/github.com/google/go-containerregistry/pkg/v1/partial/README.md
generated
vendored
@@ -64,3 +64,19 @@ there are cases where it is very helpful to know the layer size, e.g. when
|
||||
writing the uncompressed layer into a tarball.
|
||||
|
||||
See [`#655`](https://github.com/google/go-containerregistry/pull/655).
|
||||
|
||||
### [`partial.Exists`](https://godoc.org/github.com/google/go-containerregistry/pkg/v1/partial#Exists)
|
||||
|
||||
We generally don't care about the existence of something as granular as a
|
||||
layer, and would rather ensure all the invariants of an image are upheld via
|
||||
the `validate` package. However, there are situations where we want to do a
|
||||
quick smoke test to ensure that the underlying storage engine hasn't been
|
||||
corrupted by something e.g. deleting files or blobs. Thus, we've exposed an
|
||||
optional `Exists` method that does an existence check without actually reading
|
||||
any bytes.
|
||||
|
||||
The `remote` package implements this via `HEAD` requests.
|
||||
|
||||
The `layout` package implements this via `os.Stat`.
|
||||
|
||||
See [`#838`](https://github.com/google/go-containerregistry/pull/838).
|
||||
|
4
vendor/github.com/google/go-containerregistry/pkg/v1/partial/compressed.go
generated
vendored
4
vendor/github.com/google/go-containerregistry/pkg/v1/partial/compressed.go
generated
vendored
@@ -17,9 +17,9 @@ package partial
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/google/go-containerregistry/internal/gzip"
|
||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||
"github.com/google/go-containerregistry/pkg/v1/types"
|
||||
"github.com/google/go-containerregistry/pkg/v1/v1util"
|
||||
)
|
||||
|
||||
// CompressedLayer represents the bare minimum interface a natively
|
||||
@@ -49,7 +49,7 @@ func (cle *compressedLayerExtender) Uncompressed() (io.ReadCloser, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v1util.GunzipReadCloser(r)
|
||||
return gzip.UnzipReadCloser(r)
|
||||
}
|
||||
|
||||
// DiffID implements v1.Layer
|
||||
|
4
vendor/github.com/google/go-containerregistry/pkg/v1/partial/uncompressed.go
generated
vendored
4
vendor/github.com/google/go-containerregistry/pkg/v1/partial/uncompressed.go
generated
vendored
@@ -19,9 +19,9 @@ import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/google/go-containerregistry/internal/gzip"
|
||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||
"github.com/google/go-containerregistry/pkg/v1/types"
|
||||
"github.com/google/go-containerregistry/pkg/v1/v1util"
|
||||
)
|
||||
|
||||
// UncompressedLayer represents the bare minimum interface a natively
|
||||
@@ -54,7 +54,7 @@ func (ule *uncompressedLayerExtender) Compressed() (io.ReadCloser, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return v1util.GzipReadCloser(u), nil
|
||||
return gzip.ReadCloser(u), nil
|
||||
}
|
||||
|
||||
// Digest implements v1.Layer
|
||||
|
83
vendor/github.com/google/go-containerregistry/pkg/v1/partial/with.go
generated
vendored
83
vendor/github.com/google/go-containerregistry/pkg/v1/partial/with.go
generated
vendored
@@ -297,33 +297,10 @@ type Describable interface {
|
||||
// UncompressedToImage.
|
||||
func Descriptor(d Describable) (*v1.Descriptor, error) {
|
||||
// If Describable implements Descriptor itself, return that.
|
||||
if wd, ok := d.(withDescriptor); ok {
|
||||
if wd, ok := unwrap(d).(withDescriptor); ok {
|
||||
return wd.Descriptor()
|
||||
}
|
||||
|
||||
// Otherwise, try to unwrap any partial implementations to see
|
||||
// if the wrapped struct implements Descriptor.
|
||||
if ule, ok := d.(*uncompressedLayerExtender); ok {
|
||||
if wd, ok := ule.UncompressedLayer.(withDescriptor); ok {
|
||||
return wd.Descriptor()
|
||||
}
|
||||
}
|
||||
if cle, ok := d.(*compressedLayerExtender); ok {
|
||||
if wd, ok := cle.CompressedLayer.(withDescriptor); ok {
|
||||
return wd.Descriptor()
|
||||
}
|
||||
}
|
||||
if uie, ok := d.(*uncompressedImageExtender); ok {
|
||||
if wd, ok := uie.UncompressedImageCore.(withDescriptor); ok {
|
||||
return wd.Descriptor()
|
||||
}
|
||||
}
|
||||
if cie, ok := d.(*compressedImageExtender); ok {
|
||||
if wd, ok := cie.CompressedImageCore.(withDescriptor); ok {
|
||||
return wd.Descriptor()
|
||||
}
|
||||
}
|
||||
|
||||
// If all else fails, compute the descriptor from the individual methods.
|
||||
var (
|
||||
desc v1.Descriptor
|
||||
@@ -354,23 +331,10 @@ type withUncompressedSize interface {
|
||||
// for streaming layers.
|
||||
func UncompressedSize(l v1.Layer) (int64, error) {
|
||||
// If the layer implements UncompressedSize itself, return that.
|
||||
if wus, ok := l.(withUncompressedSize); ok {
|
||||
if wus, ok := unwrap(l).(withUncompressedSize); ok {
|
||||
return wus.UncompressedSize()
|
||||
}
|
||||
|
||||
// Otherwise, try to unwrap any partial implementations to see
|
||||
// if the wrapped struct implements UncompressedSize.
|
||||
if ule, ok := l.(*uncompressedLayerExtender); ok {
|
||||
if wus, ok := ule.UncompressedLayer.(withUncompressedSize); ok {
|
||||
return wus.UncompressedSize()
|
||||
}
|
||||
}
|
||||
if cle, ok := l.(*compressedLayerExtender); ok {
|
||||
if wus, ok := cle.CompressedLayer.(withUncompressedSize); ok {
|
||||
return wus.UncompressedSize()
|
||||
}
|
||||
}
|
||||
|
||||
// The layer doesn't implement UncompressedSize, we need to compute it.
|
||||
rc, err := l.Uncompressed()
|
||||
if err != nil {
|
||||
@@ -380,3 +344,46 @@ func UncompressedSize(l v1.Layer) (int64, error) {
|
||||
|
||||
return io.Copy(ioutil.Discard, rc)
|
||||
}
|
||||
|
||||
type withExists interface {
|
||||
Exists() (bool, error)
|
||||
}
|
||||
|
||||
// Exists checks to see if a layer exists. This is a hack to work around the
|
||||
// mistakes of the partial package. Don't use this.
|
||||
func Exists(l v1.Layer) (bool, error) {
|
||||
// If the layer implements Exists itself, return that.
|
||||
if we, ok := unwrap(l).(withExists); ok {
|
||||
return we.Exists()
|
||||
}
|
||||
|
||||
// The layer doesn't implement Exists, so we hope that calling Compressed()
|
||||
// is enough to trigger an error if the layer does not exist.
|
||||
rc, err := l.Compressed()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer rc.Close()
|
||||
|
||||
// We may want to try actually reading a single byte, but if we need to do
|
||||
// that, we should just fix this hack.
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// Recursively unwrap our wrappers so that we can check for the original implementation.
|
||||
// We might want to expose this?
|
||||
func unwrap(i interface{}) interface{} {
|
||||
if ule, ok := i.(*uncompressedLayerExtender); ok {
|
||||
return unwrap(ule.UncompressedLayer)
|
||||
}
|
||||
if cle, ok := i.(*compressedLayerExtender); ok {
|
||||
return unwrap(cle.CompressedLayer)
|
||||
}
|
||||
if uie, ok := i.(*uncompressedImageExtender); ok {
|
||||
return unwrap(uie.UncompressedImageCore)
|
||||
}
|
||||
if cie, ok := i.(*compressedImageExtender); ok {
|
||||
return unwrap(cie.CompressedImageCore)
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
Reference in New Issue
Block a user