Add GoDoc strings

pull/1294/head
Philip O'Toole 2015-01-07 00:10:46 -08:00
parent 6683643dde
commit f57f28f575
4 changed files with 10 additions and 4 deletions

View File

@ -197,7 +197,6 @@ func initServer(s *influxdb.Server, b *messaging.Broker) {
if err := s.Initialize(b.URL()); err != nil {
log.Fatalf("server initialization error: %s", err)
}
}
// opens the messaging client and attaches it to the server.

View File

@ -23,22 +23,25 @@ var (
ErrServerNotSpecified = errors.New("server not present")
)
// SeriesWriter defines the interface for the destination of the data.
type SeriesWriter interface {
WriteSeries(database, retentionPolicy, name string, tags map[string]string, timestamp time.Time, values map[string]interface{}) error
}
// Parser encapulates a Graphite Parser.
type Parser struct {
Separator string
LastEnabled bool
}
// NewParser returns a GraphiteParser instance.
func NewParser() *Parser {
p := Parser{}
p.Separator = "."
return &p
}
// returns err == io.EOF when we hit EOF without any further data
// Parse performs Graphite parsing of a single line.
func (p *Parser) Parse(line string) (*metric, error) {
// Break into 3 fields (name, value, timestamp).
fields := strings.Fields(line)
@ -79,6 +82,7 @@ func (p *Parser) Parse(line string) (*metric, error) {
return m, nil
}
// DecodeNameAndTags parses the name and tags of a single field of a Graphite datum.
func (p *Parser) DecodeNameAndTags(field string) (string, map[string]string, error) {
var (
name string
@ -115,6 +119,7 @@ func (p *Parser) DecodeNameAndTags(field string) (string, map[string]string, err
return name, tags, nil
}
// metric is a an internal type, used by the Graphite system.
type metric struct {
Name string
Tags map[string]string

View File

@ -49,6 +49,8 @@ func (t *TCPServer) ListenAndServe(iface string) error {
}()
return nil
}
// handleConnection services an individual TCP connection.
func (t *TCPServer) handleConnection(conn net.Conn) {
defer conn.Close()

View File

@ -26,8 +26,8 @@ func NewUDPServer(p *Parser, w SeriesWriter) *UDPServer {
return &u
}
// Start instructs the UdpGraphiteServer to start processing Graphite data
// on the given interface. iface must be in the form host:port
// ListenAndServer instructs the UDPServer to start processing Graphite data
// on the given interface. iface must be in the form host:port.
func (u *UDPServer) ListenAndServe(iface string) error {
if iface == "" { // Make sure we have an address
return ErrBindAddressRequired