Interface ReplicatedVote

  • All Superinterfaces:
    com.akkaserverless.replicatedentity.ReplicatedData

    public interface ReplicatedVote
    extends com.akkaserverless.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

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean getSelfVote()
      Get the current value for this node's 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?
      ReplicatedVote vote​(boolean vote)
      Update this node's vote to the given value.
      • Methods inherited from interface com.akkaserverless.replicatedentity.ReplicatedData

        _internal
    • Method Detail

      • 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