alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 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 | */ |
| 16 | package org.onosproject.net.flowobjective; |
| 17 | |
Thomas Vachuska | a9d491e | 2015-05-20 11:17:21 -0700 | [diff] [blame] | 18 | import com.google.common.annotations.Beta; |
Saurav Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 19 | |
| 20 | import java.util.Map; |
| 21 | |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 22 | import org.onosproject.net.behaviour.NextGroup; |
| 23 | import org.onosproject.store.Store; |
| 24 | |
| 25 | /** |
| 26 | * The flow objective store. |
| 27 | */ |
Thomas Vachuska | a9d491e | 2015-05-20 11:17:21 -0700 | [diff] [blame] | 28 | @Beta |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 29 | public interface FlowObjectiveStore |
| 30 | extends Store<ObjectiveEvent, FlowObjectiveStoreDelegate> { |
| 31 | |
| 32 | /** |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 33 | * Adds a NextGroup to the store, by mapping it to the nextId as key, |
| 34 | * and replacing any previous mapping. |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 35 | * |
| 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 Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 43 | * |
| 44 | * @param nextId an integer used as key |
| 45 | * @return a next group, or null if group was not found |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 46 | */ |
| 47 | NextGroup getNextGroup(Integer nextId); |
alshabib | f6ea9e6 | 2015-04-21 17:08:26 -0700 | [diff] [blame] | 48 | |
| 49 | /** |
Saurav Das | 423fe2b | 2015-12-04 10:52:59 -0800 | [diff] [blame] | 50 | * 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 Das | 2443119 | 2016-03-07 19:13:00 -0800 | [diff] [blame] | 59 | * 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 | /** |
alshabib | f6ea9e6 | 2015-04-21 17:08:26 -0700 | [diff] [blame] | 66 | * Allocates a next objective id. This id is globally unique |
| 67 | * |
| 68 | * @return an integer |
| 69 | */ |
| 70 | int allocateNextId(); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 71 | } |