Documentation
¶
Overview ¶
Package progress is how long operations report what they do. The code that does the work emits events and never prints; whoever drives it renders them.
The installer runs in a container of its own: it writes its events as JSON lines, and the runtime reads them back from its output with Writer.
Index ¶
Constants ¶
const ( Variable = "NEMO_PROGRESS" FormatJSON = "json" )
Variable is the environment variable by which the runtime asks the installer for its events as JSON lines, setting it to FormatJSON.
const ( // Installation is an action on an installation, its Message the action. Installation = "installation" // Images is the loading of the images into the target's daemon. Images = "images" // Output is a line the installer printed that is not an event. Output = "output" )
Groups of the events about something else than the objects an orchestrator creates.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
// Installation is the installation the event is about, stack/name: the
// runtime sets it on the events of the installer it runs.
Installation string `json:"installation,omitempty"`
Group string `json:"group"`
Item string `json:"item,omitempty"`
State State `json:"state"`
Current int64 `json:"current,omitempty"`
Total int64 `json:"total,omitempty"`
Message string `json:"message,omitempty"`
}
Event is one step of an operation, about one item of a group: a network, a volume, a service. Readers ignore the fields they do not know, so fields are only ever added.
type Sink ¶
type Sink interface {
Emit(Event)
}
Sink receives events.
func Installer ¶
Installer returns where an installer writes, as format, Variable's value, asks: the sink of its events and the writer of the error that ends it. For FormatJSON both are stdout, so that Writer reads the error after the events, in order; otherwise the events are text on stdout and the error goes to stderr.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer reads what an installer prints, its events as JSON lines, and emits them about its installation; any other line is an Output event.