github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/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 7 "github.com/docker/docker/api/types" 8 "github.com/docker/docker/pkg/streamformatter" 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/sderr 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 // ContainerLogsConfig holds configs for logging operations. Exists 29 // for users of the backend to to pass it a logging configuration. 30 type ContainerLogsConfig struct { 31 types.ContainerLogsOptions 32 OutStream io.Writer 33 } 34 35 // ContainerStatsConfig holds information for configuring the runtime 36 // behavior of a backend.ContainerStats() call. 37 type ContainerStatsConfig struct { 38 Stream bool 39 OutStream io.Writer 40 Version string 41 } 42 43 // ExecInspect holds information about a running process started 44 // with docker exec. 45 type ExecInspect struct { 46 ID string 47 Running bool 48 ExitCode *int 49 ProcessConfig *ExecProcessConfig 50 OpenStdin bool 51 OpenStderr bool 52 OpenStdout bool 53 CanRemove bool 54 ContainerID string 55 DetachKeys []byte 56 Pid int 57 } 58 59 // ExecProcessConfig holds information about the exec process 60 // running on the host. 61 type ExecProcessConfig struct { 62 Tty bool `json:"tty"` 63 Entrypoint string `json:"entrypoint"` 64 Arguments []string `json:"arguments"` 65 Privileged *bool `json:"privileged,omitempty"` 66 User string `json:"user,omitempty"` 67 } 68 69 // ContainerCommitConfig is a wrapper around 70 // types.ContainerCommitConfig that also 71 // transports configuration changes for a container. 72 type ContainerCommitConfig struct { 73 types.ContainerCommitConfig 74 Changes []string 75 } 76 77 // ProgressWriter is an interface 78 // to transport progress streams. 79 type ProgressWriter struct { 80 Output io.Writer 81 StdoutFormatter *streamformatter.StdoutFormatter 82 StderrFormatter *streamformatter.StderrFormatter 83 ProgressReaderFunc func(io.ReadCloser) io.ReadCloser 84 }