10682: Add comments to statsTicker.
authorTom Clegg <tom@curoverse.com>
Tue, 3 Jan 2017 15:34:27 +0000 (10:34 -0500)
committerTom Clegg <tom@curoverse.com>
Tue, 3 Jan 2017 15:34:27 +0000 (10:34 -0500)
services/keepstore/stats_ticker.go [moved from services/keepstore/stats.go with 75% similarity]

similarity index 75%
rename from services/keepstore/stats.go
rename to services/keepstore/stats_ticker.go
index e02eb3aeeef8095d0923b16098acc83682cabd0a..f3a79c68f3691e54bfee58f54a1f890a922c2273 100644 (file)
@@ -22,6 +22,9 @@ func (s *statsTicker) Tick(counters ...*uint64) {
        }
 }
 
+// TickErr increments the overall error counter, as well as the
+// ErrorCodes entry for the given errType. If err is nil, TickErr is a
+// no-op.
 func (s *statsTicker) TickErr(err error, errType string) {
        if err == nil {
                return
@@ -36,10 +39,12 @@ func (s *statsTicker) TickErr(err error, errType string) {
        s.lock.Unlock()
 }
 
+// TickInBytes increments the incoming byte counter by n.
 func (s *statsTicker) TickInBytes(n uint64) {
        atomic.AddUint64(&s.InBytes, n)
 }
 
+// TickOutBytes increments the outgoing byte counter by n.
 func (s *statsTicker) TickOutBytes(n uint64) {
        atomic.AddUint64(&s.OutBytes, n)
 }