mirror of
https://github.com/containers/podman.git
synced 2025-12-03 11:49:18 +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 ""
|
||||
}
|
||||
|
||||
17
vendor/github.com/containers/storage/pkg/archive/archive_cgo.go
generated
vendored
Normal file
17
vendor/github.com/containers/storage/pkg/archive/archive_cgo.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// +build cgo
|
||||
|
||||
package archive
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/DataDog/zstd"
|
||||
)
|
||||
|
||||
func zstdReader(buf io.Reader) (io.ReadCloser, error) {
|
||||
return zstd.NewReader(buf), nil
|
||||
}
|
||||
|
||||
func zstdWriter(dest io.Writer) (io.WriteCloser, error) {
|
||||
return zstd.NewWriter(dest), nil
|
||||
}
|
||||
16
vendor/github.com/containers/storage/pkg/archive/archive_nocgo.go
generated
vendored
Normal file
16
vendor/github.com/containers/storage/pkg/archive/archive_nocgo.go
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// +build !cgo
|
||||
|
||||
package archive
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
func zstdReader(buf io.Reader) (io.ReadCloser, error) {
|
||||
return nil, fmt.Errorf("zstd not supported on this platform")
|
||||
}
|
||||
|
||||
func zstdWriter(dest io.Writer) (io.WriteCloser, error) {
|
||||
return nil, fmt.Errorf("zstd not supported on this platform")
|
||||
}
|
||||
Reference in New Issue
Block a user