From 7a5d592372300fb19214e70e8db4703d1ebd6840 Mon Sep 17 00:00:00 2001 From: Abhinandan Prativadi Date: Tue, 8 Aug 2017 21:19:59 -0700 Subject: [PATCH] Exposing helpers to access internal structure Adding image.Config,image.Size,image.RootFS to retrieve the internal image information which will be needed by consumers of containerd Signed-off-by: Abhinandan Prativadi --- image.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/image.go b/image.go index d1d241599..3737b7234 100644 --- a/image.go +++ b/image.go @@ -20,6 +20,10 @@ 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(ctx context.Context) ([]digest.Digest, error) + // Size returns the image size + Size(ctx context.Context) (int64, error) } var _ = (Image)(&image{}) @@ -38,6 +42,16 @@ func (i *image) Target() ocispec.Descriptor { return i.i.Target } +func (i *image) RootFS(ctx context.Context) ([]digest.Digest, error) { + provider := i.client.ContentStore() + return i.i.RootFS(ctx, provider) +} + +func (i *image) Size(ctx context.Context) (int64, error) { + provider := i.client.ContentStore() + return i.i.Size(ctx, provider) +} + func (i *image) Unpack(ctx context.Context, snapshotterName string) error { layers, err := i.getLayers(ctx) if err != nil {