Merge "Add RPC to read per xtrId mappings for an EID."
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / mapcache / IMappingSystem.java
index 457d28bf0981ff134d2d8039ece4df31a38eeeac..c280064b0b4e7bc2c788db999bf6504d2f12260c 100644 (file)
@@ -8,12 +8,13 @@
 
 package org.opendaylight.lispflowmapping.interfaces.mapcache;
 
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
 
 /**
- * Mapping System interface
+ * Mapping System interface.
  *
  * @author Florin Coras
  *
@@ -21,7 +22,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev15090
 
 public interface IMappingSystem {
     /**
-     * Add mapping
+     * Add mapping.
      *
      * @param origin
      *            Table where mapping should be added
@@ -55,7 +56,20 @@ public interface IMappingSystem {
     Object getMapping(Eid dst);
 
     /**
-     * Retrieves mapping from table for provided key
+     * Retrieves mapping for the provided dst key for a particular xtr id.
+     * @param src
+     *            Source Key to be looked up.
+     * @param dst
+     *            Destination Key to be looked up.
+     * @param xtrId
+     *            Xtr Id for which this look to be done. If null, this method works like
+     *            regular getMapping(src, dst)
+     * @return Returns the object found in the simple map cache or null if nothing is found.
+     */
+    Object getMapping(Eid src, Eid dst, XtrId xtrId);
+
+    /**
+     * Retrieves mapping from table for provided key.
      *
      * @param origin
      *            Table where mapping should be looked up
@@ -66,17 +80,28 @@ public interface IMappingSystem {
     Object getMapping(MappingOrigin origin, Eid key);
 
     /**
-     * Update key registration
+     * Retrieves widest negative prefix from table for provided key.
+     *
+     * @param key
+     *            Key to be looked up
+     * @return Returns the prefix found in the cache or null if nothing is found.
+     */
+    Object getWidestNegativePrefix(Eid key);
+
+    /**
+     * Update mapping registration.
      *
      * @param origin
      *            Table for mapping that should be updated
      * @param key
-     *            The key whose registration must be updated
+     *            The EID whose registration must be updated
+     * @param timestamp
+     *            New timestamp for the mapping
      */
-    void updateMappingRegistration(MappingOrigin origin, Eid key);
+    void updateMappingRegistration(MappingOrigin origin, Eid key, Long timestamp);
 
     /**
-     * Remove mapping
+     * Remove mapping.
      *
      * @param origin
      *            Table for mapping that should be removed
@@ -87,7 +112,7 @@ public interface IMappingSystem {
     void removeMapping(MappingOrigin origin, Eid key);
 
     /**
-     * Add authentication key
+     * Add authentication key.
      *
      * @param key
      *            The key for which the authentication key is added
@@ -97,7 +122,7 @@ public interface IMappingSystem {
     void addAuthenticationKey(Eid key, MappingAuthkey authKey);
 
     /**
-     * Retrieve authentication key
+     * Retrieve authentication key.
      *
      * @param key
      *            The key for which the authentication key is being looked up.
@@ -106,7 +131,7 @@ public interface IMappingSystem {
     MappingAuthkey getAuthenticationKey(Eid key);
 
     /**
-     * Remove authentication key
+     * Remove authentication key.
      *
      * @param key
      *            Key for which the authentication key should be removed.
@@ -115,7 +140,7 @@ public interface IMappingSystem {
 
 
     /**
-     * Add data for key
+     * Add data for key.
      *
      * @param origin
      *            Table for data that should be added
@@ -129,7 +154,7 @@ public interface IMappingSystem {
     void addData(MappingOrigin origin, Eid key, String subKey, Object data);
 
     /**
-     * Generic retrieval of data
+     * Generic retrieval of data.
      *
      * @param origin
      *            Table from where data should be retrieved
@@ -143,7 +168,7 @@ public interface IMappingSystem {
 
 
     /**
-     * Generic removal of data
+     * Generic removal of data.
      *
      * @param origin
      *            Table from where data should be removed
@@ -172,9 +197,25 @@ public interface IMappingSystem {
     void setOverwritePolicy(boolean overwrite);
 
     /**
-     * Print all mappings. Used for testing, debugging and the karaf shell
+     * Print all mappings. Used for testing, debugging and the karaf shell.
      *
      * @return String consisting of all mappings
      */
     String printMappings();
+
+    /**
+     * Set cluster master status.
+     *
+     * @param isMaster
+     *            is|isn't master
+     */
+    void setIsMaster(final boolean isMaster);
+
+    /**
+     * Get cluster master status.
+     *
+     * @return isMaster
+     *            is|isn't master
+     */
+    boolean isMaster();
 }