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 <abhi@docker.com>
This commit is contained in:
Abhinandan Prativadi 2017-08-08 21:19:59 -07:00
parent 29a4dd7f46
commit 7a5d592372

View File

@ -20,6 +20,10 @@ type Image interface {
Target() ocispec.Descriptor Target() ocispec.Descriptor
// Unpack unpacks the image's content into a snapshot // Unpack unpacks the image's content into a snapshot
Unpack(context.Context, string) error 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{}) var _ = (Image)(&image{})
@ -38,6 +42,16 @@ func (i *image) Target() ocispec.Descriptor {
return i.i.Target 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 { func (i *image) Unpack(ctx context.Context, snapshotterName string) error {
layers, err := i.getLayers(ctx) layers, err := i.getLayers(ctx)
if err != nil { if err != nil {