blob: 8a25874dd1bf7a0ea4d524b60677304559c12fdc [file] [log] [blame]
yoonseonbd8a93d2016-12-07 15:51:21 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
yoonseonbd8a93d2016-12-07 15:51:21 -08003 *
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.incubator.net.virtual;
18
19import org.onosproject.event.Event;
20import org.onosproject.store.StoreDelegate;
21
22/**
23 * Abstraction of a entity capable of storing and/or distributing information
24 * for virtual network across a cluster.
25 */
26public interface VirtualStore<E extends Event, D extends StoreDelegate<E>> {
27 /**
28 * Sets the delegate on the store.
29 *
30 * @param networkId a virtual network identifier
31 * @param delegate new store delegate
32 * @throws java.lang.IllegalStateException if a delegate is already
33 * currently set on the store and is a different one that
34 */
35 void setDelegate(NetworkId networkId, D delegate);
36
37 /**
38 * Withdraws the delegate from the store.
39 *
40 * @param networkId a virtual network identifier
41 * @param delegate store delegate to withdraw
42 * @throws java.lang.IllegalArgumentException if the delegate is not
43 * currently set on the store
44 */
45 void unsetDelegate(NetworkId networkId, D delegate);
46
47 /**
48 * Indicates whether the store has a delegate.
49 *
50 * @param networkId a virtual network identifier
51 * @return true if delegate is set
52 */
53 boolean hasDelegate(NetworkId networkId);
54}