mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #9999 from vimalk78/9377_document_election_api
clientv3/concurrency: Document Election API context parameter
This commit is contained in:
commit
001bbb97cc
@ -55,8 +55,16 @@ func ResumeElection(s *Session, pfx string, leaderKey string, leaderRev int64) *
|
||||
}
|
||||
}
|
||||
|
||||
// Campaign puts a value as eligible for the election. It blocks until
|
||||
// it is elected, an error occurs, or the context is cancelled.
|
||||
// Campaign puts a value as eligible for the election on the prefix
|
||||
// key.
|
||||
// Multiple sessions can participate in the election for the
|
||||
// same prefix, but only one can be the leader at a time.
|
||||
//
|
||||
// If the context is 'context.TODO()/context.Background()', the Campaign
|
||||
// will continue to be blocked for other keys to be deleted, unless server
|
||||
// returns a non-recoverable error (e.g. ErrCompacted).
|
||||
// Otherwise, until the context is not cancelled or timed-out, Campaign will
|
||||
// continue to be blocked until it becomes the leader.
|
||||
func (e *Election) Campaign(ctx context.Context, val string) error {
|
||||
s := e.session
|
||||
client := e.session.Client()
|
||||
|
Loading…
x
Reference in New Issue
Block a user