1
0
mirror of https://github.com/moby/buildkit.git synced 2025-07-17 10:40:59 +03:00

exporter: support creating blobs with zstd compression

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2021-09-05 00:01:13 -07:00
parent 9b010e774d
commit 8b5c4d74ef
12 changed files with 315 additions and 219 deletions

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package cache
@ -34,7 +35,6 @@ var emptyDesc = ocispecs.Descriptor{}
// be computed (e.g. because the mounts aren't overlayfs), it returns
// an error.
func (sr *immutableRef) tryComputeOverlayBlob(ctx context.Context, lower, upper []mount.Mount, mediaType string, ref string, compressorFunc compressor) (_ ocispecs.Descriptor, ok bool, err error) {
// Get upperdir location if mounts are overlayfs that can be processed by this differ.
upperdir, err := getOverlayUpperdir(lower, upper)
if err != nil {
@ -50,6 +50,8 @@ func (sr *immutableRef) tryComputeOverlayBlob(ctx context.Context, lower, upper
compressorFunc = func(dest io.Writer, requiredMediaType string) (io.WriteCloser, error) {
return ctdcompression.CompressStream(dest, ctdcompression.Gzip)
}
case ocispecs.MediaTypeImageLayer + "+zstd":
compressorFunc = zstdWriter
default:
return emptyDesc, false, errors.Errorf("unsupported diff media type: %v", mediaType)
}