From 1f4d8737e82f1c5681c9682346228f8e5d203444 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Tue, 21 Feb 2023 22:58:33 -0800 Subject: [PATCH] archive: add CompressLevel type and consts (MR 25) There's really not a great way to map individual levels to each compression library, so this just adds a new type that will invoke the three relevant levels for each library used. This could be improved in the future. --- internal/archive/archive.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/archive/archive.go b/internal/archive/archive.go index 922732c..a0e3bee 100644 --- a/internal/archive/archive.go +++ b/internal/archive/archive.go @@ -29,6 +29,17 @@ const ( FormatZstd CompressFormat = "zstd" ) +type CompressLevel string + +const ( + // Mapped to the "default" level for the given format + LevelDefault CompressLevel = "default" + // Maps to the fastest compression level for the given format + LevelFast CompressLevel = "fast" + // Maps to the best compression level for the given format + LevelBest CompressLevel = "best" +) + type Archive struct { items archiveItems cpioWriter *cpio.Writer