Merge "Added hosttracker shell for karaf (rebased)"
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / RaftActorContext.java
index 554461a76c7480d27d5ef5daaf9cd6f814d5e2ff..0eb4b7377976526ac48eaefa9a9922b6a70c0076 100644 (file)
@@ -12,8 +12,9 @@ import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.ActorSystem;
 import akka.actor.Props;
+import akka.event.LoggingAdapter;
 
-import java.util.concurrent.atomic.AtomicLong;
+import java.util.Map;
 
 /**
  * The RaftActorContext contains that portion of the RaftActors state that
@@ -62,7 +63,13 @@ public interface RaftActorContext {
      *    monotonically)
      * @return
      */
-    AtomicLong getCommitIndex();
+    long getCommitIndex();
+
+
+    /**
+     *
+     */
+    void setCommitIndex(long commitIndex);
 
     /**
      * index of highest log entry applied to state
@@ -70,7 +77,19 @@ public interface RaftActorContext {
      *    monotonically)
      * @return
      */
-    AtomicLong getLastApplied();
+    long getLastApplied();
+
+
+    /**
+     *
+     */
+    void setLastApplied(long lastApplied);
+
+    /**
+     *
+     * @param replicatedLog
+     */
+    public void setReplicatedLog(ReplicatedLog replicatedLog);
 
     /**
      * @return A representation of the log
@@ -81,4 +100,70 @@ public interface RaftActorContext {
      * @return The ActorSystem associated with this context
      */
     ActorSystem getActorSystem();
+
+    /**
+     * Get the logger to be used for logging messages
+     *
+     * @return
+     */
+    LoggingAdapter getLogger();
+
+    /**
+     * Get a mapping of peerId's to their addresses
+     *
+     * @return
+     *
+     */
+    Map<String, String> 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
+     */
+    public void removePeer(String name);
+
+    /**
+     * Given a peerId return the corresponding actor
+     * <p>
+     *
+     *
+     * @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.
+     *
+     * <p>
+     * Throws an IllegalStateException if the peer is unknown
+     *
+     * @param peerId
+     * @param peerAddress
+     */
+    void setPeerAddress(String peerId, String peerAddress);
+
+    /**
+     * @return ConfigParams
+     */
+    public ConfigParams getConfigParams();
 }