Skip to content

Commit c3a73dc

Browse files
committed
zstd: add constants to specs-go/v1
Add go constants for the zstd MIME types to make them usable by consumers of the go package. Signed-off-by: Valentin Rothberg <[email protected]>
1 parent 9f4348a commit c3a73dc

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

schema/validator.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ func validateManifest(r io.Reader) error {
117117
for _, layer := range header.Layers {
118118
if layer.MediaType != string(v1.MediaTypeImageLayer) &&
119119
layer.MediaType != string(v1.MediaTypeImageLayerGzip) &&
120+
layer.MediaType != string(v1.MediaTypeImageLayerZstd) &&
120121
layer.MediaType != string(v1.MediaTypeImageLayerNonDistributable) &&
121-
layer.MediaType != string(v1.MediaTypeImageLayerNonDistributableGzip) {
122+
layer.MediaType != string(v1.MediaTypeImageLayerNonDistributableGzip) &&
123+
layer.MediaType != string(v1.MediaTypeImageLayerNonDistributableZstd) {
122124
fmt.Printf("warning: layer %s has an unknown media type: %s\n", layer.Digest, layer.MediaType)
123125
}
124126
}

specs-go/v1/mediatype.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ const (
3434
// referenced by the manifest.
3535
MediaTypeImageLayerGzip = "application/vnd.oci.image.layer.v1.tar+gzip"
3636

37+
// MediaTypeImageLayerZstd is the media type used for zstd compressed
38+
// layers referenced by the manifest.
39+
MediaTypeImageLayerZstd = "application/vnd.oci.image.layer.v1.tar+zstd"
40+
3741
// MediaTypeImageLayerNonDistributable is the media type for layers referenced by
3842
// the manifest but with distribution restrictions.
3943
MediaTypeImageLayerNonDistributable = "application/vnd.oci.image.layer.nondistributable.v1.tar"
@@ -43,6 +47,11 @@ const (
4347
// restrictions.
4448
MediaTypeImageLayerNonDistributableGzip = "application/vnd.oci.image.layer.nondistributable.v1.tar+gzip"
4549

50+
// MediaTypeImageLayerNonDistributableZstd is the media type for zstd
51+
// compressed layers referenced by the manifest but with distribution
52+
// restrictions.
53+
MediaTypeImageLayerNonDistributableZstd = "application/vnd.oci.image.layer.nondistributable.v1.tar+zstd"
54+
4655
// MediaTypeImageConfig specifies the media type for the image configuration.
4756
MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json"
4857
)

0 commit comments

Comments
 (0)