github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/api/types/backend/backend.go (about) 1 // Package backend includes types to send information to server backends. 2 // TODO(calavera): This package is pending of extraction to engine-api 3 // when the server package is clean of daemon dependencies. 4 package backend 5 6 import ( 7 "io" 8 9 "github.com/docker/docker/pkg/streamformatter" 10 "github.com/docker/engine-api/types" 11 ) 12 13 // ContainerAttachConfig holds the streams to use when connecting to a container to view logs. 14 type ContainerAttachConfig struct { 15 GetStreams func() (io.ReadCloser, io.Writer, io.Writer, error) 16 UseStdin bool 17 UseStdout bool 18 UseStderr bool 19 Logs bool 20 Stream bool 21 DetachKeys string 22 23 // Used to signify that streams are multiplexed and therefore need a StdWriter to encode stdout/sderr messages accordingly. 24 // 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... 25 // 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. 26 // Since such a change is an API change unrelated to the current changeset we'll keep it as is here and change separately. 27 MuxStreams bool 28 } 29 30 // ContainerLogsConfig holds configs for logging operations. Exists 31 // for users of the backend to to pass it a logging configuration. 32 type ContainerLogsConfig struct { 33 types.ContainerLogsOptions 34 OutStream io.Writer 35 } 36 37 // ContainerStatsConfig holds information for configuring the runtime 38 // behavior of a backend.ContainerStats() call. 39 type ContainerStatsConfig struct { 40 Stream bool 41 OutStream io.Writer 42 Version string 43 } 44 45 // ExecInspect holds information about a running process started 46 // with docker exec. 47 type ExecInspect struct { 48 ID string 49 Running bool 50 ExitCode *int 51 ProcessConfig *ExecProcessConfig 52 OpenStdin bool 53 OpenStderr bool 54 OpenStdout bool 55 CanRemove bool 56 ContainerID string 57 DetachKeys []byte 58 } 59 60 // ExecProcessConfig holds information about the exec process 61 // running on the host. 62 type ExecProcessConfig struct { 63 Tty bool `json:"tty"` 64 Entrypoint string `json:"entrypoint"` 65 Arguments []string `json:"arguments"` 66 Privileged *bool `json:"privileged,omitempty"` 67 User string `json:"user,omitempty"` 68 } 69 70 // ContainerCommitConfig is a wrapper around 71 // types.ContainerCommitConfig that also 72 // transports configuration changes for a container. 73 type ContainerCommitConfig struct { 74 types.ContainerCommitConfig 75 Changes []string 76 } 77 78 // ProgressWriter is an interface 79 // to transport progress streams. 80 type ProgressWriter struct { 81 Output io.Writer 82 StdoutFormatter *streamformatter.StdoutFormatter 83 StderrFormatter *streamformatter.StderrFormatter 84 ProgressReaderFunc func(io.ReadCloser) io.ReadCloser 85 }