1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
This commit is contained in:
Andrea Luzzardi 2013-01-28 14:30:05 -08:00
parent 192446e796
commit 333abbf85a
4 changed files with 20 additions and 22 deletions

View file

@ -1,6 +1,7 @@
package docker
import (
"bytes"
"encoding/json"
"errors"
"io"
@ -9,10 +10,9 @@ import (
"os"
"os/exec"
"path"
"strings"
"syscall"
"time"
"strings"
"bytes"
)
type Container struct {
@ -98,7 +98,6 @@ func loadContainer(containerPath string) (*Container, error) {
return container, nil
}
func (container *Container) Cmd() *exec.Cmd {
return container.cmd
}
@ -135,7 +134,7 @@ func (container *Container) SetUserData(key, value string) error {
return container.saveUserData(data)
}
func (container *Container) GetUserData(key string) (string) {
func (container *Container) GetUserData(key string) string {
data, err := container.loadUserData()
if err != nil {
return ""
@ -146,7 +145,6 @@ func (container *Container) GetUserData(key string) (string) {
return ""
}
func (container *Container) save() (err error) {
data, err := json.Marshal(container)
if err != nil {
@ -226,7 +224,6 @@ func (container *Container) StdoutLog() io.Reader {
return strings.NewReader(container.stdoutLog.String())
}
func (container *Container) StderrPipe() (io.ReadCloser, error) {
reader, writer := io.Pipe()
container.stderr.AddWriter(writer)

View file

@ -3,13 +3,13 @@ package docker
import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"syscall"
"time"
"io"
"io/ioutil"
)
type Filesystem struct {
@ -104,7 +104,6 @@ func (fs *Filesystem) Tar() (io.Reader, error) {
return Tar(fs.RootFS)
}
func (fs *Filesystem) EnsureMounted() error {
if !fs.IsMounted() {
if err := fs.Mount(); err != nil {
@ -130,9 +129,12 @@ type Change struct {
func (change *Change) String() string {
var kind string
switch change.Kind {
case ChangeModify: kind = "C"
case ChangeAdd: kind = "A"
case ChangeDelete: kind = "D"
case ChangeModify:
kind = "C"
case ChangeAdd:
kind = "A"
case ChangeDelete:
kind = "D"
}
return fmt.Sprintf("%s %s", kind, change.Path)
}

View file

@ -1,10 +1,10 @@
package docker
import (
"sync"
"time"
"fmt"
"github.com/dotcloud/docker/future"
"sync"
"time"
)
type State struct {
@ -17,7 +17,6 @@ type State struct {
stateChangeCond *sync.Cond
}
func newState() *State {
lock := new(sync.Mutex)
return &State{

View file

@ -4,8 +4,8 @@ import (
"bytes"
"container/list"
"io"
"sync"
"os/exec"
"sync"
)
// Tar generates a tar archive from a filesystem path, and returns it as a stream.