backend.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. import (
  6. "io"
  7. "github.com/docker/engine-api/types"
  8. )
  9. // ContainerAttachConfig holds the streams to use when connecting to a container to view logs.
  10. type ContainerAttachConfig struct {
  11. GetStreams func() (io.ReadCloser, io.Writer, io.Writer, error)
  12. UseStdin bool
  13. UseStdout bool
  14. UseStderr bool
  15. Logs bool
  16. Stream bool
  17. DetachKeys []byte
  18. // Used to signify that streams are multiplexed and therefore need a StdWriter to encode stdout/sderr messages accordingly.
  19. // 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...
  20. // 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.
  21. // Since such a change is an API change unrelated to the current changeset we'll keep it as is here and change separately.
  22. MuxStreams bool
  23. }
  24. // ContainerLogsConfig holds configs for logging operations. Exists
  25. // for users of the backend to to pass it a logging configuration.
  26. type ContainerLogsConfig struct {
  27. types.ContainerLogsOptions
  28. OutStream io.Writer
  29. Stop <-chan bool
  30. }
  31. // ContainerStatsConfig holds information for configuring the runtime
  32. // behavior of a backend.ContainerStats() call.
  33. type ContainerStatsConfig struct {
  34. Stream bool
  35. OutStream io.Writer
  36. Stop <-chan bool
  37. Version string
  38. }
  39. // ExecInspect holds information about a running process started
  40. // with docker exec.
  41. type ExecInspect struct {
  42. ID string
  43. Running bool
  44. ExitCode *int
  45. ProcessConfig *ExecProcessConfig
  46. OpenStdin bool
  47. OpenStderr bool
  48. OpenStdout bool
  49. CanRemove bool
  50. ContainerID string
  51. DetachKeys []byte
  52. }
  53. // ExecProcessConfig holds information about the exec process
  54. // running on the host.
  55. type ExecProcessConfig struct {
  56. Tty bool `json:"tty"`
  57. Entrypoint string `json:"entrypoint"`
  58. Arguments []string `json:"arguments"`
  59. Privileged *bool `json:"privileged,omitempty"`
  60. User string `json:"user,omitempty"`
  61. }