github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/api/types/backend/backend.go (about)

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