X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fbehaviors%2FRaftActorBehavior.java;h=bf5116935d108c91ecec947cf7544ecc7f7cd3dc;hp=b766e0ce39fe9be1b847f54c625c802d036a7a0a;hb=f276ae33b951d173b51c467bb7bb1a5f5cf9a1e6;hpb=bead4f9288b0c758ac736ee8945ca01313b177da diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java index b766e0ce39..bf5116935d 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java @@ -9,6 +9,7 @@ package org.opendaylight.controller.cluster.raft.behaviors; import akka.actor.ActorRef; +import javax.annotation.Nullable; import org.opendaylight.controller.cluster.raft.RaftState; /** @@ -34,20 +35,19 @@ public interface RaftActorBehavior extends AutoCloseable{ * @param sender The sender of the message * @param message A message that needs to be processed * - * @return The new behavior or current behavior + * @return The new behavior or current behavior, or null if the message was not handled. */ - RaftActorBehavior handleMessage(ActorRef sender, Object message); + @Nullable RaftActorBehavior handleMessage(ActorRef sender, Object message); /** - * The state associated with a given behavior * - * @return + * @return The state associated with a given behavior */ RaftState state(); /** * - * @return + * @return The Id of the Leader if known else null */ String getLeaderId(); @@ -58,8 +58,24 @@ public interface RaftActorBehavior extends AutoCloseable{ void setReplicatedToAllIndex(long replicatedToAllIndex); /** - * getting the index of the log entry which is replicated to all nodes - * @return + * @return the index of the log entry which is replicated to all nodes */ long getReplicatedToAllIndex(); + + /** + * @return the leader's payload data version. + */ + short getLeaderPayloadVersion(); + + /** + * switchBehavior makes sure that the current behavior is shutdown before it switches to the new + * behavior + * + * @param behavior The new behavior to switch to + * @return The new behavior + */ + RaftActorBehavior switchBehavior(RaftActorBehavior behavior); + + @Override + void close(); }