diff --git a/handler.go b/handler.go index 77dcb5700..b26fdefa8 100644 --- a/handler.go +++ b/handler.go @@ -58,6 +58,7 @@ func NewHandler() *Handler { return handler } +// NewRouter creates a Gorilla Mus http router func NewRouter(handler *Handler) *mux.Router { router := mux.NewRouter() router.HandleFunc("/index", handler.handleGetIndexes).Methods("GET") @@ -1315,6 +1316,7 @@ type QueryResponse struct { Err error } +// MarshalJSON marshals QueryResponse into a JSON-encoded byte slice func (resp *QueryResponse) MarshalJSON() ([]byte, error) { var output struct { Results []interface{} `json:"results,omitempty"` diff --git a/holder.go b/holder.go index 426817410..e8ef55483 100644 --- a/holder.go +++ b/holder.go @@ -356,7 +356,7 @@ type HolderSyncer struct { Closing <-chan struct{} } -// Returns true if the syncer has been marked to close. +// IsClosing returns true if the syncer has been marked to close. func (s *HolderSyncer) IsClosing() bool { select { case <-s.Closing: diff --git a/index.go b/index.go index 3fa8ac028..378f94ab7 100644 --- a/index.go +++ b/index.go @@ -250,6 +250,7 @@ func (i *Index) MaxSlice() uint64 { return max } +// SetRemoteMaxSlice sets the remote max slice value received from another node func (i *Index) SetRemoteMaxSlice(newmax uint64) { i.mu.Lock() defer i.mu.Unlock() @@ -273,6 +274,7 @@ func (i *Index) MaxInverseSlice() uint64 { return max } +// SetRemoteMaxInverseSlice sets the remote max inverse slice value received from another node func (i *Index) SetRemoteMaxInverseSlice(v uint64) { i.mu.Lock() defer i.mu.Unlock() diff --git a/pilosa.go b/pilosa.go index 16739fd7a..0b5532ff7 100644 --- a/pilosa.go +++ b/pilosa.go @@ -88,7 +88,7 @@ func decodeColumnAttrSet(pb *internal.ColumnAttrSet) *ColumnAttrSet { // TimeFormat is the go-style time format used to parse string dates. const TimeFormat = "2006-01-02T15:04" -// Restrict name using regex +// ValidateName restrict name using regex func ValidateName(name string) error { validName := nameRegexp.Match([]byte(name)) if validName == false { diff --git a/server.go b/server.go index 1b2f3fb87..e616d1bd9 100644 --- a/server.go +++ b/server.go @@ -281,13 +281,13 @@ func (s *Server) ReceiveMessage(pb proto.Message) error { return nil } -// Server implements StatusHandler. // LocalStatus returns the state of the local node as well as the // holder (indexes/frames) according to the local node. // In a gossip implementation, memberlist.Delegate.LocalState() uses this. +// Server implements StatusHandler. func (s *Server) LocalStatus() (proto.Message, error) { if s.Holder == nil { - return nil, errors.New("Server.Holder is nil.") + return nil, errors.New("Server.Holder is nil") } return &internal.NodeStatus{ Host: s.Host, diff --git a/stats.go b/stats.go index 1a6efe743..685a9ce3c 100644 --- a/stats.go +++ b/stats.go @@ -12,7 +12,7 @@ func init() { NopStatsClient = &nopStatsClient{} } -// Global expvar. +// Expvar Global expvar map. var Expvar = expvar.NewMap("index") // StatsClient represents a client to a stats server. @@ -39,9 +39,9 @@ type StatsClient interface { Timing(name string, value time.Duration) } +// NopStatsClient represents a client that doesn't do anything. var NopStatsClient StatsClient -// nopStatsClient represents a client that doesn't do anything. type nopStatsClient struct{} func (c *nopStatsClient) Tags() []string { return nil }