github.com/jwhonce/docker@v0.6.7-0.20190327063223-da823cf3a5a3/api/types/backend/backend.go (about) 1 // Package backend includes types to send information to server backends. 2 package backend // import "github.com/docker/docker/api/types/backend" 3 4 import ( 5 "io" 6 "time" 7 8 "github.com/docker/docker/api/types/container" 9 ) 10 11 // ContainerAttachConfig holds the streams to use when connecting to a container to view logs. 12 type ContainerAttachConfig struct { 13 GetStreams func() (io.ReadCloser, io.Writer, io.Writer, error) 14 UseStdin bool 15 UseStdout bool 16 UseStderr bool 17 Logs bool 18 Stream bool 19 DetachKeys string 20 21 // Used to signify that streams are multiplexed and therefore need a StdWriter to encode stdout/stderr messages accordingly. 22 // 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... 23 // 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. 24 // Since such a change is an API change unrelated to the current changeset we'll keep it as is here and change separately. 25 MuxStreams bool 26 } 27 28 // PartialLogMetaData provides meta data for a partial log message. Messages 29 // exceeding a predefined size are split into chunks with this metadata. The 30 // expectation is for the logger endpoints to assemble the chunks using this 31 // metadata. 32 type PartialLogMetaData struct { 33 Last bool //true if this message is last of a partial 34 ID string // identifies group of messages comprising a single record 35 Ordinal int // ordering of message in partial group 36 } 37 38 // LogMessage is datastructure that represents piece of output produced by some 39 // container. The Line member is a slice of an array whose contents can be 40 // changed after a log driver's Log() method returns. 41 // changes to this struct need to be reflect in the reset method in 42 // daemon/logger/logger.go 43 type LogMessage struct { 44 Line []byte 45 Source string 46 Timestamp time.Time 47 Attrs []LogAttr 48 PLogMetaData *PartialLogMetaData 49 50 // Err is an error associated with a message. Completeness of a message 51 // with Err is not expected, tho it may be partially complete (fields may 52 // be missing, gibberish, or nil) 53 Err error 54 } 55 56 // LogAttr is used to hold the extra attributes available in the log message. 57 type LogAttr struct { 58 Key string 59 Value string 60 } 61 62 // LogSelector is a list of services and tasks that should be returned as part 63 // of a log stream. It is similar to swarmapi.LogSelector, with the difference 64 // that the names don't have to be resolved to IDs; this is mostly to avoid 65 // accidents later where a swarmapi LogSelector might have been incorrectly 66 // used verbatim (and to avoid the handler having to import swarmapi types) 67 type LogSelector struct { 68 Services []string 69 Tasks []string 70 } 71 72 // ContainerStatsConfig holds information for configuring the runtime 73 // behavior of a backend.ContainerStats() call. 74 type ContainerStatsConfig struct { 75 Stream bool 76 OutStream io.Writer 77 Version string 78 } 79 80 // ExecInspect holds information about a running process started 81 // with docker exec. 82 type ExecInspect struct { 83 ID string 84 Running bool 85 ExitCode *int 86 ProcessConfig *ExecProcessConfig 87 OpenStdin bool 88 OpenStderr bool 89 OpenStdout bool 90 CanRemove bool 91 ContainerID string 92 DetachKeys []byte 93 Pid int 94 } 95 96 // ExecProcessConfig holds information about the exec process 97 // running on the host. 98 type ExecProcessConfig struct { 99 Tty bool `json:"tty"` 100 Entrypoint string `json:"entrypoint"` 101 Arguments []string `json:"arguments"` 102 Privileged *bool `json:"privileged,omitempty"` 103 User string `json:"user,omitempty"` 104 } 105 106 // CreateImageConfig is the configuration for creating an image from a 107 // container. 108 type CreateImageConfig struct { 109 Repo string 110 Tag string 111 Pause bool 112 Author string 113 Comment string 114 Config *container.Config 115 Changes []string 116 } 117 118 // CommitConfig is the configuration for creating an image as part of a build. 119 type CommitConfig struct { 120 Author string 121 Comment string 122 Config *container.Config 123 ContainerConfig *container.Config 124 ContainerID string 125 ContainerMountLabel string 126 ContainerOS string 127 ParentImageID string 128 }