mirror of
https://github.com/containers/podman.git
synced 2025-12-11 01:11:30 +08:00
Vendor latest c/image
Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
34
vendor/github.com/containers/storage/pkg/chunked/toc/toc.go
generated
vendored
Normal file
34
vendor/github.com/containers/storage/pkg/chunked/toc/toc.go
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
package toc
|
||||
|
||||
import (
|
||||
"github.com/containers/storage/pkg/chunked/internal"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
)
|
||||
|
||||
// tocJSONDigestAnnotation is the annotation key for the digest of the estargz
|
||||
// TOC JSON.
|
||||
// It is defined in github.com/containerd/stargz-snapshotter/estargz as TOCJSONDigestAnnotation
|
||||
// Duplicate it here to avoid a dependency on the package.
|
||||
const tocJSONDigestAnnotation = "containerd.io/snapshot/stargz/toc.digest"
|
||||
|
||||
// GetTOCDigest returns the digest of the TOC as recorded in the annotations.
|
||||
// This function retrieves a digest that represents the content of a
|
||||
// table of contents (TOC) from the image's annotations.
|
||||
// This is an experimental feature and may be changed/removed in the future.
|
||||
func GetTOCDigest(annotations map[string]string) (*digest.Digest, error) {
|
||||
if contentDigest, ok := annotations[tocJSONDigestAnnotation]; ok {
|
||||
d, err := digest.Parse(contentDigest)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &d, nil
|
||||
}
|
||||
if contentDigest, ok := annotations[internal.ManifestChecksumKey]; ok {
|
||||
d, err := digest.Parse(contentDigest)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &d, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user