Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add getPeerIds to RaftActorContext
[controller.git]
/
opendaylight
/
md-sal
/
sal-akka-raft
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
raft
/
RaftActorContext.java
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 7198876ca685fbab60c7983df909c0f05551a0f9..0c9d698cd5404f0675d11df935351df529b448f2 100644
(file)
--- 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
@@
-14,8
+14,10
@@
import akka.actor.ActorSystem;
import akka.actor.Props;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Supplier;
import akka.actor.Props;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Supplier;
+import java.util.Collection;
import java.util.Map;
import org.opendaylight.controller.cluster.DataPersistenceProvider;
import java.util.Map;
import org.opendaylight.controller.cluster.DataPersistenceProvider;
+import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
import org.slf4j.Logger;
/**
import org.slf4j.Logger;
/**
@@
-26,15
+28,15
@@
import org.slf4j.Logger;
public interface RaftActorContext {
/**
* Create a new local actor
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
*/
ActorRef actorOf(Props props);
/**
* Create a actor selection
* @param path
- * @return
+ * @return
an actor selection for the given actor path
*/
ActorSelection actorSelection(String path);
*/
ActorSelection actorSelection(String path);
@@
-42,54
+44,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'
* 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();
/**
* @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
* to the RaftActor
- * @return
*/
ActorRef getActor();
/**
*/
ActorRef getActor();
/**
- * Get the ElectionTerm information
- * @return
+ * @return the ElectionTerm information
*/
ElectionTerm getTermInformation();
/**
*/
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();
/**
*/
long getCommitIndex();
/**
- *
+ *
@param commitIndex new commit index
*/
void setCommitIndex(long commitIndex);
/**
*/
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();
/**
*/
long getLastApplied();
/**
- *
+ *
@param lastApplied the index of the last log entry that was applied to the state
*/
void setLastApplied(long lastApplied);
/**
*
*/
void setLastApplied(long lastApplied);
/**
*
- * @param replicatedLog
+ * @param replicatedLog
the replicated log of the current RaftActor
*/
void setReplicatedLog(ReplicatedLog replicatedLog);
*/
void setReplicatedLog(ReplicatedLog replicatedLog);
@@
-104,16
+99,12
@@
public interface RaftActorContext {
ActorSystem getActorSystem();
/**
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();
/**
*/
Logger getLogger();
/**
- * Get a mapping of peerId's to their addresses
- *
- * @return
+ * @return a copy of the mapping of peerId's to their addresses
*
*/
Map<String, String> getPeerAddresses();
*
*/
Map<String, String> getPeerAddresses();
@@
-128,8
+119,14
@@
public interface RaftActorContext {
*/
String getPeerAddress(String peerId);
*/
String getPeerAddress(String peerId);
+ /**
+ * @return the list of peer IDs.
+ */
+ Collection<String> getPeerIds();
+
/**
* Add to actor peers
/**
* Add to actor peers
+ *
* @param name
* @param address
*/
* @param name
* @param address
*/
@@
-169,15
+166,45
@@
public interface RaftActorContext {
*/
ConfigParams getConfigParams();
*/
ConfigParams getConfigParams();
+ /**
+ *
+ * @return the SnapshotManager for this RaftActor
+ */
SnapshotManager getSnapshotManager();
SnapshotManager getSnapshotManager();
+ /**
+ *
+ * @return the DataPersistenceProvider for this RaftActor
+ */
DataPersistenceProvider getPersistenceProvider();
DataPersistenceProvider getPersistenceProvider();
+ /**
+ *
+ * @return true if the RaftActor has followers else false
+ */
boolean hasFollowers();
boolean hasFollowers();
+ /**
+ *
+ * @return the total memory used by the ReplicatedLog
+ */
long getTotalMemory();
long getTotalMemory();
+ /**
+ *
+ * @param retriever a supplier of the total memory metric
+ */
@VisibleForTesting
void setTotalMemoryRetriever(Supplier<Long> retriever);
@VisibleForTesting
void setTotalMemoryRetriever(Supplier<Long> 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();
}
}