blob: 7479491d579ecc0395cdb827be2513e15690c67c [file] [log] [blame]
Pavlin Radoslavov7940b652014-02-13 19:42:05 -08001package net.onrc.onos.datagrid;
2
3import java.util.Collection;
4
5/**
6 * Event Channel Interface.
7 */
8public interface IEventChannel<K, V> {
9 /**
10 * Startup the channel operation.
11 */
12 void startup();
13
14 /**
15 * Shutdown the channel operation.
16 */
17 void shutdown();
18
19 /**
20 * Verify the key and value types of a channel.
21 *
22 * @param typeK the type of the key to verify.
23 * @param typeV the type of the value to verify.
24 * @return true if the key and value types of the channel match,
25 * otherwise false.
26 */
27 boolean verifyKeyValueTypes(Class typeK, Class typeV);
28
29 /**
30 * Add event channel listener.
31 *
32 * @param listener the listener to add.
33 */
34 void addListener(IEventChannelListener<K, V> listener);
35
36 /**
37 * Remove event channel listener.
38 *
39 * @param listener the listener to remove.
40 */
41 void removeListener(IEventChannelListener<K, V> listener);
42
43 /**
44 * Add an entry to the channel.
45 *
46 * @param key the key of the entry to add.
47 * @param value the value of the entry to add.
48 */
49 void addEntry(K key, V value);
50
51 /**
52 * Remove an entry from the channel.
53 *
54 * @param key the key of the entry to remove.
55 */
56 void removeEntry(K key);
57
58 /**
59 * Update an entry in the channel.
60 *
61 * @param key the key of the entry to update.
62 * @param value the value of the entry to update.
63 */
64 void updateEntry(K key, V value);
65
66 /**
67 * Get an entry from the channel.
68 *
69 * @param key the key of the entry to get.
70 * @return the entry if found, otherwise null.
71 */
72 @Deprecated
73 V getEntry(K key);
74
75 /**
76 * Get all entries in the channel.
77 *
78 * @return all entries that are currently in the channel.
79 */
80 @Deprecated
81 Collection<V> getAllEntries();
82
83 /**
84 * Remove all entries in the channel.
85 */
86 @Deprecated
87 void removeAllEntries();
88}