X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FRaftActorContext.java;h=ba6645f2407c55afdbbdae8cffd524dfbcc466a7;hb=1ab64e1d91e4e657a4547efcc420db57297e8003;hp=b20e9daa945cee3e14cb0181be72317808b8afc0;hpb=cc2566a2570ce97c5ec054fca77f380ca35b942d;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContext.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContext.java index b20e9daa94..ba6645f240 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContext.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContext.java @@ -12,11 +12,15 @@ import akka.actor.ActorRef; import akka.actor.ActorSelection; import akka.actor.ActorSystem; import akka.actor.Props; +import akka.cluster.Cluster; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Supplier; import java.util.Collection; +import java.util.Optional; +import java.util.function.LongSupplier; import javax.annotation.Nullable; import org.opendaylight.controller.cluster.DataPersistenceProvider; +import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior; +import org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload; import org.opendaylight.controller.cluster.raft.policy.RaftPolicy; import org.slf4j.Logger; @@ -55,6 +59,13 @@ public interface RaftActorContext { */ ActorRef getActor(); + /** + * The akka Cluster singleton for the actor system if one is configured. + * + * @return an Optional containing the CLuster instance is present. + */ + Optional getCluster(); + /** * @return the ElectionTerm information */ @@ -207,7 +218,7 @@ public interface RaftActorContext { * @param retriever a supplier of the total memory metric */ @VisibleForTesting - void setTotalMemoryRetriever(Supplier retriever); + void setTotalMemoryRetriever(LongSupplier retriever); /** * @@ -235,5 +246,20 @@ public interface RaftActorContext { * @return the RaftActor's peer information as a ServerConfigurationPayload if the * dynamic server configurations are available, otherwise returns null */ - @Nullable ServerConfigurationPayload getPeerServerInfo(); + @Nullable ServerConfigurationPayload getPeerServerInfo(boolean includeSelf); + + /** + * @return true if this RaftActor is a voting member of the cluster, false otherwise. + */ + boolean isVotingMember(); + + /** + * @return true if there are any voting peers, false otherwise. + */ + boolean anyVotingPeers(); + + /** + * @return current behavior attached to the raft actor. + */ + RaftActorBehavior getCurrentBehavior(); }