597ab4c8e3af44b10925e8f4c68a8780b133e78f
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / mapcache / IMapCache.java
1 /*
2  * Copyright (c) 2015, 2016 Cisco Systems, Inc.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.lispflowmapping.interfaces.mapcache;
10
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
12
13 /**
14  * Map-cache interface.
15  *
16  * @author Florin Coras
17  *
18  */
19
20 public interface IMapCache {
21     /**
22      * Add mapping.
23      *
24      * @param key
25      *            Key of the mapping
26      * @param value
27      *            Value to be stored
28      */
29     void addMapping(Eid key, Object value);
30
31     /**
32      * Retrieves mapping for the provided srcKey and dstKey.
33      *
34      * @param srcKey
35      *            Source Key to be looked up
36      * @param dstKey
37      *            Destination Key to be looked up
38      * @return Returns the object found in the cache or null if nothing is found.
39      */
40     Object getMapping(Eid srcKey, Eid dstKey);
41
42     /**
43      * Retrieves widest negative prefix.
44      *
45      * @param key
46      *            Source Key to be looked up
47      * @return Returns the widest negative prefix or null if nothing is found.
48      */
49     Eid getWidestNegativeMapping(Eid key);
50
51     /**
52      * Remove mapping.
53      *
54      * @param key
55      *            Key to be removed
56      */
57     void removeMapping(Eid key);
58
59     /**
60      * Add data for key.
61      *
62      * @param key
63      *            The key for which data is inserted
64      * @param subKey
65      *            The subKey where data should be inserted
66      * @param data
67      *            The data to be stored
68      */
69     void addData(Eid key, String subKey, Object data);
70
71     /**
72      * Generic retrieval of data.
73      *
74      * @param key
75      *            The key where the data is stored
76      * @param subKey
77      *            The subKey where data is stored
78      * @return The data
79      */
80     Object getData(Eid key, String subKey);
81
82     /**
83      * Generic removal of data.
84      *
85      * @param key
86      *            The key of the data to be removed
87      * @param subKey
88      *            The subKey of the data to be removed
89      */
90     void removeData(Eid key, String subKey);
91
92     /**
93      * Print mappings in cache. Used for testing, debugging and the karaf shell.
94      *
95      * @return a String consisting of all the mappings in the cache
96      */
97     String printMappings();
98
99     /**
100      * Print mappings in cache in a human friendly format.
101      *
102      * @return a String consisting of all the mappings in the cache
103      */
104     String prettyPrintMappings();
105 }