Remove daemon dependency from api/server.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 1af76ef5970202bdbc7024d825c0fcfcc4ec6ede
Component: engine
This commit is contained in:
David Calavera
2016-02-10 15:16:59 -05:00
parent def405f4e4
commit 5c97141da9
7 changed files with 92 additions and 27 deletions

View File

@ -5,7 +5,6 @@ import (
"time"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/daemon/exec"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/version"
"github.com/docker/engine-api/types"
@ -15,7 +14,7 @@ import (
// execBackend includes functions to implement to provide exec functionality.
type execBackend interface {
ContainerExecCreate(config *types.ExecConfig) (string, error)
ContainerExecInspect(id string) (*exec.Config, error)
ContainerExecInspect(id string) (*backend.ExecInspect, error)
ContainerExecResize(name string, height, width int) error
ContainerExecStart(name string, stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) error
ExecExists(name string) (bool, error)

View File

@ -9,14 +9,6 @@ import (
"github.com/Sirupsen/logrus"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/server/router"
"github.com/docker/docker/api/server/router/build"
"github.com/docker/docker/api/server/router/container"
"github.com/docker/docker/api/server/router/image"
"github.com/docker/docker/api/server/router/network"
"github.com/docker/docker/api/server/router/system"
"github.com/docker/docker/api/server/router/volume"
"github.com/docker/docker/builder/dockerfile"
"github.com/docker/docker/daemon"
"github.com/docker/docker/pkg/authorization"
"github.com/docker/docker/utils"
"github.com/docker/go-connections/sockets"
@ -174,14 +166,11 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
}
}
// InitRouters initializes a list of routers for the server.
func (s *Server) InitRouters(d *daemon.Daemon) {
s.addRouter(container.NewRouter(d))
s.addRouter(image.NewRouter(d))
s.addRouter(network.NewRouter(d))
s.addRouter(system.NewRouter(d))
s.addRouter(volume.NewRouter(d))
s.addRouter(build.NewRouter(dockerfile.NewBuildManager(d)))
// AddRouters initializes a list of routers for the server.
func (s *Server) AddRouters(routers ...router.Router) {
for _, r := range routers {
s.addRouter(r)
}
}
// addRouter adds a new router to the server.
@ -231,13 +220,13 @@ func (s *Server) initRouterSwapper() {
// Reload reads configuration changes and modifies the
// server according to those changes.
// Currently, only the --debug configuration is taken into account.
func (s *Server) Reload(config *daemon.Config) {
func (s *Server) Reload(debug bool) {
debugEnabled := utils.IsDebugEnabled()
switch {
case debugEnabled && !config.Debug: // disable debug
case debugEnabled && !debug: // disable debug
utils.DisableDebug()
s.routerSwapper.Swap(s.createMux())
case config.Debug && !debugEnabled: // enable debug
case debug && !debugEnabled: // enable debug
utils.EnableDebug()
s.routerSwapper.Swap(s.createMux())
}

View File

@ -42,3 +42,28 @@ type ContainerStatsConfig struct {
Stop <-chan bool
Version string
}
// ExecInspect holds information about a running process started
// with docker exec.
type ExecInspect struct {
ID string
Running bool
ExitCode *int
ProcessConfig *ExecProcessConfig
OpenStdin bool
OpenStderr bool
OpenStdout bool
CanRemove bool
ContainerID string
DetachKeys []byte
}
// ExecProcessConfig holds information about the exec process
// running on the host.
type ExecProcessConfig struct {
Tty bool `json:"tty"`
Entrypoint string `json:"entrypoint"`
Arguments []string `json:"arguments"`
Privileged *bool `json:"privileged,omitempty"`
User string `json:"user,omitempty"`
}