blob: 28bc08e068141c7564723d7d4b0204b7b9e20f81 [file] [log] [blame]
tom0755a362014-09-24 11:54:43 -07001package org.onlab.onos.store;
2
3import org.onlab.onos.event.Event;
4
5/**
6 * Abstraction of a entity capable of storing and/or distributing information
7 * across a cluster.
8 */
9public interface Store<E extends Event, D extends StoreDelegate<E>> {
10
11 /**
12 * Sets the delegate on the store.
13 *
14 * @param delegate new store delegate
tomf80c9722014-09-24 14:49:18 -070015 * @throws java.lang.IllegalStateException if a delegate is already
16 * currently set on the store and is a different one that
tom0755a362014-09-24 11:54:43 -070017 */
18 void setDelegate(D delegate);
19
20 /**
tomf80c9722014-09-24 14:49:18 -070021 * Withdraws the delegate from the store.
tom0755a362014-09-24 11:54:43 -070022 *
tomf80c9722014-09-24 14:49:18 -070023 * @param delegate store delegate to withdraw
24 * @throws java.lang.IllegalArgumentException if the delegate is not
25 * currently set on the store
tom0755a362014-09-24 11:54:43 -070026 */
tomf80c9722014-09-24 14:49:18 -070027 void unsetDelegate(D delegate);
28
29 /**
30 * Indicates whether the store has a delegate.
31 *
32 * @return true if delegate is set
33 */
34 boolean hasDelegate();
tom0755a362014-09-24 11:54:43 -070035
36}