summaryrefslogtreecommitdiff
path: root/daemon/attach.go
diff options
context:
space:
mode:
authorLukas Waslowski <cr7pt0gr4ph7@gmail.com>2015-12-30 18:20:41 +0100
committerDavid Calavera <david.calavera@gmail.com>2016-02-08 11:30:57 -0500
commitdd93571c69cc5284f695a21d5504fb57b1a4891a (patch)
treed06f1ca6f95c2ad38e6060bfe010565da1fd9345 /daemon/attach.go
parente6573a5d18c3045fb021668f3c7539ffa52696fe (diff)
downloaddocker-dd93571c69cc5284f695a21d5504fb57b1a4891a.tar.gz
Decouple the "container" router from the actual daemon implementation.
This is done by moving the following types to api/types/config.go: - ContainersConfig - ContainerAttachWithLogsConfig - ContainerWsAttachWithLogsConfig - ContainerLogsConfig - ContainerStatsConfig Remove dependency on "version" package from types.ContainerStatsConfig. Decouple the "container" router from the "daemon/exec" implementation. * This is done by making daemon.ContainerExecInspect() return an interface{} value. The same trick is already used by daemon.ContainerInspect(). Improve documentation for router packages. Extract localRoute and router into separate files. Move local.router to image.imageRouter. Changes: - Move local/image.go to image/image_routes.go. - Move local/local.go to image/image.go - Rename router to imageRouter. - Simplify imports for image/image.go (remove alias for router package). Merge router/local package into router package. Decouple the "image" router from the actual daemon implementation. Add Daemon.GetNetworkByID and Daemon.GetNetworkByName. Decouple the "network" router from the actual daemon implementation. This is done by replacing the daemon.NetworkByName constant with an explicit GetNetworkByName method. Remove the unused Daemon.GetNetwork method and the associated constants NetworkByID and NetworkByName. Signed-off-by: Lukas Waslowski <cr7pt0gr4ph7@gmail.com> Signed-off-by: David Calavera <david.calavera@gmail.com>
Diffstat (limited to 'daemon/attach.go')
-rw-r--r--daemon/attach.go27
1 files changed, 3 insertions, 24 deletions
diff --git a/daemon/attach.go b/daemon/attach.go
index f0caf16996..aabc77082a 100644
--- a/daemon/attach.go
+++ b/daemon/attach.go
@@ -3,7 +3,6 @@ package daemon
import (
"fmt"
"io"
- "net/http"
"time"
"github.com/Sirupsen/logrus"
@@ -11,22 +10,11 @@ import (
"github.com/docker/docker/daemon/logger"
derr "github.com/docker/docker/errors"
"github.com/docker/docker/pkg/stdcopy"
+ "github.com/docker/engine-api/types/backend"
)
-// ContainerAttachWithLogsConfig holds the streams to use when connecting to a container to view logs.
-type ContainerAttachWithLogsConfig struct {
- Hijacker http.Hijacker
- Upgrade bool
- UseStdin bool
- UseStdout bool
- UseStderr bool
- Logs bool
- Stream bool
- DetachKeys []byte
-}
-
// ContainerAttachWithLogs attaches to logs according to the config passed in. See ContainerAttachWithLogsConfig.
-func (daemon *Daemon) ContainerAttachWithLogs(prefixOrName string, c *ContainerAttachWithLogsConfig) error {
+func (daemon *Daemon) ContainerAttachWithLogs(prefixOrName string, c *backend.ContainerAttachWithLogsConfig) error {
if c.Hijacker == nil {
return derr.ErrorCodeNoHijackConnection.WithArgs(prefixOrName)
}
@@ -82,17 +70,8 @@ func (daemon *Daemon) ContainerAttachWithLogs(prefixOrName string, c *ContainerA
return nil
}
-// ContainerWsAttachWithLogsConfig attach with websockets, since all
-// stream data is delegated to the websocket to handle there.
-type ContainerWsAttachWithLogsConfig struct {
- InStream io.ReadCloser
- OutStream, ErrStream io.Writer
- Logs, Stream bool
- DetachKeys []byte
-}
-
// ContainerWsAttachWithLogs websocket connection
-func (daemon *Daemon) ContainerWsAttachWithLogs(prefixOrName string, c *ContainerWsAttachWithLogsConfig) error {
+func (daemon *Daemon) ContainerWsAttachWithLogs(prefixOrName string, c *backend.ContainerWsAttachWithLogsConfig) error {
container, err := daemon.GetContainer(prefixOrName)
if err != nil {
return err