blob: 153bcf38cf767dbabb17cf48e5766724cbb0244c [file] [log] [blame]
Toshio Koidea5611ce2014-08-22 15:16:51 -07001package net.onrc.onos.core.flowmanager;
2
3import java.util.Set;
4
5import net.onrc.onos.api.flowmanager.FlowBatchId;
6import net.onrc.onos.api.flowmanager.FlowBatchOperation;
7import net.onrc.onos.api.flowmanager.FlowBatchState;
8
9/**
10 * Interface of the flow batch map.
11 */
12interface FlowBatchMap {
13 /**
14 * Gets {@link FlowBatchOperation} object having {@link FlowBatchId} as its
15 * ID from the map.
16 *
17 * @param id the {@link FlowBatchId} to be used for getting the object
18 * @return {@link FlowBatchOperation} object if exists, null otherwise
19 */
20 FlowBatchOperation get(FlowBatchId id);
21
22 /**
23 * Puts {@link FlowBatchOperation} object to the map.
24 *
25 * @param id the {@link FlowBatchId} to be used for the object
26 * @param flowOp the {@link FlowBatchOperation} object
27 * @return true if the object was successfully added
28 */
29 boolean put(FlowBatchId id, FlowBatchOperation flowOp);
30
31 /**
32 * Removes {@link FlowBatchOperation} object from the map.
33 *
34 * @param id the {@link FlowBatchId} to be used for removing the object
35 * @return the removed {@link FlowBatchOperation} object if exists, null
36 * otherwise
37 */
38 FlowBatchOperation remove(FlowBatchId id);
39
40 /**
41 * Gets all {@link FlowBatchOperation} objects existing in the map.
42 * <p>
43 * The changes to the returned set does not affect the original map.
Toshio Koided6cbec32014-08-27 15:23:44 -070044 *
Toshio Koidea5611ce2014-08-22 15:16:51 -070045 * @return a set of {@link FlowBatchOperation} objects
46 */
47 Set<FlowBatchOperation> getAll();
48
49 /**
50 * Sets {@link FlowBatchState} to the specified {@link FlowBatchOperation}
51 * object.
52 *
53 * @param id the {@link FlowBatchId} of the {@link FlowBatchOperation}
54 * @param state the {@link FlowBatchState} to be set
55 * @param expectedState the {@link FlowBatchState} expected as the previous
56 * state
57 * @return true if the ID existed, the previous state was the expected state
58 * and successfully updated the state
59 */
60 boolean setState(FlowBatchId id, FlowBatchState state, FlowBatchState expectedState);
61
62 /**
63 * Gets {@link FlowBatchState} of the specified {@link FlowBatchOperation}
64 * object.
65 *
66 * @param id the {@link FlowBatchId} of the {@link FlowBatchOperation}
67 * @return the {@link FlowBatchState} of the {@link FlowBatchOperation} or
68 * null if the object does not exist
69 */
70 FlowBatchState getState(FlowBatchId id);
71
72 /**
73 * Adds a listener for listening events related to the map.
74 *
75 * @param listener the {@link FlowBatchMapEventListener} to be added
76 */
77 void addListener(FlowBatchMapEventListener listener);
78
79 /**
80 * Removes a listener for listening events related to the map.
81 *
82 * @param listener the {@link FlowBatchMapEventListener} to be removed
83 */
84 void removeListener(FlowBatchMapEventListener listener);
85
86 /**
Toshio Koided6cbec32014-08-27 15:23:44 -070087 * Checks if the specified flow batch operation is stored in local storage.
Toshio Koidea5611ce2014-08-22 15:16:51 -070088 *
Toshio Koided6cbec32014-08-27 15:23:44 -070089 * @param id the ID of the batch operation
90 * @return true if the specified batch operation is stored in local storage
Toshio Koidea5611ce2014-08-22 15:16:51 -070091 */
Toshio Koided6cbec32014-08-27 15:23:44 -070092 boolean isLocal(FlowBatchId id);
Toshio Koidea5611ce2014-08-22 15:16:51 -070093}