Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 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 | package org.onosproject.store.primitives; |
| 17 | |
Madan Jampani | e14a09c | 2016-02-11 10:43:21 -0800 | [diff] [blame] | 18 | import java.util.Set; |
| 19 | |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 20 | import org.onosproject.store.service.AsyncAtomicCounter; |
| 21 | import org.onosproject.store.service.AsyncAtomicValue; |
| 22 | import org.onosproject.store.service.AsyncConsistentMap; |
| 23 | import org.onosproject.store.service.AsyncDistributedSet; |
Madan Jampani | 47b80ba | 2016-01-31 23:05:55 -0800 | [diff] [blame] | 24 | import org.onosproject.store.service.AsyncLeaderElector; |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 25 | import org.onosproject.store.service.DistributedQueue; |
| 26 | import org.onosproject.store.service.Serializer; |
| 27 | |
| 28 | /** |
| 29 | * Interface for entity that can create instances of different distributed primitives. |
| 30 | */ |
| 31 | public interface DistributedPrimitiveCreator { |
| 32 | |
| 33 | /** |
| 34 | * Creates a new {@code AsyncConsistentMap}. |
| 35 | * |
| 36 | * @param name map name |
| 37 | * @param serializer serializer to use for serializing/deserializing map entries |
| 38 | * @param <K> key type |
| 39 | * @param <V> value type |
| 40 | * @return map |
| 41 | */ |
| 42 | <K, V> AsyncConsistentMap<K, V> newAsyncConsistentMap(String name, Serializer serializer); |
| 43 | |
| 44 | /** |
| 45 | * Creates a new {@code AsyncAtomicCounter}. |
| 46 | * |
| 47 | * @param name counter name |
| 48 | * @return counter |
| 49 | */ |
| 50 | AsyncAtomicCounter newAsyncCounter(String name); |
| 51 | |
| 52 | /** |
| 53 | * Creates a new {@code AsyncAtomicValue}. |
| 54 | * |
| 55 | * @param name value name |
| 56 | * @param serializer serializer to use for serializing/deserializing value type |
| 57 | * @param <V> value type |
| 58 | * @return value |
| 59 | */ |
| 60 | <V> AsyncAtomicValue<V> newAsyncAtomicValue(String name, Serializer serializer); |
| 61 | |
| 62 | /** |
| 63 | * Creates a new {@code DistributedQueue}. |
| 64 | * |
| 65 | * @param name queue name |
| 66 | * @param serializer serializer to use for serializing/deserializing queue entries |
| 67 | * @param <E> queue entry type |
| 68 | * @return queue |
| 69 | */ |
| 70 | <E> DistributedQueue<E> newDistributedQueue(String name, Serializer serializer); |
| 71 | |
| 72 | /** |
| 73 | * Creates a new {@code AsyncDistributedSet}. |
| 74 | * |
| 75 | * @param name set name |
| 76 | * @param serializer serializer to use for serializing/deserializing set entries |
| 77 | * @param <E> set entry type |
| 78 | * @return set |
| 79 | */ |
| 80 | <E> AsyncDistributedSet<E> newAsyncDistributedSet(String name, Serializer serializer); |
Madan Jampani | 47b80ba | 2016-01-31 23:05:55 -0800 | [diff] [blame] | 81 | |
| 82 | /** |
| 83 | * Creates a new {@code AsyncLeaderElector}. |
| 84 | * |
| 85 | * @param name leader elector name |
| 86 | * @return leader elector |
| 87 | */ |
| 88 | AsyncLeaderElector newAsyncLeaderElector(String name); |
Madan Jampani | e14a09c | 2016-02-11 10:43:21 -0800 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Returns the names of all created {@code AsyncConsistentMap} instances. |
| 92 | * @return set of {@code AsyncConsistentMap} names |
| 93 | */ |
| 94 | Set<String> getAsyncConsistentMapNames(); |
| 95 | |
| 96 | /** |
| 97 | * Returns the names of all created {@code AsyncAtomicCounter} instances. |
| 98 | * @return set of {@code AsyncAtomicCounter} names |
| 99 | */ |
| 100 | Set<String> getAsyncAtomicCounterNames(); |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 101 | } |