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.SiteId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
/**
- * Mapping System interface
+ * Mapping System interface.
*
* @author Florin Coras
*
public interface IMappingSystem {
/**
- * Add mapping
+ * Add mapping.
*
* @param origin
* Table where mapping should be added
* Key of the mapping
* @param data
* Value to be stored
+ * @param merge
+ * Select if mappings with the same key are merged
*/
- void addMapping(MappingOrigin origin, Eid key, Object data);
-
- /**
- * Add mapping and persist to datastore
- *
- * @param origin
- * Table where mapping should be added
- * @param siteId
- * SiteID of SB device doing the registration
- * @param key
- * Key of the mapping
- * @param data
- * Value to be stored
- */
- void addMapping(MappingOrigin origin, SiteId siteId, Eid key, Object data);
+ void addMapping(MappingOrigin origin, Eid key, Object data, boolean merge);
/**
* Retrieves mapping for the provided src and dst key.
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
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
void removeMapping(MappingOrigin origin, Eid key);
/**
- * Add authentication key
+ * Add authentication key.
*
* @param key
* The key for which the authentication key is added
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.
MappingAuthkey getAuthenticationKey(Eid key);
/**
- * Remove authentication key
+ * Remove authentication key.
*
* @param key
* Key for which the authentication key should be removed.
/**
- * Add data for key
+ * Add data for key.
*
* @param origin
* Table for data that should be added
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
/**
- * Generic removal of data
+ * Generic removal of data.
*
* @param origin
* Table from where data should be removed
* @param overwrite
* Value to configure
*/
- public void setOverwritePolicy(boolean overwrite);
+ 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();
}