moby: github.com/moby/moby/pkg/jsonmessage Index | Files

package jsonmessage

import "github.com/moby/moby/pkg/jsonmessage"

Index

Package Files

jsonmessage.go

func DisplayJSONMessagesStream Uses

func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(*json.RawMessage)) error

DisplayJSONMessagesStream displays a json message stream from `in` to `out`, `isTerminal` describes if `out` is a terminal. If this is the case, it will print `\n` at the end of each line and move the cursor while displaying.

func DisplayJSONMessagesToStream Uses

func DisplayJSONMessagesToStream(in io.Reader, stream stream, auxCallback func(*json.RawMessage)) error

DisplayJSONMessagesToStream prints json messages to the output stream

type JSONError Uses

type JSONError struct {
    Code    int    `json:"code,omitempty"`
    Message string `json:"message,omitempty"`
}

JSONError wraps a concrete Code and Message, `Code` is is an integer error code, `Message` is the error message.

func (*JSONError) Error Uses

func (e *JSONError) Error() string

type JSONMessage Uses

type JSONMessage struct {
    Stream          string        `json:"stream,omitempty"`
    Status          string        `json:"status,omitempty"`
    Progress        *JSONProgress `json:"progressDetail,omitempty"`
    ProgressMessage string        `json:"progress,omitempty"` //deprecated
    ID              string        `json:"id,omitempty"`
    From            string        `json:"from,omitempty"`
    Time            int64         `json:"time,omitempty"`
    TimeNano        int64         `json:"timeNano,omitempty"`
    Error           *JSONError    `json:"errorDetail,omitempty"`
    ErrorMessage    string        `json:"error,omitempty"` //deprecated
    // Aux contains out-of-band data, such as digests for push signing and image id after building.
    Aux *json.RawMessage `json:"aux,omitempty"`
}

JSONMessage defines a message struct. It describes the created time, where it from, status, ID of the message. It's used for docker events.

func (*JSONMessage) Display Uses

func (jm *JSONMessage) Display(out io.Writer, termInfo termInfo) error

Display displays the JSONMessage to `out`. `termInfo` is non-nil if `out` is a terminal. If this is the case, it will erase the entire current line when displaying the progressbar.

type JSONProgress Uses

type JSONProgress struct {
    Current int64 `json:"current,omitempty"`
    Total   int64 `json:"total,omitempty"`
    Start   int64 `json:"start,omitempty"`
    // If true, don't show xB/yB
    HideCounts bool   `json:"hidecounts,omitempty"`
    Units      string `json:"units,omitempty"`
    // contains filtered or unexported fields
}

JSONProgress describes a Progress. terminalFd is the fd of the current terminal, Start is the initial value for the operation. Current is the current status and value of the progress made towards Total. Total is the end value describing when we made 100% progress for an operation.

func (*JSONProgress) String Uses

func (p *JSONProgress) String() string

Package jsonmessage imports 10 packages (graph) and is imported by 1 packages. Updated 2017-08-25. Refresh now. Tools for package owners.