blob: 6274debbe93ff550be84c4b5e8aef9a2ea3ef301 [file] [log] [blame]
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -08001/*
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
17package org.onosproject.net.pi.service;
18
19import com.google.common.annotations.Beta;
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080020import org.onosproject.net.pi.runtime.PiEntity;
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080021import org.onosproject.net.pi.runtime.PiHandle;
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080022import org.onosproject.store.Store;
23
24/**
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080025 * 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 Cascone1a7e4f92017-11-20 23:04:02 -080030 */
31@Beta
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080032public interface PiTranslationStore<T extends PiTranslatable, E extends PiEntity>
33 extends Store<PiTranslationEvent<T, E>, PiTranslationStoreDelegate<T, E>> {
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080034
35 /**
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080036 * Adds or update a mapping between the given PI entity handle and
37 * translated entity.
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080038 *
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080039 * @param handle PI entity handle
40 * @param entity PI translated entity
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080041 */
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080042 void addOrUpdate(PiHandle<E> handle, PiTranslatedEntity<T, E> entity);
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080043
44 /**
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080045 * 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 Cascone1a7e4f92017-11-20 23:04:02 -080047 * ID.
48 *
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080049 * @param handle PI entity handle
50 * @return PI translated entity
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080051 */
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080052 PiTranslatedEntity<T, E> get(PiHandle<E> handle);
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080053
54 /**
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080055 * Removes a previously added mapping for the given PI entity handle.
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080056 *
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080057 * @param handle PI entity handle
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080058 */
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080059 void remove(PiHandle<E> handle);
Carmelo Cascone1a7e4f92017-11-20 23:04:02 -080060}