-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
client: add GetVersion method for retrieving of etcdserver and etcdcluster information #6422
Conversation
@@ -104,6 +104,9 @@ type KeysAPI interface { | |||
// Get retrieves a set of Nodes from etcd | |||
Get(ctx context.Context, key string, opts *GetOptions) (*Response, error) | |||
|
|||
// GetVersion retrieves the current etcdserver and etcdcluster version | |||
GetVersion(ctx context.Context) ([]byte, error) |
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.
getversion should not be inside keys API. keys API is for key operations like put, get, delete.
@xiang90 updated as per your comments |
"golang.org/x/net/context" | ||
) | ||
|
||
type GenericClientAPI interface { |
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.
Can we add the Version method directly into Client interface?
@xiang90 updated the Version method to be in Client interface |
@@ -440,6 +444,29 @@ func (c *httpClusterClient) AutoSync(ctx context.Context, interval time.Duration | |||
} | |||
} | |||
|
|||
func (c *httpClusterClient) GetVersion(ctx context.Context) ([]byte, error) { |
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.
can we return a more structured result instead of raw bytes?
@xiang90 Updated to return version information in a struct instead of a byte array |
@etcd-bot test this please @shaunthium Can you squash commits into one? Thanks. |
@gyuho Have squashed the latest 2 commits into 1. Would you happen to know why my latest Semaphore build seems to fail? |
@shaunthium They haven't got squashed. We need to squash all commits into one, to make it easy to backport or revert. Could you try again? Thanks! |
…er version this adds a GetVersion method to the Client interface for retrieving information about the etcdserver and etcdcluster.
@gyuho Sorry about that, I thought you were just referring to my latest 2 commits. Have squashed all commits |
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.
Defer to @xiang90
Thanks
@xiang90 Think same feature could be useful for v3 as well. Especially for upgrades. What do you think? |
@shaunthium Closing this via #7222. We cherry-picked your patch in a separate PR. Thanks! |
As far as I can tell, currently there are methods to get key and node information, but not for getting version information (as one would get in the form of a request to say,
http://127.0.0.1:2379/version
). This adds a simpleGetVersion
method into theClient
interface to allow for this.