Documentation
¶
Overview ¶
Package bootblock recognizes the startup summary an application printed and reports the next one as a difference from it.
The two halves of a reload know different things. The application resolved the configuration, and is the only place the values and their winning places exist; api:cli-dev restarted the process, and is the only place that knows a restart happened. Rather than teach the application that reloads exist, the loop reads back what it printed.
The cost of that is here and nowhere else: the layout of a startup summary becomes something a program reads as well as a person. The scanner and the parser below are the only code that assumes anything about it, and a block they cannot read is passed through unchanged, which is the behavior it replaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Art = []string{
" .-. .-. ",
" .( ) ( ). ",
"( o o )",
"( \\___/ )",
" '-.__.___.__-'",
}
Art is the framework's popcorn mascot, and its first row is how a startup summary is found in a stream. Every row is padded to the same width so the summary text lines up beside it, and every glyph is ASCII so no terminal renders it at an unexpected width.
Functions ¶
Types ¶
type FactChange ¶
type FactChange struct{ Label, Old, New string }
FactChange is one thing the banner or the listening line said differently. These are not configuration keys, so they are reported above the tree rather than inside it.
func Facts ¶
func Facts(previous, current Report) []FactChange
Facts compares what the banner and the listening line reported. The start time is not among them: comparing it would make every reload a change.
type Kind ¶
type Kind int
Kind is what happened to one key between two summaries.
const ( // Changed covers a new value and a new winning place alike, because the // summary reports the place for the same reason it reports the value. Changed Kind = iota // Added is a key the previous summary did not report at all, which is what // enabling a gated section looks like from here. Added // Removed is a key this summary no longer reports. Removed )
type Report ¶
type Report struct {
Lines []string
Version string
Environment string
ConfigFile string
Listening string
Entries []pwtree.Entry
}
Report is one startup summary read back from what it printed. Lines is kept so a caller can print the summary rather than describe it, which is what the first one of a session gets.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner accumulates the lines of one startup summary as they arrive.
func (*Scanner) Feed ¶
Feed offers one line. taken reports that the line belonged to the summary and has been kept; complete reports that the summary ends here, with this line when it was taken and before it when it was not.