Package io.etcd.jetcd
Interface Election
- All Superinterfaces:
AutoCloseable,CloseableClient
Interface of leader election client talking to etcd.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface of leadership notification listener. -
Method Summary
Modifier and TypeMethodDescriptioncampaign(ByteSequence electionName, long leaseId, ByteSequence proposal) Campaign waits to acquire leadership in an election, returning a leader key representing the leadership if successful.leader(ByteSequence electionName) Returns the current election proclamation, if any.voidobserve(ByteSequence electionName, Election.Listener listener) Listens to election proclamations in-order as made by the election's elected leaders.proclaim(LeaderKey leaderKey, ByteSequence proposal) Proclaim updates the leader's posted value with a new value.Resign releases election leadership so other campaigners may acquire leadership on the election.Methods inherited from interface io.etcd.jetcd.support.CloseableClient
close
-
Method Details
-
campaign
CompletableFuture<CampaignResponse> campaign(ByteSequence electionName, long leaseId, ByteSequence proposal) Campaign waits to acquire leadership in an election, returning a leader key representing the leadership if successful. The leader key can then be used to issue new values on the election, transactionally guard API requests on leadership still being held, and resign from the election.- Parameters:
electionName- election nameleaseId- lease identifierproposal- proposal- Returns:
- the response
-
proclaim
Proclaim updates the leader's posted value with a new value. Only active leader can change the value.- Parameters:
leaderKey- leader keyproposal- new proposal- Returns:
- the response
-
leader
Returns the current election proclamation, if any.- Parameters:
electionName- election name- Returns:
- the response
-
observe
Listens to election proclamations in-order as made by the election's elected leaders.- Parameters:
electionName- election namelistener- listener
-
resign
Resign releases election leadership so other campaigners may acquire leadership on the election.- Parameters:
leaderKey- leader key- Returns:
- the response
-