Carmelo Cascone | 94a659f | 2017-11-21 00:06:11 -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; |
| 20 | import org.onosproject.net.pi.runtime.PiEntity; |
| 21 | import org.onosproject.net.pi.runtime.PiHandle; |
| 22 | import org.onosproject.store.Store; |
| 23 | |
| 24 | /** |
| 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 |
| 30 | */ |
| 31 | @Beta |
| 32 | public interface PiTranslationStore<T extends PiTranslatable, E extends PiEntity> |
| 33 | extends Store<PiTranslationEvent<T, E>, PiTranslationStoreDelegate<T, E>> { |
| 34 | |
| 35 | /** |
| 36 | * Adds or update a mapping between the given PI entity handle and |
| 37 | * translated entity. |
| 38 | * |
| 39 | * @param handle PI entity handle |
| 40 | * @param entity PI translated entity |
| 41 | */ |
| 42 | void addOrUpdate(PiHandle<E> handle, PiTranslatedEntity<T, E> entity); |
| 43 | |
| 44 | /** |
| 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 |
| 47 | * ID. |
| 48 | * |
| 49 | * @param handle PI entity handle |
| 50 | * @return PI translated entity |
| 51 | */ |
| 52 | PiTranslatedEntity<T, E> get(PiHandle<E> handle); |
| 53 | |
| 54 | /** |
| 55 | * Removes a previously added mapping for the given PI entity handle. |
| 56 | * |
| 57 | * @param handle PI entity handle |
| 58 | */ |
| 59 | void remove(PiHandle<E> handle); |
| 60 | } |