Package io.etcd.jetcd

Interface Election

All Superinterfaces:
AutoCloseable, CloseableClient

public interface Election extends CloseableClient
Interface of leader election client talking to etcd.
  • 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 name
      leaseId - lease identifier
      proposal - proposal
      Returns:
      the response
    • proclaim

      CompletableFuture<ProclaimResponse> proclaim(LeaderKey leaderKey, ByteSequence proposal)
      Proclaim updates the leader's posted value with a new value. Only active leader can change the value.
      Parameters:
      leaderKey - leader key
      proposal - new proposal
      Returns:
      the response
    • leader

      Returns the current election proclamation, if any.
      Parameters:
      electionName - election name
      Returns:
      the response
    • observe

      void observe(ByteSequence electionName, Election.Listener listener)
      Listens to election proclamations in-order as made by the election's elected leaders.
      Parameters:
      electionName - election name
      listener - listener
    • resign

      Resign releases election leadership so other campaigners may acquire leadership on the election.
      Parameters:
      leaderKey - leader key
      Returns:
      the response