stats, stats items and stats slabs added#105
Conversation
memcache/memcache.go
Outdated
| return nil | ||
| } | ||
|
|
||
| //FlushAll Invalidates all existing cache items. |
There was a problem hiding this comment.
Space after // here and elsewhere
memcache/stats.go
Outdated
| @@ -0,0 +1,474 @@ | |||
| /* | |||
| Copyright 2011 Google Inc. | |||
There was a problem hiding this comment.
Wrong year, owner. Just say "Copyright 2019 gomemcache Authors"
memcache/stats.go
Outdated
|
|
||
| // ServerStats contains the general statistics from one server. | ||
| type ServerStats struct { | ||
| //ServerErr Error if can't get the stats information |
There was a problem hiding this comment.
Another space after //
Also, these should all be complete sentences (https://github.com/golang/go/wiki/CodeReviewComments#comment-sentences) ending in periods, correct capitalization, etc.
memcache/stats.go
Outdated
| mux.Lock() | ||
| defer mux.Unlock() | ||
| switch tkns[1] { | ||
| case "version": |
There was a problem hiding this comment.
This whole switch is pretty repetitive. Can we just struct tags on the struct above and instead use reflect? (ala encoding/json, etc)
There was a problem hiding this comment.
Thanks, it didn't occur to me to do it with reflection.
I converted the snake case stat name to camel case, and thats the name I use in the structs, and with that, I only have to call the method FieldByName
memcache/stats.go
Outdated
| return | ||
| } | ||
|
|
||
| func (server *ServerStats) parseStatValue(line string, mux *sync.Mutex) { |
There was a problem hiding this comment.
I don't see the need to repeatedly lock & unlock the mutex for each line.
There was a problem hiding this comment.
I remove the go routines for each line. I did some benchmarks and realized they were not necessary.
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
@googlebot I fixed it. |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
stats,stats itemsandstats slabswith struct types definitions