mirror of
https://github.com/moby/buildkit.git
synced 2026-08-09 01:01:08 +00:00
The toZstdEncoderLevel utility was introduced in cab33b1e31,
and has a custom mapping of zstd compressions levels to their go (klauspost/compress)
counterparts.
Swap our local implementation for the one in klauspost/compress so that new levels
implemented in klauspost/compress will also be mapped if they arrive.
This does change some mappings;
| Input level | Before | After |
|-------------|------------------------|--------------------------|
| `< 0` | `SpeedDefault` | `SpeedFastest` |
| `6` | `SpeedDefault` | `SpeedBetterCompression` |
| `9` | `SpeedBestCompression` | `SpeedBetterCompression` |
While updating, also slightly refactor;
- use an options slice to skip setting the option if no config was set, and
to allow adding additional options.
- inline zstdWriter where used, as it was only used in a single place.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>