diff --git a/pkg/compression/compression.go b/pkg/compression/compression.go index 8672b243dd..bc075df326 100644 --- a/pkg/compression/compression.go +++ b/pkg/compression/compression.go @@ -27,12 +27,15 @@ var ( Xz = internal.NewAlgorithm("Xz", "xz", []byte{0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00}, XzDecompressor, xzCompressor) // Zstd compression. Zstd = internal.NewAlgorithm("zstd", "zstd", []byte{0x28, 0xb5, 0x2f, 0xfd}, ZstdDecompressor, zstdCompressor) + // Zstd:chunked compression. + ZstdChunked = internal.NewAlgorithm("zstd:chunked", "zstd", []byte{0x28, 0xb5, 0x2f, 0xfd}, ZstdDecompressor, getZstdCompressor) compressionAlgorithms = map[string]Algorithm{ - Gzip.Name(): Gzip, - Bzip2.Name(): Bzip2, - Xz.Name(): Xz, - Zstd.Name(): Zstd, + Gzip.Name(): Gzip, + Bzip2.Name(): Bzip2, + Xz.Name(): Xz, + Zstd.Name(): Zstd, + ZstdChunked.Name(): ZstdChunked, } ) diff --git a/pkg/compression/compression_linux.go b/pkg/compression/compression_linux.go new file mode 100644 index 0000000000..2e9be2959f --- /dev/null +++ b/pkg/compression/compression_linux.go @@ -0,0 +1,11 @@ +package compression + +import( + "io" + + "github.com/containers/storage/pkg/chunked" +) + +func getZstdCompressor(r io.Writer, metadata map[string]string, level *int) (CompressorFunc, error) { + return chunked.ZstdCompressor +} diff --git a/pkg/compression/compression_unsupported.go b/pkg/compression/compression_unsupported.go new file mode 100644 index 0000000000..7844636085 --- /dev/null +++ b/pkg/compression/compression_unsupported.go @@ -0,0 +1,11 @@ +// +build !linux + +package compression + +import ( + "fmt" +) + +func getZstdCompressor(r io.Writer, metadata map[string]string, level *int) (CompressorFunc, error) { + return nil, fmt.Errorf("compressor not supported on this arch") +}