2 * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
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
9 package org.opendaylight.lispflowmapping.interfaces.dao;
11 import java.util.AbstractMap.SimpleImmutableEntry;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
17 public interface ILispDAO {
20 * Put a entry into the DAO.
27 void put(Object key, MappingEntry<?>... values);
30 * Get a specific value from the DAO.
33 * The key of the value to fetch
36 * @return The value from the DAO.
38 Object getSpecific(Object key, String valueKey);
41 * Get the entries from the DAO.
44 * The key to be looked up as exact match.
45 * @return The value from the DAO.
47 Map<String, Object> get(Object key);
50 * Get value for longest prefix match from the DAO.
53 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
54 * @return The value from the DAO.
56 Map<String, Object> getBest(Object key);
59 * Get longest prefix match and value from the DAO.
62 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized
63 * @return The best match and value pair from the DAO.
65 SimpleImmutableEntry<Eid, Map<String, ?>> getBestPair(Object key);
71 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
72 * @return The parent prefix of the longest prefix match for the key.
74 Eid getParentPrefix(Eid key);
80 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
81 * @return The sibling prefix of the longest prefix match for the key.
83 Eid getSiblingPrefix(Eid key);
86 * Get virtual parent sibling prefix.
89 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
90 * @return The longest prefix match node's virtual parent's sibling or null if nothing is found.
92 Eid getVirtualParentSiblingPrefix(Eid key);
95 * Get widest negative prefix.
98 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
99 * @return The widest negative prefix found.
101 Eid getWidestNegativePrefix(Eid key);
104 * Get the subtree of the given prefix.
107 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
108 * @return The set of EIDs that part of the subtree of the given EID.
110 Set<Eid> getSubtree(Eid key);
113 * Enumerate all the entries from the DAO.
116 * The visitor object.
118 void getAll(IRowVisitor visitor);
121 * Remove an entry from the DAO.
124 * The key of the entry to delete
126 void remove(Object key);
129 * Remove an entry from the DAO.
132 * The key of the entry
134 * The value to delete
136 void removeSpecific(Object key, String valueKey);
139 * Clear the DAO and remove all of the entries.
144 * Insert a new table for given key.
147 * The key for the table
148 * @return The inserted table
150 ILispDAO putTable(String key);
153 * Inserts a new, nested table for given key and subkey. Also acts as factory method.
156 * The key for which a new table is linked in
158 * The subkey under which to insert the new table
159 * @return The inserted table
161 ILispDAO putNestedTable(Object key, String valueKey);
164 * Check if the DAO is empty.
166 * @return true if empty