Ver Fonte

Remove TarStreamFrom from RWLayer interface

RWLayers do not implement the tar stream from, moved the
definition to Layer instead of TarStreamer

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Derek McGowan há 8 anos atrás
pai
commit
8625d25351
2 ficheiros alterados com 4 adições e 11 exclusões
  1. 4 3
      layer/layer.go
  2. 0 8
      layer/mounted_layer.go

+ 4 - 3
layer/layer.go

@@ -78,15 +78,16 @@ type TarStreamer interface {
 	// TarStream returns a tar archive stream
 	// for the contents of a layer.
 	TarStream() (io.ReadCloser, error)
-	// TarStreamFrom returns a tar archive stream for all the layer chain with
-	// arbitrary depth.
-	TarStreamFrom(ChainID) (io.ReadCloser, error)
 }
 
 // Layer represents a read-only layer
 type Layer interface {
 	TarStreamer
 
+	// TarStreamFrom returns a tar archive stream for all the layer chain with
+	// arbitrary depth.
+	TarStreamFrom(ChainID) (io.ReadCloser, error)
+
 	// ChainID returns the content hash of the entire layer chain. The hash
 	// chain is made up of DiffID of top layer and all of its parents.
 	ChainID() ChainID

+ 0 - 8
layer/mounted_layer.go

@@ -1,7 +1,6 @@
 package layer
 
 import (
-	"fmt"
 	"io"
 
 	"github.com/docker/docker/pkg/archive"
@@ -32,13 +31,6 @@ func (ml *mountedLayer) TarStream() (io.ReadCloser, error) {
 	return ml.layerStore.driver.Diff(ml.mountID, ml.cacheParent())
 }
 
-func (ml *mountedLayer) TarStreamFrom(parent ChainID) (io.ReadCloser, error) {
-	// Not supported since this will include the init layer as well
-	// This can already be acheived with mount + tar.
-	// Should probably never reach this point, but error out here.
-	return nil, fmt.Errorf("getting a layer diff from an arbitrary parent is not supported on mounted layer")
-}
-
 func (ml *mountedLayer) Name() string {
 	return ml.name
 }