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 */
32 void addMapping(Eid key, Object data, boolean shouldOverwrite);
33
34 /**
35 * Retrieves mapping for the provided srcKey and dstKey.
36 *
37 * @param srcKey
38 * Source Key to be looked up
39 * @param dstKey
40 * Destination Key to be looked up
41 * @return Returns the object found in the cache or null if nothing is found.
42 */
43 Object getMapping(Eid srcKey, Eid dstKey);
44
45 /**
46 * Remove mapping
47 *
48 * @param key
49 * Key to be removed
50 * @param overwrite
51 * Select if mappings with the same key were overwritten on store
52 *
53 */
54 void removeMapping(Eid key, boolean overwrite);
55
56 /**
57 * Add authentication key
58 *
59 * @param key
60 * The key for which the authentication key is added
61 * @param authKey
62 * The authentication key
63 */
64 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
65
66 /**
67 * Retrieve authentication key
68 *
69 * @param key
70 * The key for which the authentication key is being looked up.
71 * @return The authentication key.
72 */
73 MappingAuthkey getAuthenticationKey(Eid key);
74
75 /**
76 * Remove authentication key
77 *
78 * @param key
79 * Key for which the authentication key should be removed.
80 */
81 void removeAuthenticationKey(Eid key);
82
83 /**
84 * Update key registration
85 *
86 * @param key
87 * The key whose registration must be updated
88 */
89 void updateMappingRegistration(Eid key);
90
91 /**
92 * Add data for key
93 *
94 * @param key
95 * The key for which data is inserted
96 * @param subKey
97 * The subKey where data should be inserted
98 * @param data
99 * The data to be stored
100 */
101 void addData(Eid key, String subKey, Object data);
102
103 /**
104 * Generic retrieval of data
105 *
106 * @param key
107 * The key where the data is stored
108 * @param subKey
109 * The subKey where data is stored
110 * @return The data
111 */
112 Object getData(Eid key, String subKey);
113
114 /**
115 * Generic removal of data
116 *
117 * @param key
118 * The key of the data to be removed
119 * @param subKey
120 * The subKey of the data to be removed
121 */
122 void removeData(Eid key, String subKey);
123
124 /**
125 * Print mappings in cache. Used for testing, debugging and the karaf shell
126 *
127 * @return a String consisting of all the mappings in the cache
128 */
129 String printMappings();
130 }