Browse code

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 authored on 2016/11/02 06:44:27
Showing 2 changed files
... ...
@@ -78,15 +78,16 @@ type TarStreamer interface {
78 78
 	// TarStream returns a tar archive stream
79 79
 	// for the contents of a layer.
80 80
 	TarStream() (io.ReadCloser, error)
81
-	// TarStreamFrom returns a tar archive stream for all the layer chain with
82
-	// arbitrary depth.
83
-	TarStreamFrom(ChainID) (io.ReadCloser, error)
84 81
 }
85 82
 
86 83
 // Layer represents a read-only layer
87 84
 type Layer interface {
88 85
 	TarStreamer
89 86
 
87
+	// TarStreamFrom returns a tar archive stream for all the layer chain with
88
+	// arbitrary depth.
89
+	TarStreamFrom(ChainID) (io.ReadCloser, error)
90
+
90 91
 	// ChainID returns the content hash of the entire layer chain. The hash
91 92
 	// chain is made up of DiffID of top layer and all of its parents.
92 93
 	ChainID() ChainID
... ...
@@ -1,7 +1,6 @@
1 1
 package layer
2 2
 
3 3
 import (
4
-	"fmt"
5 4
 	"io"
6 5
 
7 6
 	"github.com/docker/docker/pkg/archive"
... ...
@@ -32,13 +31,6 @@ func (ml *mountedLayer) TarStream() (io.ReadCloser, error) {
32 32
 	return ml.layerStore.driver.Diff(ml.mountID, ml.cacheParent())
33 33
 }
34 34
 
35
-func (ml *mountedLayer) TarStreamFrom(parent ChainID) (io.ReadCloser, error) {
36
-	// Not supported since this will include the init layer as well
37
-	// This can already be acheived with mount + tar.
38
-	// Should probably never reach this point, but error out here.
39
-	return nil, fmt.Errorf("getting a layer diff from an arbitrary parent is not supported on mounted layer")
40
-}
41
-
42 35
 func (ml *mountedLayer) Name() string {
43 36
 	return ml.name
44 37
 }