8474f94e933a569fa279de4a94adba3597413dd3
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / dao / ILispDAO.java
1 /*
2  * Copyright (c) 2014 Contextream, Inc. and others.  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.dao;
10
11 import java.util.Map;
12 import java.util.AbstractMap.SimpleImmutableEntry;
13
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
15
16 public interface ILispDAO {
17
18     /**
19      * Put a entry into the DAO.
20      *
21      * @param key
22      *            The entry's key.
23      * @param values
24      *            The entry's value.
25      */
26     void put(Object key, MappingEntry<?>... values);
27
28     /**
29      * Get a specific value from the DAO.
30      *
31      * @param key
32      *            The key of the value to fetch
33      * @param valueKey
34      *            The value to fetch
35      * @return The value from the DAO.
36      */
37     Object getSpecific(Object key, String valueKey);
38
39     /**
40      * Get the entries from the DAO
41      *
42      * @param key
43      *            The key to be looked up as exact match.
44      * @return The value from the DAO.
45      */
46     Map<String, Object> get(Object key);
47
48     /**
49      * Get value for longest prefix match from the DAO
50      *
51      * @param key
52      *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
53      * @return The value from the DAO.
54      */
55     Map<String, Object> getBest(Object key);
56
57     /**
58      * Get longest prefix match and value from the DAO
59      *
60      * @param key
61      *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized
62      * @return The best match and value pair from the DAO.
63      */
64     SimpleImmutableEntry<Eid, Map<String, ?>> getBestPair(Object key);
65
66     /**
67      * Get widest negative prefix
68      *
69      * @param key
70      *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
71      * @return The widest negative prefix found.
72      */
73     Eid getWidestNegativePrefix(Eid key);
74
75     /**
76      * Enumerate all the entries from the DAO
77      *
78      * @param visitor
79      *            The visitor object.
80      */
81     void getAll(IRowVisitor visitor);
82
83     /**
84      * Remove an entry from the DAO
85      *
86      * @param key
87      *            The key of the entry to delete
88      */
89     void remove(Object key);
90
91     /**
92      * Remove an entry from the DAO
93      *
94      * @param key
95      *            The key of the entry
96      * @param valueKey
97      *            The value to delete
98      */
99     void removeSpecific(Object key, String valueKey);
100
101     /**
102      * Clear the DAO and remove all of the entries.
103      */
104     void removeAll();
105
106     /**
107      * Insert a new table for given key.
108      *
109      * @param key
110      *            The key for the table
111      * @return The inserted table
112      */
113     ILispDAO putTable(String key);
114
115     /**
116      * Inserts a new, nested table for given key and subkey. Also acts as factory method.
117      *
118      * @param key
119      *              The key for which a new table is linked in
120      * @param valueKey
121      *              The subkey under which to insert the new table
122      * @return The inserted table
123      */
124     ILispDAO putNestedTable(Object key, String valueKey);
125 }