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);
68 * Look up the covering prefix for the argument, but exclude the argument itself, so the result is always less
69 * specific than the lookup key.
72 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
73 * @return The covering prefix.
75 Eid getCoveringLessSpecific(Eid key);
81 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
82 * @return The parent prefix of the longest prefix match for the key.
84 Eid getParentPrefix(Eid key);
90 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
91 * @return The sibling prefix of the longest prefix match for the key.
93 Eid getSiblingPrefix(Eid key);
96 * Get virtual parent sibling prefix.
99 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
100 * @return The longest prefix match node's virtual parent's sibling or null if nothing is found.
102 Eid getVirtualParentSiblingPrefix(Eid key);
105 * Get widest negative prefix.
108 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
109 * @return The widest negative prefix found.
111 Eid getWidestNegativePrefix(Eid key);
114 * Get the subtree of the given prefix.
117 * The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
118 * @return The set of EIDs that part of the subtree of the given EID.
120 Set<Eid> getSubtree(Eid key);
123 * Enumerate all the entries from the DAO.
126 * The visitor object.
128 void getAll(IRowVisitor visitor);
131 * Remove an entry from the DAO.
134 * The key of the entry to delete
136 void remove(Object key);
139 * Remove an entry from the DAO.
142 * The key of the entry
144 * The value to delete
146 void removeSpecific(Object key, String valueKey);
149 * Clear the DAO and remove all of the entries.
154 * Insert a new table for given key.
157 * The key for the table
158 * @return The inserted table
160 ILispDAO putTable(String key);
163 * Inserts a new, nested table for given key and subkey. Also acts as factory method.
166 * The key for which a new table is linked in
168 * The subkey under which to insert the new table
169 * @return The inserted table
171 ILispDAO putNestedTable(Object key, String valueKey);
174 * Check if the DAO is empty.
176 * @return true if empty