Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jtorz
Copy link

@jtorz jtorz commented Jul 13, 2019

  • support for the commands stats, stats items and stats slabs with struct types definitions
  • (c *Client) FlushAll() description

@@ -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.
Copy link
Owner

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

@@ -0,0 +1,474 @@
/*
Copyright 2011 Google Inc.
Copy link
Owner

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"


// ServerStats contains the general statistics from one server.
type ServerStats struct {
//ServerErr Error if can't get the stats information
Copy link
Owner

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.

mux.Lock()
defer mux.Unlock()
switch tkns[1] {
case "version":
Copy link
Owner

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)

Copy link
Author

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

return
}

func (server *ServerStats) parseStatValue(line string, mux *sync.Mutex) {
Copy link
Owner

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.

Copy link
Author

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.

@googlebot
Copy link

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.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@jtorz
Copy link
Author

jtorz commented Oct 13, 2019

@googlebot I fixed it.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@jtorz jtorz requested a review from bradfitz October 13, 2019 07:15
@bradfitz bradfitz removed the cla: yes label Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants