Interface ReplicatedVote

All Superinterfaces:
kalix.replicatedentity.ReplicatedData

public interface ReplicatedVote extends kalix.replicatedentity.ReplicatedData
A Vote replicated data type.

This replicated data type is used to allow all the nodes in a cluster to vote on a condition.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Get the current value for this node's vote.
    int
    Get the number of voters participating in the vote (ie, the number of nodes in the cluster).
    int
    Get the number of votes for.
    default boolean
    Has at least one node voted true?
    default boolean
    Have a majority of nodes voted true?
    default boolean
    Is the vote unanimous?
    vote(boolean vote)
    Update this node's vote to the given value.
  • Method Details

    • getSelfVote

      boolean getSelfVote()
      Get the current value for this node's vote.
      Returns:
      this node's vote
    • getVoters

      int getVoters()
      Get the number of voters participating in the vote (ie, the number of nodes in the cluster).
      Returns:
      the number of voters
    • getVotesFor

      int getVotesFor()
      Get the number of votes for.
      Returns:
      the number of votes for
    • vote

      ReplicatedVote vote(boolean vote)
      Update this node's vote to the given value.
      Parameters:
      vote - the vote this node is contributing
      Returns:
      a new vote, or this unchanged vote
    • isAtLeastOne

      default boolean isAtLeastOne()
      Has at least one node voted true?
      Returns:
      true if at least one node has voted true
    • isMajority

      default boolean isMajority()
      Have a majority of nodes voted true?
      Returns:
      true if more than half of the nodes have voted true
    • isUnanimous

      default boolean isUnanimous()
      Is the vote unanimous?
      Returns:
      true if all nodes have voted true