backend.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. }