|
@@ -11,29 +11,29 @@ import (
|
|
|
"github.com/docker/docker/pkg/ioutils"
|
|
|
)
|
|
|
|
|
|
-// naiveDiffDriver takes a ProtoDriver and adds the
|
|
|
+// NaiveDiffDriver takes a ProtoDriver and adds the
|
|
|
// capability of the Diffing methods which it may or may not
|
|
|
// support on its own. See the comment on the exported
|
|
|
-// NaiveDiffDriver function below.
|
|
|
+// NewNaiveDiffDriver function below.
|
|
|
// Notably, the AUFS driver doesn't need to be wrapped like this.
|
|
|
-type naiveDiffDriver struct {
|
|
|
+type NaiveDiffDriver struct {
|
|
|
ProtoDriver
|
|
|
}
|
|
|
|
|
|
-// NaiveDiffDriver returns a fully functional driver that wraps the
|
|
|
+// NewNaiveDiffDriver returns a fully functional driver that wraps the
|
|
|
// given ProtoDriver and adds the capability of the following methods which
|
|
|
// it may or may not support on its own:
|
|
|
// Diff(id, parent string) (archive.Archive, error)
|
|
|
// Changes(id, parent string) ([]archive.Change, error)
|
|
|
// ApplyDiff(id, parent string, diff archive.Reader) (size int64, err error)
|
|
|
// DiffSize(id, parent string) (size int64, err error)
|
|
|
-func NaiveDiffDriver(driver ProtoDriver) Driver {
|
|
|
- return &naiveDiffDriver{ProtoDriver: driver}
|
|
|
+func NewNaiveDiffDriver(driver ProtoDriver) Driver {
|
|
|
+ return &NaiveDiffDriver{ProtoDriver: driver}
|
|
|
}
|
|
|
|
|
|
// Diff produces an archive of the changes between the specified
|
|
|
// layer and its parent layer which may be "".
|
|
|
-func (gdw *naiveDiffDriver) Diff(id, parent string) (arch archive.Archive, err error) {
|
|
|
+func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch archive.Archive, err error) {
|
|
|
driver := gdw.ProtoDriver
|
|
|
|
|
|
layerFs, err := driver.Get(id, "")
|
|
@@ -84,7 +84,7 @@ func (gdw *naiveDiffDriver) Diff(id, parent string) (arch archive.Archive, err e
|
|
|
|
|
|
// Changes produces a list of changes between the specified layer
|
|
|
// and its parent layer. If parent is "", then all changes will be ADD changes.
|
|
|
-func (gdw *naiveDiffDriver) Changes(id, parent string) ([]archive.Change, error) {
|
|
|
+func (gdw *NaiveDiffDriver) Changes(id, parent string) ([]archive.Change, error) {
|
|
|
driver := gdw.ProtoDriver
|
|
|
|
|
|
layerFs, err := driver.Get(id, "")
|
|
@@ -109,7 +109,7 @@ func (gdw *naiveDiffDriver) Changes(id, parent string) ([]archive.Change, error)
|
|
|
// ApplyDiff extracts the changeset from the given diff into the
|
|
|
// layer with the specified id and parent, returning the size of the
|
|
|
// new layer in bytes.
|
|
|
-func (gdw *naiveDiffDriver) ApplyDiff(id, parent string, diff archive.Reader) (size int64, err error) {
|
|
|
+func (gdw *NaiveDiffDriver) ApplyDiff(id, parent string, diff archive.Reader) (size int64, err error) {
|
|
|
driver := gdw.ProtoDriver
|
|
|
|
|
|
// Mount the root filesystem so we can apply the diff/layer.
|
|
@@ -132,7 +132,7 @@ func (gdw *naiveDiffDriver) ApplyDiff(id, parent string, diff archive.Reader) (s
|
|
|
// DiffSize calculates the changes between the specified layer
|
|
|
// and its parent and returns the size in bytes of the changes
|
|
|
// relative to its base filesystem directory.
|
|
|
-func (gdw *naiveDiffDriver) DiffSize(id, parent string) (size int64, err error) {
|
|
|
+func (gdw *NaiveDiffDriver) DiffSize(id, parent string) (size int64, err error) {
|
|
|
driver := gdw.ProtoDriver
|
|
|
|
|
|
changes, err := gdw.Changes(id, parent)
|