Hi!
I am confused how to use the following service in order to implement a simple leader election logic. Basically I have 5 nodes, that start with a leader election. Every 30 seconds leadership expires and nodes need to elect a new leader while doing their normal job (for example some computations).
So, we have 5 services:
- Campaign
- Proclaim
- Leader
- Observe
- Resign
I do have idea how to implement leader election by creating a leader key, then lease, etc., but I have no idea what those services are for. In other words, except some guesses:
Campaign : starts elections
Proclaim: ????? takes a value but why?
Leader: I though it returns a Leader id but proto file LeaderResponse says kv and header????
....
How should I use them to create the following basic loop?
loop until (shutdown signal is received) do
try to acquire leadership
if successful then
announce the leadership
do leader and normal node job until time expires
else
do normal node job until current leadership expires
endif
end
Best.