mirror of
https://github.com/containers/podman.git
synced 2025-09-12 18:09:45 +08:00
vendor containers/storage v1.12.11
vendor cs with overlay caching cs also carries a dep on github.com/DataDog/zstd Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
9
vendor/github.com/containers/storage/pkg/archive/archive.go
generated
vendored
9
vendor/github.com/containers/storage/pkg/archive/archive.go
generated
vendored
@ -98,6 +98,8 @@ const (
|
||||
Gzip
|
||||
// Xz is xz compression algorithm.
|
||||
Xz
|
||||
// Zstd is zstd compression algorithm.
|
||||
Zstd
|
||||
)
|
||||
|
||||
const (
|
||||
@ -141,6 +143,7 @@ func DetectCompression(source []byte) Compression {
|
||||
Bzip2: {0x42, 0x5A, 0x68},
|
||||
Gzip: {0x1F, 0x8B, 0x08},
|
||||
Xz: {0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00},
|
||||
Zstd: {0x28, 0xb5, 0x2f, 0xfd},
|
||||
} {
|
||||
if len(source) < len(m) {
|
||||
logrus.Debug("Len too short")
|
||||
@ -200,6 +203,8 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
|
||||
<-chdone
|
||||
return readBufWrapper.Close()
|
||||
}), nil
|
||||
case Zstd:
|
||||
return zstdReader(buf)
|
||||
default:
|
||||
return nil, fmt.Errorf("Unsupported compression format %s", (&compression).Extension())
|
||||
}
|
||||
@ -217,6 +222,8 @@ func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, er
|
||||
gzWriter := gzip.NewWriter(dest)
|
||||
writeBufWrapper := p.NewWriteCloserWrapper(buf, gzWriter)
|
||||
return writeBufWrapper, nil
|
||||
case Zstd:
|
||||
return zstdWriter(dest)
|
||||
case Bzip2, Xz:
|
||||
// archive/bzip2 does not support writing, and there is no xz support at all
|
||||
// However, this is not a problem as docker only currently generates gzipped tars
|
||||
@ -324,6 +331,8 @@ func (compression *Compression) Extension() string {
|
||||
return "tar.gz"
|
||||
case Xz:
|
||||
return "tar.xz"
|
||||
case Zstd:
|
||||
return "tar.zst"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user