Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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 | |
| 17 | package org.onosproject.net.pi.service; |
| 18 | |
| 19 | import com.google.common.annotations.Beta; |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 20 | import org.onosproject.net.pi.runtime.PiEntity; |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 21 | import org.onosproject.net.pi.runtime.PiHandle; |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 22 | import org.onosproject.store.Store; |
| 23 | |
| 24 | /** |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 25 | * PI translation store abstraction that maintains a mapping between a PI entity |
| 26 | * handle and a translated entity. |
| 27 | * |
| 28 | * @param <T> PD entity class (translatable to PI) |
| 29 | * @param <E> PI entity class |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 30 | */ |
| 31 | @Beta |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 32 | public interface PiTranslationStore<T extends PiTranslatable, E extends PiEntity> |
| 33 | extends Store<PiTranslationEvent<T, E>, PiTranslationStoreDelegate<T, E>> { |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 34 | |
| 35 | /** |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 36 | * Adds or update a mapping between the given PI entity handle and |
| 37 | * translated entity. |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 38 | * |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 39 | * @param handle PI entity handle |
| 40 | * @param entity PI translated entity |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 41 | */ |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 42 | void addOrUpdate(PiHandle<E> handle, PiTranslatedEntity<T, E> entity); |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 43 | |
| 44 | /** |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 45 | * Returns a PI translated entity for the given handle. Returns null if this |
| 46 | * store does not contain a mapping between the two for the given pipeconf |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 47 | * ID. |
| 48 | * |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 49 | * @param handle PI entity handle |
| 50 | * @return PI translated entity |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 51 | */ |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 52 | PiTranslatedEntity<T, E> get(PiHandle<E> handle); |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 53 | |
| 54 | /** |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 55 | * Removes a previously added mapping for the given PI entity handle. |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 56 | * |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 57 | * @param handle PI entity handle |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 58 | */ |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 59 | void remove(PiHandle<E> handle); |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 60 | } |