Updated vendor

This commit is contained in:
Priya Wadhwa
2018-04-12 14:36:39 -07:00
parent 1b6a14cf3a
commit 0fd35166a3
11 changed files with 525 additions and 46 deletions
@@ -20,6 +20,7 @@ import (
"bytes"
"compress/gzip"
"encoding/json"
"github.com/containers/image/docker"
img "github.com/containers/image/image"
"github.com/containers/image/types"
"io"
@@ -40,6 +41,9 @@ type MutableSource struct {
}
func NewMutableSource(r types.ImageReference) (*MutableSource, error) {
if r == nil {
return MutableSourceFromScratch()
}
src, err := r.NewImageSource(nil)
if err != nil {
return nil, err
@@ -63,6 +67,36 @@ func NewMutableSource(r types.ImageReference) (*MutableSource, error) {
return ms, nil
}
func MutableSourceFromScratch() (*MutableSource, error) {
config := &manifest.Schema2Image{
Schema2V1Image: manifest.Schema2V1Image{
Config: &manifest.Schema2Config{},
},
RootFS: &manifest.Schema2RootFS{},
History: []manifest.Schema2History{},
}
ref, err := docker.ParseReference("//scratch")
if err != nil {
return nil, err
}
src, err := ref.NewImageSource(nil)
if err != nil {
return nil, err
}
ms := &MutableSource{
ProxySource: ProxySource{
Ref: &ProxyReference{
ImageReference: ref,
},
ImageSource: src,
},
extraBlobs: make(map[string][]byte),
cfg: config,
mfst: &manifest.Schema2{},
}
return ms, nil
}
// Manifest marshals the stored manifest to the byte format.
func (m *MutableSource) GetManifest(_ *digest.Digest) ([]byte, string, error) {
if err := m.saveConfig(); err != nil {