clientv3/concurrency/election.go
func (e *Election) Resign(ctx context.Context) (err error) {
	if e.leaderSession == nil {
		return nil
	}
	client := e.session.Client()
	cmp := v3.Compare(v3.CreateRevision(e.leaderKey), "=", e.leaderRev)
	resp, err := client.Txn(ctx).If(cmp).Then(v3.OpDelete(e.leaderKey)).Commit()
	if err == nil {
		e.hdr = resp.Header
	}
	e.leaderKey = ""
	e.leaderSession = nil
	return err
}
func (e *Election) Resign(ctx context.Context) (err error) {
	if e.leaderSession == nil {
		return nil
	}
	client := e.session.Client()
	cmp := v3.Compare(v3.CreateRevision(e.leaderKey), "=", e.leaderRev)
	resp, err := client.Txn(ctx).If(cmp).Then(v3.OpDelete(e.leaderKey)).Commit()
	if err == nil {
		e.hdr = resp.Header
	}
	e.leaderKey = ""
	e.leaderSession = nil
	return err
}
func ( e * Election ) Resign ( ctx context . Context ) ( err error ) { if e . leaderSession == nil { return nil } client := e . session . Client ( ) cmp := v3 . Compare ( v3 . CreateRevision ( e . leaderKey ) , " " , e . leaderRev ) resp , err := client . Txn ( ctx ) . If ( cmp ) . Then ( v3 . OpDelete ( e . leaderKey ) ) . Commit ( ) if err == nil { e . hdr = resp . Header } e . leaderKey = " " e . leaderSession = nil return err }
// Resign lets a leader start a new election.
Resign lets a leader start a new election .