Bug 9116: Add getChildPrefixes() method to caches
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / mapcache / IMapCache.java
index 1d4c6a87f2d00dfb6e1b526afa0562c35cd3a678..6ddf4af4d650b4f1f4515e3e66cae0c19cdbec59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
+ * Copyright (c) 2015, 2016 Cisco Systems, Inc.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -8,11 +8,11 @@
 
 package org.opendaylight.lispflowmapping.interfaces.mapcache;
 
+import java.util.Set;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
 
 /**
- * Map-cache interface
+ * Map-cache interface.
  *
  * @author Florin Coras
  *
@@ -20,18 +20,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev15090
 
 public interface IMapCache {
     /**
-     * Add mapping
+     * Add mapping.
      *
      * @param key
      *            Key of the mapping
-     * @param data
+     * @param value
      *            Value to be stored
-     * @param shouldOverwrite
-     *            Select if mappings with the same key are overwritten
-     * @param merge
-     *            Select if mappings with the same key are merged
      */
-    void addMapping(Eid key, Object data, boolean shouldOverwrite, boolean merge);
+    void addMapping(Eid key, Object value);
 
     /**
      * Retrieves mapping for the provided srcKey and dstKey.
@@ -45,53 +41,33 @@ public interface IMapCache {
     Object getMapping(Eid srcKey, Eid dstKey);
 
     /**
-     * Remove mapping
-     *
-     * @param key
-     *            Key to be removed
-     * @param overwrite
-     *            Select if mappings with the same key were overwritten on store
-     *
-     */
-    void removeMapping(Eid key, boolean overwrite);
-
-    /**
-     * Add authentication key
-     *
-     * @param key
-     *            The key for which the authentication key is added
-     * @param authKey
-     *            The authentication key
-     */
-    void addAuthenticationKey(Eid key, MappingAuthkey authKey);
-
-    /**
-     * Retrieve authentication key
+     * Retrieves widest negative prefix.
      *
      * @param key
-     *            The key for which the authentication key is being looked up.
-     * @return The authentication key.
+     *            Source Key to be looked up
+     * @return Returns the widest negative prefix or null if nothing is found.
      */
-    MappingAuthkey getAuthenticationKey(Eid key);
+    Eid getWidestNegativeMapping(Eid key);
 
     /**
-     * Remove authentication key
+     * Retrieves the subtree of a prefix.
      *
      * @param key
-     *            Key for which the authentication key should be removed.
+     *            Key to be looked up
+     * @return The set of prefixes in the subtree for the prefix
      */
-    void removeAuthenticationKey(Eid key);
+    Set<Eid> getSubtree(Eid key);
 
     /**
-     * Update key registration
+     * Remove mapping.
      *
      * @param key
-     *            The key whose registration must be updated
+     *            Key to be removed
      */
-    void updateMappingRegistration(Eid key);
+    void removeMapping(Eid key);
 
     /**
-     * Add data for key
+     * Add data for key.
      *
      * @param key
      *            The key for which data is inserted
@@ -103,7 +79,7 @@ public interface IMapCache {
     void addData(Eid key, String subKey, Object data);
 
     /**
-     * Generic retrieval of data
+     * Generic retrieval of data.
      *
      * @param key
      *            The key where the data is stored
@@ -114,7 +90,7 @@ public interface IMapCache {
     Object getData(Eid key, String subKey);
 
     /**
-     * Generic removal of data
+     * Generic removal of data.
      *
      * @param key
      *            The key of the data to be removed
@@ -124,9 +100,16 @@ public interface IMapCache {
     void removeData(Eid key, String subKey);
 
     /**
-     * Print mappings in cache. Used for testing, debugging and the karaf shell
+     * Print mappings in cache. Used for testing, debugging and the karaf shell.
      *
      * @return a String consisting of all the mappings in the cache
      */
     String printMappings();
+
+    /**
+     * Print mappings in cache in a human friendly format.
+     *
+     * @return a String consisting of all the mappings in the cache
+     */
+    String prettyPrintMappings();
 }