From 76e016ca304191ac3c101defe75cd35471c8ec72 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Wed, 30 Aug 2017 06:51:17 +0000 Subject: [PATCH] Add image config function. Signed-off-by: Lantao Liu --- image.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/image.go b/image.go index 3737b7234..bf725cba6 100644 --- a/image.go +++ b/image.go @@ -20,10 +20,12 @@ type Image interface { Target() ocispec.Descriptor // Unpack unpacks the image's content into a snapshot Unpack(context.Context, string) error - // RootFS returns the image digests + // RootFS returns the unpacked diffids that make up images rootfs. RootFS(ctx context.Context) ([]digest.Digest, error) - // Size returns the image size + // Size returns the total size of the image's packed resources. Size(ctx context.Context) (int64, error) + // Config descriptor for the image. + Config(ctx context.Context) (ocispec.Descriptor, error) } var _ = (Image)(&image{}) @@ -52,6 +54,11 @@ func (i *image) Size(ctx context.Context) (int64, error) { return i.i.Size(ctx, provider) } +func (i *image) Config(ctx context.Context) (ocispec.Descriptor, error) { + provider := i.client.ContentStore() + return i.i.Config(ctx, provider) +} + func (i *image) Unpack(ctx context.Context, snapshotterName string) error { layers, err := i.getLayers(ctx) if err != nil {