github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/api/types/backend/backend.go (about) 1 // Package backend includes types to send information to server backends. 2 package backend 3 4 import ( 5 "io" 6 "time" 7 8 "github.com/docker/docker/api/types" 9 "github.com/docker/docker/api/types/container" 10 ) 11 12 // ContainerAttachConfig holds the streams to use when connecting to a container to view logs. 13 type ContainerAttachConfig struct { 14 GetStreams func() (io.ReadCloser, io.Writer, io.Writer, error) 15 UseStdin bool 16 UseStdout bool 17 UseStderr bool 18 Logs bool 19 Stream bool 20 DetachKeys string 21 22 // Used to signify that streams are multiplexed and therefore need a StdWriter to encode stdout/stderr messages accordingly. 23 // TODO @cpuguy83: This shouldn't be needed. It was only added so that http and websocket endpoints can use the same function, and the websocket function was not using a stdwriter prior to this change... 24 // HOWEVER, the websocket endpoint is using a single stream and SHOULD be encoded with stdout/stderr as is done for HTTP since it is still just a single stream. 25 // Since such a change is an API change unrelated to the current changeset we'll keep it as is here and change separately. 26 MuxStreams bool 27 } 28 29 // LogMessage is datastructure that represents piece of output produced by some 30 // container. The Line member is a slice of an array whose contents can be 31 // changed after a log driver's Log() method returns. 32 // changes to this struct need to be reflect in the reset method in 33 // daemon/logger/logger.go 34 type LogMessage struct { 35 Line []byte 36 Source string 37 Timestamp time.Time 38 Attrs LogAttributes 39 Partial bool 40 41 // Err is an error associated with a message. Completeness of a message 42 // with Err is not expected, tho it may be partially complete (fields may 43 // be missing, gibberish, or nil) 44 Err error 45 } 46 47 // LogAttributes is used to hold the extra attributes available in the log message 48 // Primarily used for converting the map type to string and sorting. 49 type LogAttributes map[string]string 50 51 // LogSelector is a list of services and tasks that should be returned as part 52 // of a log stream. It is similar to swarmapi.LogSelector, with the difference 53 // that the names don't have to be resolved to IDs; this is mostly to avoid 54 // accidents later where a swarmapi LogSelector might have been incorrectly 55 // used verbatim (and to avoid the handler having to import swarmapi types) 56 type LogSelector struct { 57 Services []string 58 Tasks []string 59 } 60 61 // ContainerStatsConfig holds information for configuring the runtime 62 // behavior of a backend.ContainerStats() call. 63 type ContainerStatsConfig struct { 64 Stream bool 65 OutStream io.Writer 66 Version string 67 } 68 69 // ExecInspect holds information about a running process started 70 // with docker exec. 71 type ExecInspect struct { 72 ID string 73 Running bool 74 ExitCode *int 75 ProcessConfig *ExecProcessConfig 76 OpenStdin bool 77 OpenStderr bool 78 OpenStdout bool 79 CanRemove bool 80 ContainerID string 81 DetachKeys []byte 82 Pid int 83 } 84 85 // ExecProcessConfig holds information about the exec process 86 // running on the host. 87 type ExecProcessConfig struct { 88 Tty bool `json:"tty"` 89 Entrypoint string `json:"entrypoint"` 90 Arguments []string `json:"arguments"` 91 Privileged *bool `json:"privileged,omitempty"` 92 User string `json:"user,omitempty"` 93 } 94 95 // ContainerCommitConfig is a wrapper around 96 // types.ContainerCommitConfig that also 97 // transports configuration changes for a container. 98 type ContainerCommitConfig struct { 99 types.ContainerCommitConfig 100 Changes []string 101 // TODO: ContainerConfig is only used by the dockerfile Builder, so remove it 102 // once the Builder has been updated to use a different interface 103 ContainerConfig *container.Config 104 }