blob: a0a7634f6409dcf3ef55f46babdc4216f33a3537 [file] [log] [blame]
alshabib2a441c62015-04-13 18:39:38 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.net.flowobjective;
17
Thomas Vachuskaa9d491e2015-05-20 11:17:21 -070018import com.google.common.annotations.Beta;
Saurav Das24431192016-03-07 19:13:00 -080019
20import java.util.Map;
21
alshabib2a441c62015-04-13 18:39:38 -070022import org.onosproject.net.behaviour.NextGroup;
23import org.onosproject.store.Store;
24
25/**
26 * The flow objective store.
27 */
Thomas Vachuskaa9d491e2015-05-20 11:17:21 -070028@Beta
alshabib2a441c62015-04-13 18:39:38 -070029public interface FlowObjectiveStore
30 extends Store<ObjectiveEvent, FlowObjectiveStoreDelegate> {
31
32 /**
Saurav Das423fe2b2015-12-04 10:52:59 -080033 * Adds a NextGroup to the store, by mapping it to the nextId as key,
34 * and replacing any previous mapping.
alshabib2a441c62015-04-13 18:39:38 -070035 *
36 * @param nextId an integer
37 * @param group a next group opaque object
38 */
39 void putNextGroup(Integer nextId, NextGroup group);
40
41 /**
42 * Fetch a next group from the store.
Saurav Das423fe2b2015-12-04 10:52:59 -080043 *
44 * @param nextId an integer used as key
45 * @return a next group, or null if group was not found
alshabib2a441c62015-04-13 18:39:38 -070046 */
47 NextGroup getNextGroup(Integer nextId);
alshabibf6ea9e62015-04-21 17:08:26 -070048
49 /**
Saurav Das423fe2b2015-12-04 10:52:59 -080050 * Remove a next group mapping from the store.
51 *
52 * @param nextId the key to remove from the store.
53 * @return the next group which mapped to the nextId and is now removed, or
54 * null if no group mapping existed in the store
55 */
56 NextGroup removeNextGroup(Integer nextId);
57
58 /**
Saurav Das24431192016-03-07 19:13:00 -080059 * Fetch all groups from the store and their mapping to nextIds.
60 *
61 * @return a map that represents the current snapshot of Next-ids to NextGroups
62 */
63 Map<Integer, NextGroup> getAllGroups();
64
65 /**
alshabibf6ea9e62015-04-21 17:08:26 -070066 * Allocates a next objective id. This id is globally unique
67 *
68 * @return an integer
69 */
70 int allocateNextId();
alshabib2a441c62015-04-13 18:39:38 -070071}