Finish image management.
Signed-off-by: Random-Liu <lantaol@google.com>
This commit is contained in:
@@ -19,6 +19,8 @@ package metadata
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
||||
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata/store"
|
||||
)
|
||||
|
||||
@@ -41,14 +43,18 @@ type versionedImageMetadata struct {
|
||||
|
||||
// ImageMetadata is the unversioned image metadata.
|
||||
type ImageMetadata struct {
|
||||
// Id of the image. Normally the Digest
|
||||
// Id of the image. Normally the digest of image config.
|
||||
ID string `json:"id,omitempty"`
|
||||
// ChainID is the chainID of the image.
|
||||
ChainID string `json:"chain_id,omitempty"`
|
||||
// Other names by which this image is known.
|
||||
RepoTags []string `json:"repo_tags,omitempty"`
|
||||
// Digests by which this image is known.
|
||||
RepoDigests []string `json:"repo_digests,omitempty"`
|
||||
// Size of the image in bytes. Must be > 0.
|
||||
Size uint64 `json:"size,omitempty"`
|
||||
// Size is the compressed size of the image.
|
||||
Size int64 `json:"size,omitempty"`
|
||||
// Config is the oci image config of the image.
|
||||
Config *imagespec.ImageConfig `json:"config,omitempty"`
|
||||
}
|
||||
|
||||
// ImageMetadataUpdateFunc is the function used to update ImageMetadata.
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
func TestImageMetadataStore(t *testing.T) {
|
||||
imageMetadataMap := map[string]*ImageMetadata{
|
||||
"1": {
|
||||
ID: "1", // TODO(mikebrow): fill
|
||||
ID: "1",
|
||||
Size: 10,
|
||||
},
|
||||
"2": {
|
||||
@@ -62,7 +62,7 @@ func TestImageMetadataStore(t *testing.T) {
|
||||
|
||||
t.Logf("should be able to update image metadata")
|
||||
testID := "2"
|
||||
newSize := uint64(200)
|
||||
newSize := int64(200)
|
||||
expectMeta := *imageMetadataMap[testID]
|
||||
expectMeta.Size = newSize
|
||||
err = s.Update(testID, func(o ImageMetadata) (ImageMetadata, error) {
|
||||
|
||||
Reference in New Issue
Block a user