tom | 0755a36 | 2014-09-24 11:54:43 -0700 | [diff] [blame] | 1 | package org.onlab.onos.store; |
| 2 | |
| 3 | import org.onlab.onos.event.Event; |
| 4 | |
| 5 | /** |
| 6 | * Abstraction of a entity capable of storing and/or distributing information |
| 7 | * across a cluster. |
| 8 | */ |
| 9 | public 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 |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 15 | * @throws java.lang.IllegalStateException if a delegate is already |
| 16 | * currently set on the store and is a different one that |
tom | 0755a36 | 2014-09-24 11:54:43 -0700 | [diff] [blame] | 17 | */ |
| 18 | void setDelegate(D delegate); |
| 19 | |
| 20 | /** |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 21 | * Withdraws the delegate from the store. |
tom | 0755a36 | 2014-09-24 11:54:43 -0700 | [diff] [blame] | 22 | * |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 23 | * @param delegate store delegate to withdraw |
| 24 | * @throws java.lang.IllegalArgumentException if the delegate is not |
| 25 | * currently set on the store |
tom | 0755a36 | 2014-09-24 11:54:43 -0700 | [diff] [blame] | 26 | */ |
tom | f80c972 | 2014-09-24 14:49:18 -0700 | [diff] [blame] | 27 | 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(); |
tom | 0755a36 | 2014-09-24 11:54:43 -0700 | [diff] [blame] | 35 | |
| 36 | } |