Documentation
¶
Overview ¶
Package progress writes and reads the progress stream that a long-running ocfp command produces, one JSON object per line.
Index ¶
Constants ¶
const WireContract = 1
WireContract is the version of the progress stream format. A reader compares the header's wireContract with this value before it trusts the rest of the stream.
Variables ¶
var ( // ErrHeaderFirst is returned when Encode runs before Header. ErrHeaderFirst = errors.New("progress: the header must be written first") // ErrNoHeader is returned when a stream does not begin with a header record. ErrNoHeader = errors.New("progress: stream does not begin with a header record") )
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code string
Code is a stable, machine-readable name for a refusal or failure.
const CodeOwnerRecordMissing Code = "OWNER_RECORD_MISSING"
CodeOwnerRecordMissing reports that the host has no owner record.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder reads records from a stream.
func NewDecoder ¶
NewDecoder returns a Decoder that reads from r.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder writes records as lines of JSON. It is safe for concurrent use, and a line is always written whole.
func NewEncoder ¶
NewEncoder returns an Encoder that writes to w and stamps records from c.
type Header ¶
type Header struct {
WireContract int `json:"wireContract"`
Producer string `json:"producer"`
Version string `json:"version"`
JobID string `json:"jobId,omitempty"`
}
Header is the body of the first record. It names the producer and the wire contract the rest of the stream follows.
type Record ¶
type Record struct {
Kind Kind `json:"kind"`
Seq int64 `json:"seq"`
Time time.Time `json:"time"`
Body json.RawMessage `json:"body"`
}
Record is one line of the stream. Seq is 0 for the header and counts up by one for every record after it.
type ResultBody ¶
type ResultBody struct {
ExitCode int `json:"exitCode"`
}
ResultBody is the body of the final record of a stream.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package progresstest holds golden progress streams for tests.
|
Package progresstest holds golden progress streams for tests. |