This commit is contained in:
Solomon Hykes 2013-11-13 19:25:55 +00:00
parent 8e71391572
commit b00d5f0185
8 changed files with 66 additions and 68 deletions

View File

@ -50,7 +50,6 @@ func (eng *Engine) Register(name string, handler Handler) error {
return nil
}
// New initializes a new engine managing the directory specified at `root`.
// `root` is used to store containers and any other state private to the engine.
// Changing the contents of the root without executing a job will cause unspecified

View File

@ -1,9 +1,7 @@
package engine
type Hack map[string]interface{}
func (eng *Engine) Hack_GetGlobalVar(key string) interface{} {
if eng.hack == nil {
return nil

View File

@ -3,14 +3,14 @@ package engine
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"strconv"
"strings"
"fmt"
"sync"
"encoding/json"
"os"
)
// A job is the fundamental unit of work in the docker engine.
@ -106,13 +106,17 @@ func (job *Job) parseLines(src io.Reader, dst *[]string, limit int) {
func (job *Job) StdoutParseString(dst *string) {
lines := make([]string, 0, 1)
job.StdoutParseLines(&lines, 1)
job.onExit = append(job.onExit, func() { if len(lines) >= 1 { *dst = lines[0] }})
job.onExit = append(job.onExit, func() {
if len(lines) >= 1 {
*dst = lines[0]
}
})
}
func (job *Job) StderrParseString(dst *string) {
lines := make([]string, 0, 1)
job.StderrParseLines(&lines, 1)
job.onExit = append(job.onExit, func() { *dst = lines[0]; })
job.onExit = append(job.onExit, func() { *dst = lines[0] })
}
func (job *Job) StdoutPipe() io.ReadCloser {
@ -129,7 +133,6 @@ func (job *Job) StderrPipe() io.ReadCloser {
return r
}
func (job *Job) CallString() string {
return fmt.Sprintf("%s(%s)", job.Name, strings.Join(job.Args, ", "))
}

View File

@ -9,6 +9,7 @@ import (
"io"
"log"
"net"
"net/url"
"os"
"path/filepath"
"runtime"
@ -18,7 +19,6 @@ import (
"syscall"
"testing"
"time"
"net/url"
)
const (

View File

@ -74,7 +74,6 @@ func jobInitApi(job *engine.Job) string {
return "0"
}
func (srv *Server) ListenAndServe(job *engine.Job) string {
protoAddrs := job.Args
chErrors := make(chan error, len(protoAddrs))

View File

@ -2,8 +2,8 @@ package docker
import (
"github.com/dotcloud/docker/utils"
"strings"
"io/ioutil"
"strings"
"testing"
"time"
)

View File

@ -66,7 +66,6 @@ func mkServerFromEngine(eng *engine.Engine, t utils.Fataler) *Server {
return srv
}
func NewTestEngine(t utils.Fataler) *engine.Engine {
root, err := newTestDirectory(unitTestStoreBase)
if err != nil {