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%2FRaftActorContext.java;h=7198876ca685fbab60c7983df909c0f05551a0f9;hp=a78b8909503a5ca2b17713635fe9a58ee0dedd46;hb=1fcab79755eb00756ad947f2369d82efb0b5a55c;hpb=cf5be659d906cc80d52647cb516bbab435156742 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 a78b890950..7198876ca6 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 @@ -10,9 +10,13 @@ package org.opendaylight.controller.cluster.raft; import akka.actor.ActorRef; import akka.actor.ActorSelection; +import akka.actor.ActorSystem; import akka.actor.Props; - -import java.util.concurrent.atomic.AtomicLong; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Supplier; +import java.util.Map; +import org.opendaylight.controller.cluster.DataPersistenceProvider; +import org.slf4j.Logger; /** * The RaftActorContext contains that portion of the RaftActors state that @@ -61,7 +65,13 @@ public interface RaftActorContext { * monotonically) * @return */ - AtomicLong getCommitIndex(); + long getCommitIndex(); + + + /** + * + */ + void setCommitIndex(long commitIndex); /** * index of highest log entry applied to state @@ -69,10 +79,105 @@ public interface RaftActorContext { * monotonically) * @return */ - AtomicLong getLastApplied(); + long getLastApplied(); + /** * */ + void setLastApplied(long lastApplied); + + /** + * + * @param replicatedLog + */ + void setReplicatedLog(ReplicatedLog replicatedLog); + + /** + * @return A representation of the log + */ ReplicatedLog getReplicatedLog(); + + /** + * @return The ActorSystem associated with this context + */ + ActorSystem getActorSystem(); + + /** + * Get the logger to be used for logging messages + * + * @return + */ + Logger getLogger(); + + /** + * Get a mapping of peerId's to their addresses + * + * @return + * + */ + Map getPeerAddresses(); + + /** + * Get the address of the peer as a String. This is the same format in + * which a consumer would provide the address + * + * @param peerId + * @return The address of the peer or null if the address has not yet been + * resolved + */ + String getPeerAddress(String peerId); + + /** + * Add to actor peers + * @param name + * @param address + */ + void addToPeers(String name, String address); + + /** + * + * @param name + */ + void removePeer(String name); + + /** + * Given a peerId return the corresponding actor + *

+ * + * + * @param peerId + * @return The actorSelection corresponding to the peer or null if the + * address has not yet been resolved + */ + ActorSelection getPeerActorSelection(String peerId); + + /** + * Set Peer Address can be called at a later time to change the address of + * a known peer. + * + *

+ * Throws an IllegalStateException if the peer is unknown + * + * @param peerId + * @param peerAddress + */ + void setPeerAddress(String peerId, String peerAddress); + + /** + * @return ConfigParams + */ + ConfigParams getConfigParams(); + + SnapshotManager getSnapshotManager(); + + DataPersistenceProvider getPersistenceProvider(); + + boolean hasFollowers(); + + long getTotalMemory(); + + @VisibleForTesting + void setTotalMemoryRetriever(Supplier retriever); + }