github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/api/types/backend/backend.go (about)

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