ios-xe renderer - listeners+cache
[groupbasedpolicy.git] / renderers / ios-xe / src / main / java / org / opendaylight / groupbasedpolicy / renderer / ios_xe_provider / api / cache / DSTreeBasedCache.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, 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.groupbasedpolicy.renderer.ios_xe_provider.api.cache;
10
11 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
12 import org.opendaylight.yangtools.yang.binding.DataObject;
13
14 /**
15  * Purpose: specify a cache driven by {@link DataTreeModification} where lookup key might differ from key used in
16  * dataStore and retrieved value is expected to be subset of <T>
17  *
18  * @param <T> dataStore object type
19  * @param <K> lookup key type
20  * @param <V> lookup result type
21  */
22 public interface DSTreeBasedCache<T extends DataObject, K, V> {
23
24     /**
25      * @param exSource to be removed from cache
26      */
27     void invalidate(T exSource);
28
29     /**
30      * @param newSource to be added to chache
31      */
32     void add(T newSource);
33
34     /**
35      * update existing value
36      *
37      * @param before old value
38      * @param after  new value
39      */
40     void update(T before, T after);
41
42     /**
43      * @param key for finding cached value
44      * @return found value pair to given key or null
45      */
46     V lookupValue(K key);
47
48
49     /**
50      * dispose of all cached values
51      */
52     void invalidateAll();
53 }