1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Move Change to the archive package, and fix a leftover merge in

Container.Inject()
This commit is contained in:
Solomon Hykes 2013-11-08 00:35:26 +00:00
parent f1127b9308
commit 9ae4bcaaf8
7 changed files with 16 additions and 14 deletions

View file

@ -1,4 +1,4 @@
package docker package archive
import ( import (
"fmt" "fmt"

View file

@ -7,7 +7,6 @@ import (
"flag" "flag"
"fmt" "fmt"
"github.com/dotcloud/docker/archive" "github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
"github.com/dotcloud/docker/term" "github.com/dotcloud/docker/term"
"github.com/dotcloud/docker/utils" "github.com/dotcloud/docker/utils"
"github.com/kr/pty" "github.com/kr/pty"
@ -397,7 +396,7 @@ func (container *Container) Inject(file io.Reader, pth string) error {
} }
// Return error if path exists // Return error if path exists
if _, err := os.Stat(path.Join(container.rwPath(), pth)); err == nil { if _, err := os.Stat(path.Join(container.RootfsPath(), pth)); err == nil {
// Since err is nil, the path could be stat'd and it exists // Since err is nil, the path could be stat'd and it exists
return fmt.Errorf("%s exists", pth) return fmt.Errorf("%s exists", pth)
} else if !os.IsNotExist(err) { } else if !os.IsNotExist(err) {
@ -1402,7 +1401,7 @@ func (container *Container) Mount() error {
return container.runtime.Mount(container) return container.runtime.Mount(container)
} }
func (container *Container) Changes() ([]graphdriver.Change, error) { func (container *Container) Changes() ([]archive.Change, error) {
return container.runtime.Changes(container) return container.runtime.Changes(container)
} }

View file

@ -61,7 +61,7 @@ func (d *Driver) DiffSize(id string) (int64, error) {
return -1, fmt.Errorf("Not implemented") return -1, fmt.Errorf("Not implemented")
} }
func (d *Driver) Changes(id string) ([]graphdriver.Change, error) { func (d *Driver) Changes(id string) ([]archive.Change, error) {
return nil, fmt.Errorf("Not implemented") return nil, fmt.Errorf("Not implemented")
} }

View file

@ -5,12 +5,8 @@ import (
"github.com/dotcloud/docker/archive" "github.com/dotcloud/docker/archive"
) )
type InitFunc func(root string) (Driver, error)
// FIXME: this is a temporary placeholder for archive.Change type InitFunc func(root string) (Driver, error)
// (to be merged from master)
type Change interface {
}
type Driver interface { type Driver interface {
Create(id, parent string) error Create(id, parent string) error
@ -20,7 +16,7 @@ type Driver interface {
Diff(id string) (archive.Archive, error) Diff(id string) (archive.Archive, error)
DiffSize(id string) (bytes int64, err error) DiffSize(id string) (bytes int64, err error)
Changes(id string) ([]Change, error) Changes(id string) ([]archive.Change, error)
Cleanup() error Cleanup() error
} }

View file

@ -5,6 +5,7 @@ import (
"container/list" "container/list"
"database/sql" "database/sql"
"fmt" "fmt"
"github.com/dotcloud/docker/archive"
_ "github.com/dotcloud/docker/devmapper" _ "github.com/dotcloud/docker/devmapper"
"github.com/dotcloud/docker/gograph" "github.com/dotcloud/docker/gograph"
"github.com/dotcloud/docker/graphdriver" "github.com/dotcloud/docker/graphdriver"
@ -728,7 +729,7 @@ func (runtime *Runtime) Unmount(container *Container) error {
return nil return nil
} }
func (runtime *Runtime) Changes(container *Container) ([]graphdriver.Change, error) { func (runtime *Runtime) Changes(container *Container) ([]archive.Change, error) {
return runtime.driver.Changes(container.ID) return runtime.driver.Changes(container.ID)
} }

View file

@ -9,7 +9,6 @@ import (
"github.com/dotcloud/docker/auth" "github.com/dotcloud/docker/auth"
"github.com/dotcloud/docker/engine" "github.com/dotcloud/docker/engine"
"github.com/dotcloud/docker/gograph" "github.com/dotcloud/docker/gograph"
"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
"github.com/dotcloud/docker/registry" "github.com/dotcloud/docker/registry"
"github.com/dotcloud/docker/utils" "github.com/dotcloud/docker/utils"
"io" "io"
@ -449,7 +448,7 @@ func (srv *Server) ContainerTop(name, ps_args string) (*APITop, error) {
return nil, fmt.Errorf("No such container: %s", name) return nil, fmt.Errorf("No such container: %s", name)
} }
func (srv *Server) ContainerChanges(name string) ([]graphdriver.Change, error) { func (srv *Server) ContainerChanges(name string) ([]archive.Change, error) {
if container := srv.runtime.Get(name); container != nil { if container := srv.runtime.Get(name); container != nil {
return container.Changes() return container.Changes()
} }

View file

@ -23,6 +23,7 @@ btrfs_reflink(int fd_out, int fd_in)
import "C" import "C"
import ( import (
"fmt" "fmt"
"github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/namesgenerator" "github.com/dotcloud/docker/namesgenerator"
"github.com/dotcloud/docker/utils" "github.com/dotcloud/docker/utils"
"io" "io"
@ -33,6 +34,12 @@ import (
"syscall" "syscall"
) )
type Change struct {
archive.Change
}
// Compare two Config struct. Do not compare the "Image" nor "Hostname" fields // Compare two Config struct. Do not compare the "Image" nor "Hostname" fields
// If OpenStdin is set, then it differs // If OpenStdin is set, then it differs
func CompareConfig(a, b *Config) bool { func CompareConfig(a, b *Config) bool {