mirror of
https://github.com/containers/podman.git
synced 2025-08-24 01:50:58 +08:00

given that we are moving to building our own machine images, we have decided to use zstd compression as it is superior in speed to the alternatives. as such, this pr adds zstd to our machine code; and also has to account for dealing with sparseness on darwin; which the default zstd golang library does not. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
33 lines
434 B
Go
33 lines
434 B
Go
package define
|
|
|
|
import "fmt"
|
|
|
|
type ImageFormat int64
|
|
|
|
const (
|
|
Qcow ImageFormat = iota
|
|
Vhdx
|
|
Tar
|
|
Raw
|
|
)
|
|
|
|
func (imf ImageFormat) Kind() string {
|
|
switch imf {
|
|
case Vhdx:
|
|
return "vhdx"
|
|
case Tar:
|
|
return "tar"
|
|
case Raw:
|
|
return "raw"
|
|
}
|
|
return "qcow2"
|
|
}
|
|
|
|
func (imf ImageFormat) KindWithCompression() string {
|
|
// Tar uses xz; all others use zstd
|
|
if imf == Tar {
|
|
return "tar.xz"
|
|
}
|
|
return fmt.Sprintf("%s.zst", imf.Kind())
|
|
}
|