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=c4189820b33bc6b94ae9f05a5b28450d39684079;hp=9f4b7cb4826b7d7be8eafc4eeec6503613204ad3;hb=a37aef6c01f720b935535b11cf9d7689ceea9470;hpb=2801b4929e60938cdac4c84dff6422e24e93d11d 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 9f4b7cb482..c4189820b3 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 @@ -15,6 +15,8 @@ import akka.actor.Props; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Supplier; import java.util.Map; +import org.opendaylight.controller.cluster.DataPersistenceProvider; +import org.opendaylight.controller.cluster.raft.policy.RaftPolicy; import org.slf4j.Logger; /** @@ -25,15 +27,15 @@ import org.slf4j.Logger; public interface RaftActorContext { /** * Create a new local actor - * @param props - * @return + * @param props + * @return a reference to the newly created actor */ ActorRef actorOf(Props props); /** * Create a actor selection * @param path - * @return + * @return an actor selection for the given actor path */ ActorSelection actorSelection(String path); @@ -41,54 +43,47 @@ public interface RaftActorContext { * Get the identifier for the RaftActor. This identifier represents the * name of the actor whose common state is being shared. For example the * id could be 'inventory' + * * @return the identifier */ String getId(); /** - * A reference to the RaftActor itself. This could be used to send messages + * @return A reference to the RaftActor itself. This could be used to send messages * to the RaftActor - * @return */ ActorRef getActor(); /** - * Get the ElectionTerm information - * @return + * @return the ElectionTerm information */ ElectionTerm getTermInformation(); /** - * index of highest log entry known to be - * committed (initialized to 0, increases - * monotonically) - * @return + * @return index of highest log entry known to be committed (initialized to 0, increases monotonically) */ long getCommitIndex(); /** - * + * @param commitIndex new commit index */ void setCommitIndex(long commitIndex); /** - * index of highest log entry applied to state - * machine (initialized to 0, increases - * monotonically) - * @return + * @return index of highest log entry applied to state machine (initialized to 0, increases monotonically) */ long getLastApplied(); /** - * + * @param lastApplied the index of the last log entry that was applied to the state */ void setLastApplied(long lastApplied); /** * - * @param replicatedLog + * @param replicatedLog the replicated log of the current RaftActor */ void setReplicatedLog(ReplicatedLog replicatedLog); @@ -103,16 +98,12 @@ public interface RaftActorContext { ActorSystem getActorSystem(); /** - * Get the logger to be used for logging messages - * - * @return + * @return the logger to be used for logging messages to a log file */ Logger getLogger(); /** - * Get a mapping of peerId's to their addresses - * - * @return + * @return a mapping of peerId's to their addresses * */ Map getPeerAddresses(); @@ -129,6 +120,7 @@ public interface RaftActorContext { /** * Add to actor peers + * * @param name * @param address */ @@ -168,13 +160,45 @@ public interface RaftActorContext { */ ConfigParams getConfigParams(); + /** + * + * @return the SnapshotManager for this RaftActor + */ SnapshotManager getSnapshotManager(); + /** + * + * @return the DataPersistenceProvider for this RaftActor + */ + DataPersistenceProvider getPersistenceProvider(); + + /** + * + * @return true if the RaftActor has followers else false + */ boolean hasFollowers(); + /** + * + * @return the total memory used by the ReplicatedLog + */ long getTotalMemory(); + /** + * + * @param retriever a supplier of the total memory metric + */ @VisibleForTesting void setTotalMemoryRetriever(Supplier retriever); + /** + * + * @return the payload version to be used when replicating data + */ + short getPayloadVersion(); + + /** + * @return an implementation of the RaftPolicy so that the Raft code can be adapted + */ + RaftPolicy getRaftPolicy(); }