Gets the etcd key in which the proclaimed value is stored. This is derived from the underlying lease, and thus may throw if the lease was not granted successfully.
elected is fired when the current instance becomes the leader.
error is fired if the underlying lease experiences an error. When this is emitted, the campaign has failed. You should handle this and create a new campaign if appropriate.
Updates the value announced by this candidate (without starting a new election). If this candidate is currently the leader, then the change will be seen on other consumers as well.
Resigns from the campaign. A new leader is elected if this instance was formerly the leader.
Helper function that returns a promise when the node becomes the leader.
If resign()
is called before this happens, the promise never resolves.
If an error is emitted, the promise is rejected.
Generated using TypeDoc
A Campaign is returned from Election.campaign. See the docs on that method for an example.