backend.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. }
  30. // ContainerStatsConfig holds information for configuring the runtime
  31. // behavior of a backend.ContainerStats() call.
  32. type ContainerStatsConfig struct {
  33. Stream bool
  34. OutStream io.Writer
  35. Version string
  36. }
  37. // ExecInspect holds information about a running process started
  38. // with docker exec.
  39. type ExecInspect struct {
  40. ID string
  41. Running bool
  42. ExitCode *int
  43. ProcessConfig *ExecProcessConfig
  44. OpenStdin bool
  45. OpenStderr bool
  46. OpenStdout bool
  47. CanRemove bool
  48. ContainerID string
  49. DetachKeys []byte
  50. }
  51. // ExecProcessConfig holds information about the exec process
  52. // running on the host.
  53. type ExecProcessConfig struct {
  54. Tty bool `json:"tty"`
  55. Entrypoint string `json:"entrypoint"`
  56. Arguments []string `json:"arguments"`
  57. Privileged *bool `json:"privileged,omitempty"`
  58. User string `json:"user,omitempty"`
  59. }
  60. // ContainerCommitConfig is a wrapper around
  61. // types.ContainerCommitConfig that also
  62. // transports configuration changes for a container.
  63. type ContainerCommitConfig struct {
  64. types.ContainerCommitConfig
  65. Changes []string
  66. }