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