Skip to content

Commit 452f327

Browse files
committed
Readme: reword a paragraph so it's not misleading
The description of OnElected, OnOusting, and LeaderChanged are a bit misleading because of an interstitial clause. Rewrite that paragraph and break it up into two.
1 parent 74d2e6f commit 452f327

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ Currently, this implementation only has two implementations:
2020
The [`Config`] struct contains callbacks and tunables for the leader election
2121
"campaign".
2222

23-
Each process that would like to acquire leadership must register callbacks for
24-
all three of `OnElected`, `OnOusting` and `LeaderChanged`, as well as specify
25-
unique `LeaderID` and `HostPort`s (the latter two are used for communication, so
26-
some use-cases may be able to ignore them)
23+
Each "candidate" contending for leadership must register an `OnElected` callback
24+
and a `LeaderID` (which is often a random string). Additionally, it is
25+
recommended to specify `HostPort`, which makes it possible to leverage the
26+
`legrpc` and have other clients using the `WatchConfig{}.Watch()` method connect
27+
to the current leader. (it can also be useful for debugging)
28+
29+
Optionally, one can specify `LeaderChanged` and `OnOusting` callbacks which are
30+
called when a the current leader changes and an instance has lost its election,
31+
respectively.
2732

2833
The `TermLength` is the length of time that a leader acquires leadership for,
2934
and the length of any extension. This duration should be long enough to get

0 commit comments

Comments
 (0)