Remove OS() from layer interface

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2018-01-18 12:56:28 -08:00
parent 0cba7740d4
commit c94d34f783
8 changed files with 8 additions and 36 deletions

View File

@ -57,10 +57,6 @@ func (ml *mockLayer) DiffSize() (size int64, err error) {
return 0, nil
}
func (ml *mockLayer) OS() string {
return ml.os
}
func (ml *mockLayer) Metadata() (map[string]string, error) {
return make(map[string]string), nil
}
@ -158,10 +154,6 @@ func (ls *mockLayerStore) DriverName() string {
return "mock"
}
func (ls *mockLayerStore) OS() string {
return runtime.GOOS
}
type mockDownloadDescriptor struct {
currentDownloads *int32
id string

View File

@ -224,6 +224,13 @@ func (is *store) Delete(id ID) ([]layer.Metadata, error) {
if imageMeta == nil {
return nil, fmt.Errorf("unrecognized image ID %s", id.String())
}
img, err := is.Get(id)
if err != nil {
return nil, fmt.Errorf("unrecognized image %s, %v", id.String(), err)
}
if !system.IsOSSupported(img.OperatingSystem()) {
return nil, fmt.Errorf("unsupported image operating system %q", img.OperatingSystem())
}
for id := range imageMeta.children {
is.fs.DeleteMetadata(id.Digest(), "parent")
}
@ -238,7 +245,7 @@ func (is *store) Delete(id ID) ([]layer.Metadata, error) {
is.fs.Delete(id.Digest())
if imageMeta.layer != nil {
return is.lss[imageMeta.layer.OS()].Release(imageMeta.layer)
return is.lss[img.OperatingSystem()].Release(imageMeta.layer)
}
return nil, nil
}

View File

@ -43,10 +43,6 @@ func (el *emptyLayer) Parent() Layer {
return nil
}
func (el *emptyLayer) OS() string {
return ""
}
func (el *emptyLayer) Size() (size int64, err error) {
return 0, nil
}

View File

@ -100,9 +100,6 @@ type Layer interface {
// Parent returns the next layer in the layer chain.
Parent() Layer
// OS returns the operating system of the layer
OS() string
// Size returns the size of the entire layer chain. The size
// is calculated from the total size of all files in the layers.
Size() (int64, error)
@ -148,9 +145,6 @@ type RWLayer interface {
// Metadata returns the low level metadata for the mutable layer
Metadata() (map[string]string, error)
// OS returns the operating system of the writable layer
OS() string
}
// Metadata holds information about a
@ -199,7 +193,6 @@ type Store interface {
Cleanup() error
DriverStatus() [][2]string
DriverName() string
OS() string
}
// DescribableStore represents a layer store capable of storing

View File

@ -725,10 +725,6 @@ func (ls *layerStore) DriverName() string {
return ls.driver.String()
}
func (ls *layerStore) OS() string {
return ls.os
}
type naiveDiffPathDriver struct {
graphdriver.Driver
}

View File

@ -46,10 +46,6 @@ func (ml *mountedLayer) Parent() Layer {
return nil
}
func (ml *mountedLayer) OS() string {
return ml.layerStore.os
}
func (ml *mountedLayer) Size() (int64, error) {
return ml.layerStore.driver.DiffSize(ml.mountID, ml.cacheParent())
}

View File

@ -69,10 +69,6 @@ func (rl *roLayer) Parent() Layer {
return rl.parent
}
func (rl *roLayer) OS() string {
return rl.layerStore.os
}
func (rl *roLayer) Size() (size int64, err error) {
if rl.parent != nil {
size, err = rl.parent.Size()

View File

@ -432,10 +432,6 @@ func (l *mockLayer) DiffSize() (int64, error) {
return 0, nil
}
func (l *mockLayer) OS() string {
return ""
}
func (l *mockLayer) Metadata() (map[string]string, error) {
return nil, nil
}