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

session: remove session manager and add ttl #6172

Merged
merged 1 commit into from
Aug 15, 2016
Merged

Conversation

xiang90
Copy link
Contributor

@xiang90 xiang90 commented Aug 14, 2016

Add TTL support, and also remove the session manager.
The plan is to have a sessionClient that embeds a client with its session. So the client can inspect its session more easily.

@xiang90
Copy link
Contributor Author

xiang90 commented Aug 14, 2016

/cc @heyitsanthony

@@ -39,17 +39,14 @@ type Election struct {
}

// NewElection returns a new election on a given key prefix.
func NewElection(client *v3.Client, pfx string) *Election {
func NewElection(client *ClientWithSession, pfx string) *Election {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heyitsanthony Is this what you want? In your example, election only takes session as arg. But it is not enough since we still need to create keys by using the client for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiang90 Just NewElection(s *Session, pfx string). The Session can have a function func (s *Session) Client() *clientv3.Client { return s.client} for anything that needs to access etcd through the session. The ClientWithSession struct probably doesn't need to be part of the concurrency package.

if ttl <= 0 {
so.ttl = defaultSessionTTL
}
so.ttl = ttl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move above if?

@heyitsanthony
Copy link
Contributor

lgtm aside from broken ttl stuff

@xiang90 xiang90 force-pushed the session branch 4 times, most recently from f21712d to 9a53d2c Compare August 15, 2016 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants