1d4c6a87f2d00dfb6e1b526afa0562c35cd3a678
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / mapcache / IMapCache.java
1 /*
2  * Copyright (c) 2015 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 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
13
14 /**
15  * Map-cache interface
16  *
17  * @author Florin Coras
18  *
19  */
20
21 public interface IMapCache {
22     /**
23      * Add mapping
24      *
25      * @param key
26      *            Key of the mapping
27      * @param data
28      *            Value to be stored
29      * @param shouldOverwrite
30      *            Select if mappings with the same key are overwritten
31      * @param merge
32      *            Select if mappings with the same key are merged
33      */
34     void addMapping(Eid key, Object data, boolean shouldOverwrite, boolean merge);
35
36     /**
37      * Retrieves mapping for the provided srcKey and dstKey.
38      *
39      * @param srcKey
40      *            Source Key to be looked up
41      * @param dstKey
42      *            Destination Key to be looked up
43      * @return Returns the object found in the cache or null if nothing is found.
44      */
45     Object getMapping(Eid srcKey, Eid dstKey);
46
47     /**
48      * Remove mapping
49      *
50      * @param key
51      *            Key to be removed
52      * @param overwrite
53      *            Select if mappings with the same key were overwritten on store
54      *
55      */
56     void removeMapping(Eid key, boolean overwrite);
57
58     /**
59      * Add authentication key
60      *
61      * @param key
62      *            The key for which the authentication key is added
63      * @param authKey
64      *            The authentication key
65      */
66     void addAuthenticationKey(Eid key, MappingAuthkey authKey);
67
68     /**
69      * Retrieve authentication key
70      *
71      * @param key
72      *            The key for which the authentication key is being looked up.
73      * @return The authentication key.
74      */
75     MappingAuthkey getAuthenticationKey(Eid key);
76
77     /**
78      * Remove authentication key
79      *
80      * @param key
81      *            Key for which the authentication key should be removed.
82      */
83     void removeAuthenticationKey(Eid key);
84
85     /**
86      * Update key registration
87      *
88      * @param key
89      *            The key whose registration must be updated
90      */
91     void updateMappingRegistration(Eid key);
92
93     /**
94      * Add data for key
95      *
96      * @param key
97      *            The key for which data is inserted
98      * @param subKey
99      *            The subKey where data should be inserted
100      * @param data
101      *            The data to be stored
102      */
103     void addData(Eid key, String subKey, Object data);
104
105     /**
106      * Generic retrieval of data
107      *
108      * @param key
109      *            The key where the data is stored
110      * @param subKey
111      *            The subKey where data is stored
112      * @return The data
113      */
114     Object getData(Eid key, String subKey);
115
116     /**
117      * Generic removal of data
118      *
119      * @param key
120      *            The key of the data to be removed
121      * @param subKey
122      *            The subKey of the data to be removed
123      */
124     void removeData(Eid key, String subKey);
125
126     /**
127      * Print mappings in cache. Used for testing, debugging and the karaf shell
128      *
129      * @return a String consisting of all the mappings in the cache
130      */
131     String printMappings();
132 }