comment cleanup

This commit is contained in:
Michael Baird 2017-04-25 16:40:39 -05:00
parent fe0e8a3c5b
commit d2a7869142
9 changed files with 23 additions and 23 deletions

View file

@ -17,27 +17,27 @@ type NodeSet interface {
Open() error
}
// StaticNodeSet represents a basic NodeSet for testing
// StaticNodeSet represents a basic NodeSet for testing.
type StaticNodeSet struct {
nodes []*Node
}
// NewStaticNodeSet creates a static nodeset
// NewStaticNodeSet creates a statically defined NodeSet.
func NewStaticNodeSet() *StaticNodeSet {
return &StaticNodeSet{}
}
// Nodes implements the NodeSet interface and returns a list of nodes in the cluster
// Nodes implements the NodeSet interface and returns a list of nodes in the cluster.
func (s *StaticNodeSet) Nodes() []*Node {
return s.nodes
}
// Open implements the NodeSet interface to start network activity, but is a nop
// Open implements the NodeSet interface to start network activity, but for a static NodeSet it does nothing.
func (s *StaticNodeSet) Open() error {
return nil
}
// Join add nodes from the cluster to the NodeSet
// Join sets the NodeSet nodes to the slices of Nodes passed in.
func (s *StaticNodeSet) Join(nodes []*Node) error {
s.nodes = nodes
return nil
@ -89,10 +89,10 @@ type nopBroadcastReceiver struct{}
func (n *nopBroadcastReceiver) Start(b BroadcastHandler) error { return nil }
// NopBroadcastReceiver is a no op implementation of the BroadcastReceiver
// NopBroadcastReceiver is a no-op implementation of the BroadcastReceiver.
var NopBroadcastReceiver = &nopBroadcastReceiver{}
// Broadcast message types
// Broadcast message types.
const (
MessageTypeCreateSlice = 1
MessageTypeCreateIndex = 2
@ -101,7 +101,7 @@ const (
MessageTypeDeleteFrame = 5
)
// MarshalMessage encodes the protobuf message into a byte slice
// MarshalMessage encodes the protobuf message into a byte slice.
func MarshalMessage(m proto.Message) ([]byte, error) {
var typ uint8
switch obj := m.(type) {
@ -125,7 +125,7 @@ func MarshalMessage(m proto.Message) ([]byte, error) {
return append([]byte{typ}, buf...), nil
}
// UnmarshalMessage decodes the byte slice into a protobuf message
// UnmarshalMessage decodes the byte slice into a protobuf message.
func UnmarshalMessage(buf []byte) (proto.Message, error) {
typ, buf := buf[0], buf[1:]

View file

@ -195,7 +195,7 @@ func (c *RankCache) Invalidate() {
c.invalidate()
}
// Recalculate rebuilds the cache
// Recalculate rebuilds the cache.
func (c *RankCache) Recalculate() {
c.mu.Lock()
defer c.mu.Unlock()
@ -305,18 +305,18 @@ type PairHeap struct {
Pairs
}
// Less implemets the Sort interface
// Less implemets the Sort interface.
// reports whether the element with index i should sort before the element with index j.
func (p PairHeap) Less(i, j int) bool { return p.Pairs[i].Count < p.Pairs[j].Count }
// Push appends the element onto the Pair slice
// Push appends the element onto the Pair slice.
func (p *Pairs) Push(x interface{}) {
// Push and Pop use pointer receivers because they modify the slice's length,
// not just its contents.
*p = append(*p, x.(Pair))
}
// Pop removes the minimum element from the Pair slice
// Pop removes the minimum element from the Pair slice.
func (p *Pairs) Pop() interface{} {
old := *p
n := len(old)

View file

@ -315,7 +315,7 @@ func (c *Client) Import(ctx context.Context, index, frame string, slice uint64,
return nil
}
// MarshalImportPayload marshalls the import parameters into a protobuf byte slice
// MarshalImportPayload marshalls the import parameters into a protobuf byte slice.
func MarshalImportPayload(index, frame string, slice uint64, bits []Bit) ([]byte, error) {
// Separate row and column IDs to reduce allocations.
rowIDs := Bits(bits).RowIDs()

View file

@ -127,7 +127,7 @@ func NewCluster() *Cluster {
}
}
// NodeSetHosts returns the list of host strings for NodeSet members
// NodeSetHosts returns the list of host strings for NodeSet members.
func (c *Cluster) NodeSetHosts() []string {
if c.NodeSet == nil {
return []string{}
@ -154,7 +154,7 @@ func (c *Cluster) NodeStates() map[string]string {
return h
}
// Status returns the internal ClusterState representation.
// Status returns the internal ClusterStatus representation.
func (c *Cluster) Status() *internal.ClusterStatus {
return &internal.ClusterStatus{
Nodes: encodeClusterStatus(c.Nodes),

View file

@ -9,10 +9,10 @@ const (
// DefaultPort is the default port use with the hostname.
DefaultPort = "10101"
// DefaultClusterType sets the node intercommunication method
// DefaultClusterType sets the node intercommunication method.
DefaultClusterType = "static"
// DefaultInternalPort the port the nodes intercommunicate on
// DefaultInternalPort the port the nodes intercommunicate on.
DefaultInternalPort = "14000"
)

View file

@ -58,7 +58,7 @@ func NewHandler() *Handler {
return handler
}
// NewRouter creates a Gorilla Mus http router
// NewRouter creates a Gorilla Mux http router.
func NewRouter(handler *Handler) *mux.Router {
router := mux.NewRouter()
router.HandleFunc("/index", handler.handleGetIndexes).Methods("GET")

View file

@ -250,7 +250,7 @@ func (i *Index) MaxSlice() uint64 {
return max
}
// SetRemoteMaxSlice sets the remote max slice value received from another node
// SetRemoteMaxSlice sets the remote max slice value received from another node.
func (i *Index) SetRemoteMaxSlice(newmax uint64) {
i.mu.Lock()
defer i.mu.Unlock()
@ -274,7 +274,7 @@ func (i *Index) MaxInverseSlice() uint64 {
return max
}
// SetRemoteMaxInverseSlice sets the remote max inverse slice value received from another node
// 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()

View file

@ -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"
// ValidateName restrict name using regex
// ValidateName ensures that the name is a valid format.
func ValidateName(name string) error {
validName := nameRegexp.Match([]byte(name))
if validName == false {

View file

@ -12,7 +12,7 @@ func init() {
NopStatsClient = &nopStatsClient{}
}
// Expvar Global expvar map.
// Expvar global expvar map.
var Expvar = expvar.NewMap("index")
// StatsClient represents a client to a stats server.