diff --git a/cmd/influx/cli/cli.go b/cmd/influx/cli/cli.go index 90dd1a1397..b0be8e2c78 100644 --- a/cmd/influx/cli/cli.go +++ b/cmd/influx/cli/cli.go @@ -1,3 +1,4 @@ +// Package cli contains the logic of the influx command line client. package cli // import "github.com/influxdata/influxdb/cmd/influx/cli" import ( @@ -34,7 +35,7 @@ const ( // ErrBlankCommand is returned when a parsed command is empty. var ErrBlankCommand = errors.New("empty input") -// CommandLine holds CLI configuration and state +// CommandLine holds CLI configuration and state. type CommandLine struct { Line *liner.State Host string @@ -61,7 +62,7 @@ type CommandLine struct { ImporterConfig v8.Config // Importer configuration options. } -// New returns an instance of CommandLine +// New returns an instance of CommandLine with the specified client version. func New(version string) *CommandLine { return &CommandLine{ ClientVersion: version, @@ -70,7 +71,7 @@ func New(version string) *CommandLine { } } -// Run executes the CLI +// Run executes the CLI. func (c *CommandLine) Run() error { hasTTY := c.ForceTTY || terminal.IsTerminal(int(os.Stdin.Fd())) @@ -221,7 +222,8 @@ func (c *CommandLine) mainLoop() error { } } -// ParseCommand parses an instruction and calls related method, if any +// ParseCommand parses an instruction and calls the related method +// or executes the command as a query against InfluxDB. func (c *CommandLine) ParseCommand(cmd string) error { lcmd := strings.TrimSpace(strings.ToLower(cmd)) tokens := strings.Fields(lcmd) @@ -270,7 +272,7 @@ func (c *CommandLine) ParseCommand(cmd string) error { return ErrBlankCommand } -// Connect connects client to a server +// Connect connects to a server. func (c *CommandLine) Connect(cmd string) error { // Remove the "connect" keyword if it exists addr := strings.TrimSpace(strings.Replace(cmd, "connect", "", -1)) @@ -312,7 +314,7 @@ func (c *CommandLine) Connect(cmd string) error { return nil } -// SetAuth sets client authentication credentials +// SetAuth sets client authentication credentials. func (c *CommandLine) SetAuth(cmd string) { // If they pass in the entire command, we should parse it // auth @@ -482,7 +484,7 @@ func (c *CommandLine) retentionPolicyExists(db, rp string) bool { return true } -// SetPrecision sets client precision +// SetPrecision sets client precision. func (c *CommandLine) SetPrecision(cmd string) { // normalize cmd cmd = strings.ToLower(cmd) @@ -502,7 +504,7 @@ func (c *CommandLine) SetPrecision(cmd string) { } } -// SetFormat sets output format +// SetFormat sets output format. func (c *CommandLine) SetFormat(cmd string) { // Remove the "format" keyword if it exists cmd = strings.TrimSpace(strings.Replace(cmd, "format", "", -1)) @@ -517,7 +519,7 @@ func (c *CommandLine) SetFormat(cmd string) { } } -// SetWriteConsistency sets cluster consistency level +// SetWriteConsistency sets write consistency level. func (c *CommandLine) SetWriteConsistency(cmd string) { // Remove the "consistency" keyword if it exists cmd = strings.TrimSpace(strings.Replace(cmd, "consistency", "", -1)) @@ -630,7 +632,7 @@ func (c *CommandLine) parseInsert(stmt string) (*client.BatchPoints, error) { }, nil } -// Insert runs an INSERT statement +// Insert runs an INSERT statement. func (c *CommandLine) Insert(stmt string) error { bp, err := c.parseInsert(stmt) if err != nil { @@ -657,7 +659,7 @@ func (c *CommandLine) query(query string) client.Query { } } -// ExecuteQuery runs any query statement +// ExecuteQuery runs any query statement. func (c *CommandLine) ExecuteQuery(query string) error { // If we have a retention policy, we need to rewrite the statement sources if c.RetentionPolicy != "" { @@ -699,7 +701,7 @@ func (c *CommandLine) ExecuteQuery(query string) error { return nil } -// DatabaseToken retrieves database token +// DatabaseToken retrieves database token. func (c *CommandLine) DatabaseToken() (string, error) { response, err := c.Client.Query(c.query("SHOW DIAGNOSTICS for 'registration'")) if err != nil { @@ -719,7 +721,7 @@ func (c *CommandLine) DatabaseToken() (string, error) { return "", nil } -// FormatResponse formats output to previsouly chosen format +// FormatResponse formats output to the previously chosen format. func (c *CommandLine) FormatResponse(response *client.Response, w io.Writer) { switch c.Format { case "json": @@ -874,7 +876,7 @@ func interfaceToString(v interface{}) string { } } -// Settings prints current settings +// Settings prints current settings. func (c *CommandLine) Settings() { w := new(tabwriter.Writer) w.Init(os.Stdout, 0, 1, 1, ' ', 0) @@ -992,7 +994,7 @@ func (c *CommandLine) gopher() { `) } -// Version prints CLI version +// Version prints the CLI version. func (c *CommandLine) Version() { fmt.Println("InfluxDB shell version:", c.ClientVersion) } diff --git a/cmd/influx/main.go b/cmd/influx/main.go index 7d8bccef0c..e00d018162 100644 --- a/cmd/influx/main.go +++ b/cmd/influx/main.go @@ -1,3 +1,4 @@ +// The influx command is a CLI client to InfluxDB. package main import ( diff --git a/cmd/influx_inspect/dumptsm/dumptsm.go b/cmd/influx_inspect/dumptsm/dumptsm.go index c766e314af..f1a278a089 100644 --- a/cmd/influx_inspect/dumptsm/dumptsm.go +++ b/cmd/influx_inspect/dumptsm/dumptsm.go @@ -1,3 +1,4 @@ +// Package dumptsm inspects low-level details about tsm1 files. package dumptsm import ( diff --git a/cmd/influx_inspect/export/export.go b/cmd/influx_inspect/export/export.go index 9a928094e5..e352c1e45b 100644 --- a/cmd/influx_inspect/export/export.go +++ b/cmd/influx_inspect/export/export.go @@ -1,3 +1,4 @@ +// Package export exports TSM files into InfluxDB line protocol format. package export import ( diff --git a/cmd/influx_inspect/help/help.go b/cmd/influx_inspect/help/help.go index ee238c3993..ff03389ddb 100644 --- a/cmd/influx_inspect/help/help.go +++ b/cmd/influx_inspect/help/help.go @@ -1,3 +1,4 @@ +// Package help contains the help for the influx_inspect command. package help import ( diff --git a/cmd/influx_inspect/main.go b/cmd/influx_inspect/main.go index 028d626bd0..02406a9f51 100644 --- a/cmd/influx_inspect/main.go +++ b/cmd/influx_inspect/main.go @@ -1,3 +1,4 @@ +// The influx_inspect command displays detailed information about InfluxDB data files. package main import ( @@ -16,7 +17,6 @@ import ( ) func main() { - m := NewMain() if err := m.Run(os.Args[1:]...); err != nil { fmt.Fprintln(os.Stderr, err) @@ -33,7 +33,7 @@ type Main struct { Stderr io.Writer } -// NewMain return a new instance of Main. +// NewMain returns a new instance of Main. func NewMain() *Main { return &Main{ Logger: log.New(os.Stderr, "[influx_inspect] ", log.LstdFlags), diff --git a/cmd/influx_inspect/report/report.go b/cmd/influx_inspect/report/report.go index 248250c6bc..9accf9bdbb 100644 --- a/cmd/influx_inspect/report/report.go +++ b/cmd/influx_inspect/report/report.go @@ -1,3 +1,4 @@ +// Package report reports statistics about TSM files. package report import ( diff --git a/cmd/influx_inspect/verify/verify.go b/cmd/influx_inspect/verify/verify.go index fb9ec5c7cf..4323d39872 100644 --- a/cmd/influx_inspect/verify/verify.go +++ b/cmd/influx_inspect/verify/verify.go @@ -1,3 +1,4 @@ +// Package verify verifies integrity of TSM files. package verify import ( diff --git a/cmd/influx_stress/influx_stress.go b/cmd/influx_stress/influx_stress.go index 31c2b16708..5186d18a92 100644 --- a/cmd/influx_stress/influx_stress.go +++ b/cmd/influx_stress/influx_stress.go @@ -1,3 +1,4 @@ +// Command influx_stress is deprecated; use github.com/influxdata/influx-stress instead. package main import ( diff --git a/cmd/influx_tsm/b1/reader.go b/cmd/influx_tsm/b1/reader.go index 50e41b0694..0ed844f5f2 100644 --- a/cmd/influx_tsm/b1/reader.go +++ b/cmd/influx_tsm/b1/reader.go @@ -1,3 +1,4 @@ +// Package b1 reads data from b1 shards. package b1 // import "github.com/influxdata/influxdb/cmd/influx_tsm/b1" import ( diff --git a/cmd/influx_tsm/bz1/reader.go b/cmd/influx_tsm/bz1/reader.go index eb65c29bea..b369aff22c 100644 --- a/cmd/influx_tsm/bz1/reader.go +++ b/cmd/influx_tsm/bz1/reader.go @@ -1,3 +1,4 @@ +// Package bz1 reads data from bz1 shards. package bz1 // import "github.com/influxdata/influxdb/cmd/influx_tsm/bz1" import ( diff --git a/cmd/influx_tsm/main.go b/cmd/influx_tsm/main.go index 77f0d43833..d66994376c 100644 --- a/cmd/influx_tsm/main.go +++ b/cmd/influx_tsm/main.go @@ -1,3 +1,5 @@ +// Command influx_tsm converts b1 or bz1 shards (from InfluxDB releases earlier than v0.11) +// to the current tsm1 format. package main import ( diff --git a/cmd/influx_tsm/stats/stats.go b/cmd/influx_tsm/stats/stats.go index 38c5a645bf..c3a7d3b935 100644 --- a/cmd/influx_tsm/stats/stats.go +++ b/cmd/influx_tsm/stats/stats.go @@ -1,3 +1,4 @@ +// Package stats contains statistics for converting non-TSM shards to TSM. package stats import ( diff --git a/cmd/influx_tsm/tsdb/database.go b/cmd/influx_tsm/tsdb/database.go index f85322e765..bb2513145d 100644 --- a/cmd/influx_tsm/tsdb/database.go +++ b/cmd/influx_tsm/tsdb/database.go @@ -1,3 +1,4 @@ +// Pacage tsdb abstracts the various shard types supported by the influx_tsm command. package tsdb // import "github.com/influxdata/influxdb/cmd/influx_tsm/tsdb" import ( diff --git a/cmd/influxd/backup/backup.go b/cmd/influxd/backup/backup.go index a3564cbdd9..5ba5069190 100644 --- a/cmd/influxd/backup/backup.go +++ b/cmd/influxd/backup/backup.go @@ -1,3 +1,4 @@ +// Package backup is the backup subcommand for the influxd command. package backup import ( diff --git a/cmd/influxd/help/help.go b/cmd/influxd/help/help.go index 34fddeb0ca..67c8cc993b 100644 --- a/cmd/influxd/help/help.go +++ b/cmd/influxd/help/help.go @@ -1,3 +1,4 @@ +// Package help is the help subcommand of the influxd command. package help import ( diff --git a/cmd/influxd/main.go b/cmd/influxd/main.go index 8859d12eaf..3aeb7b8d7a 100644 --- a/cmd/influxd/main.go +++ b/cmd/influxd/main.go @@ -1,3 +1,4 @@ +// Command influxd is the InfluxDB server. package main import ( diff --git a/cmd/influxd/restore/restore.go b/cmd/influxd/restore/restore.go index dda2a42a45..87f1f44079 100644 --- a/cmd/influxd/restore/restore.go +++ b/cmd/influxd/restore/restore.go @@ -1,3 +1,5 @@ +// Package restore is the restore subcommand for the influxd command, +// for restoring from a backup. package restore import ( diff --git a/cmd/influxd/run/command.go b/cmd/influxd/run/command.go index 6f10fb2575..66a0192900 100644 --- a/cmd/influxd/run/command.go +++ b/cmd/influxd/run/command.go @@ -1,3 +1,4 @@ +// Package run is the run (default) subcommand for the influxd command. package run import ( @@ -186,7 +187,7 @@ func (cmd *Command) writePIDFile(path string) error { } // ParseConfig parses the config at path. -// Returns a demo configuration if path is blank. +// It returns a demo configuration if path is blank. func (cmd *Command) ParseConfig(path string) (*Config, error) { // Use demo configuration if no config path is specified. if path == "" { @@ -204,7 +205,7 @@ func (cmd *Command) ParseConfig(path string) (*Config, error) { return config, nil } -var usage = `Runs the InfluxDB server. +const usage = `Runs the InfluxDB server. Usage: influxd run [flags] diff --git a/cmd/influxd/run/config.go b/cmd/influxd/run/config.go index 71e3d6a71c..f8deef55ec 100644 --- a/cmd/influxd/run/config.go +++ b/cmd/influxd/run/config.go @@ -110,8 +110,8 @@ func NewDemoConfig() (*Config, error) { } // trimBOM trims the Byte-Order-Marks from the beginning of the file. -// this is for Windows compatability only. -// see https://github.com/influxdata/telegraf/issues/1378 +// This is for Windows compatability only. +// See https://github.com/influxdata/telegraf/issues/1378. func trimBOM(f []byte) []byte { return bytes.TrimPrefix(f, []byte("\xef\xbb\xbf")) } diff --git a/cmd/influxd/run/server.go b/cmd/influxd/run/server.go index e462f89610..f0ed86beed 100644 --- a/cmd/influxd/run/server.go +++ b/cmd/influxd/run/server.go @@ -201,6 +201,7 @@ func NewServer(c *Config, buildInfo *BuildInfo) (*Server, error) { return s, nil } +// Statistics returns statistics for the services running in the Server. func (s *Server) Statistics(tags map[string]string) []models.Statistic { var statistics []models.Statistic statistics = append(statistics, s.QueryExecutor.Statistics(tags)...) diff --git a/cmd/parse.go b/cmd/parse.go index 688f378b7b..7b140edf81 100644 --- a/cmd/parse.go +++ b/cmd/parse.go @@ -1,3 +1,4 @@ +// Package cmd is the root package of the various command-line utilities for InfluxDB. package cmd import "strings"