Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FormatterConstructors = map[string]FormatterConstructor{}
Functions ¶
This section is empty.
Types ¶
type FormatterConstructor ¶
type FormatterConstructor func(maxRows int64, includeHeader bool) LineFormatter
type GridLineFormatter ¶
type GridLineFormatter struct { *text.GridWriter // contains filtered or unexported fields }
GridLineFormatter uses a text.GridWriter to format the StatLines as a grid
func (*GridLineFormatter) Finish ¶
func (glf *GridLineFormatter) Finish()
func (*GridLineFormatter) FormatLines ¶
func (glf *GridLineFormatter) FormatLines(lines []*line.StatLine, headerKeys []string, keyNames map[string]string) string
FormatLines formats the StatLines as a grid
func (GridLineFormatter) IsFinished ¶
func (lf GridLineFormatter) IsFinished() bool
type InteractiveLineFormatter ¶
InteractiveLineFormatter produces ncurses-style output
func (*InteractiveLineFormatter) Finish ¶
func (ilf *InteractiveLineFormatter) Finish()
func (*InteractiveLineFormatter) FormatLines ¶
func (ilf *InteractiveLineFormatter) FormatLines(lines []*line.StatLine, headerKeys []string, keyNames map[string]string) string
FormatLines formats the StatLines as a table in the terminal ui
func (InteractiveLineFormatter) IsFinished ¶
func (lf InteractiveLineFormatter) IsFinished() bool
type JSONLineFormatter ¶
type JSONLineFormatter struct {
// contains filtered or unexported fields
}
JSONLineFormatter converts the StatLines to JSON
func (*JSONLineFormatter) Finish ¶
func (glf *JSONLineFormatter) Finish()
func (*JSONLineFormatter) FormatLines ¶
func (jlf *JSONLineFormatter) FormatLines(lines []*line.StatLine, headerKeys []string, keyNames map[string]string) string
FormatLines formats the StatLines as JSON
func (JSONLineFormatter) IsFinished ¶
func (lf JSONLineFormatter) IsFinished() bool
type LineFormatter ¶
type LineFormatter interface { // FormatLines returns the string representation of the StatLines that are passed in. FormatLines(lines []*line.StatLine, headerKeys []string, keyNames map[string]string) string // IsFinished returns true iff the formatter cannot print any more data IsFinished() bool // Finish() is called when mongostat is shutting down so that the formatter can clean up Finish() }
A LineFormatter formats StatLines for printing.
func NewGridLineFormatter ¶
func NewGridLineFormatter(maxRows int64, includeHeader bool) LineFormatter
func NewInteractiveLineFormatter ¶
func NewInteractiveLineFormatter(_ int64, includeHeader bool) LineFormatter
func NewJSONLineFormatter ¶
func NewJSONLineFormatter(maxRows int64, _ bool) LineFormatter
type StatConsumer ¶
type StatConsumer struct {
// contains filtered or unexported fields
}
StatConsumer maintains the current set of headers and the most recent ServerStatus for each host. It creates a StatLine when passed a new record and can format and write groups of StatLines.
func NewStatConsumer ¶
func NewStatConsumer(flags int, customHeaders []string, keyNames map[string]string, readerConfig *status.ReaderConfig, formatter LineFormatter, writer io.Writer) (sc *StatConsumer)
NewStatConsumer creates a new StatConsumer with no previous records
func (*StatConsumer) FormatLines ¶
func (sc *StatConsumer) FormatLines(lines []*line.StatLine) bool
FormatLines consumes StatLines, formats them, and sends them to its writer It returns true if the formatter should no longer receive data
func (*StatConsumer) Update ¶
func (sc *StatConsumer) Update(newStat *status.ServerStatus) (l *line.StatLine, seen bool)
Update takes in a ServerStatus and returns a StatLine if it has a previous record