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