Interface RaftActorBehavior

    • Method Detail

      • handleMessage

        @Nullable RaftActorBehavior handleMessage​(ActorRef sender,
                                                  Object message)
        Handle a message. If the processing of the message warrants a state change then a new behavior should be returned otherwise this method should return the current behavior.
        Parameters:
        sender - The sender of the message
        message - A message that needs to be processed
        Returns:
        The new behavior or current behavior, or null if the message was not handled.
      • state

        RaftState state()
        Returns the state associated with this behavior.
        Returns:
        the RaftState
      • getLeaderId

        @Nullable String getLeaderId()
        Returns the id of the leader.
        Returns:
        the id of the leader or null if not known
      • setReplicatedToAllIndex

        void setReplicatedToAllIndex​(long replicatedToAllIndex)
        Sets the index of the last log entry that has been replicated to all peers.
        Parameters:
        replicatedToAllIndex - the index
      • getReplicatedToAllIndex

        long getReplicatedToAllIndex()
        Returns the index of the last log entry that has been replicated to all peers.
        Returns:
        the index or -1 if not known
      • getLeaderPayloadVersion

        short getLeaderPayloadVersion()
        Returns the leader's payload data version.
        Returns:
        a short representing the version
      • switchBehavior

        RaftActorBehavior switchBehavior​(RaftActorBehavior behavior)
        Closes the current behavior and switches to the specified behavior, if possible.
        Parameters:
        behavior - the new behavior to switch to
        Returns:
        the new behavior