-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stats, stats items and stats slabs added #105
base: master
Are you sure you want to change the base?
Conversation
memcache/memcache.go
Outdated
@@ -307,6 +311,10 @@ func (c *Client) onItem(item *Item, fn func(*Client, *bufio.ReadWriter, *Item) e | |||
return nil | |||
} | |||
|
|||
//FlushAll Invalidates all existing cache items. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after // here and elsewhere
memcache/stats.go
Outdated
@@ -0,0 +1,474 @@ | |||
/* | |||
Copyright 2011 Google Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the need to repeatedly lock & unlock the mutex for each line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 items
andstats slabs
with struct types definitions