Interface Vote

  • All Superinterfaces:
    Crdt

    public interface Vote
    extends Crdt
    A Vote CRDT.

    This CRDT is used to allow all the nodes in a cluster to vote on a condition.

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean getSelfVote()
      Get the current value for this nodes vote.
      int getVoters()
      Get the number of voters participating in the vote (ie, the number of nodes in the cluster).
      int getVotesFor()
      Get the number of votes for.
      default boolean isAtLeastOne()
      Has at least one node voted true?
      default boolean isMajority()
      Have a majority of nodes voted true?
      default boolean isUnanimous()
      Is the vote unanimous?
      void vote​(boolean vote)
      Update this nodes vote to the given value.
    • Method Detail

      • getSelfVote

        boolean getSelfVote()
        Get the current value for this nodes vote.
        Returns:
        This nodes 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

        void vote​(boolean vote)
        Update this nodes vote to the given value.
        Parameters:
        vote - The vote this node is contributing.
      • 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.