backend.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // Package backend includes types to send information to server backends.
  2. package backend // import "github.com/docker/docker/api/types/backend"
  3. import (
  4. "io"
  5. "time"
  6. "github.com/docker/docker/api/types/container"
  7. )
  8. // ContainerAttachConfig holds the streams to use when connecting to a container to view logs.
  9. type ContainerAttachConfig struct {
  10. GetStreams func(multiplexed bool) (io.ReadCloser, io.Writer, io.Writer, error)
  11. UseStdin bool
  12. UseStdout bool
  13. UseStderr bool
  14. Logs bool
  15. Stream bool
  16. DetachKeys string
  17. // Used to signify that streams must be multiplexed by producer as endpoint can't manage multiple streams.
  18. // This is typically set by HTTP endpoint, while websocket can transport raw streams
  19. MuxStreams bool
  20. }
  21. // PartialLogMetaData provides meta data for a partial log message. Messages
  22. // exceeding a predefined size are split into chunks with this metadata. The
  23. // expectation is for the logger endpoints to assemble the chunks using this
  24. // metadata.
  25. type PartialLogMetaData struct {
  26. Last bool // true if this message is last of a partial
  27. ID string // identifies group of messages comprising a single record
  28. Ordinal int // ordering of message in partial group
  29. }
  30. // LogMessage is datastructure that represents piece of output produced by some
  31. // container. The Line member is a slice of an array whose contents can be
  32. // changed after a log driver's Log() method returns.
  33. type LogMessage struct {
  34. Line []byte
  35. Source string
  36. Timestamp time.Time
  37. Attrs []LogAttr
  38. PLogMetaData *PartialLogMetaData
  39. // Err is an error associated with a message. Completeness of a message
  40. // with Err is not expected, tho it may be partially complete (fields may
  41. // be missing, gibberish, or nil)
  42. Err error
  43. }
  44. // LogAttr is used to hold the extra attributes available in the log message.
  45. type LogAttr struct {
  46. Key string
  47. Value string
  48. }
  49. // LogSelector is a list of services and tasks that should be returned as part
  50. // of a log stream. It is similar to swarmapi.LogSelector, with the difference
  51. // that the names don't have to be resolved to IDs; this is mostly to avoid
  52. // accidents later where a swarmapi LogSelector might have been incorrectly
  53. // used verbatim (and to avoid the handler having to import swarmapi types)
  54. type LogSelector struct {
  55. Services []string
  56. Tasks []string
  57. }
  58. // ContainerStatsConfig holds information for configuring the runtime
  59. // behavior of a backend.ContainerStats() call.
  60. type ContainerStatsConfig struct {
  61. Stream bool
  62. OneShot bool
  63. OutStream io.Writer
  64. Version string
  65. }
  66. // ExecInspect holds information about a running process started
  67. // with docker exec.
  68. type ExecInspect struct {
  69. ID string
  70. Running bool
  71. ExitCode *int
  72. ProcessConfig *ExecProcessConfig
  73. OpenStdin bool
  74. OpenStderr bool
  75. OpenStdout bool
  76. CanRemove bool
  77. ContainerID string
  78. DetachKeys []byte
  79. Pid int
  80. }
  81. // ExecProcessConfig holds information about the exec process
  82. // running on the host.
  83. type ExecProcessConfig struct {
  84. Tty bool `json:"tty"`
  85. Entrypoint string `json:"entrypoint"`
  86. Arguments []string `json:"arguments"`
  87. Privileged *bool `json:"privileged,omitempty"`
  88. User string `json:"user,omitempty"`
  89. }
  90. // CreateImageConfig is the configuration for creating an image from a
  91. // container.
  92. type CreateImageConfig struct {
  93. Repo string
  94. Tag string
  95. Pause bool
  96. Author string
  97. Comment string
  98. Config *container.Config
  99. Changes []string
  100. }
  101. // CommitConfig is the configuration for creating an image as part of a build.
  102. type CommitConfig struct {
  103. Author string
  104. Comment string
  105. Config *container.Config
  106. ContainerConfig *container.Config
  107. ContainerID string
  108. ContainerMountLabel string
  109. ContainerOS string
  110. ParentImageID string
  111. }