Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Open Networking Laboratory |
| 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 | |
| 18 | import org.onosproject.store.service.AsyncAtomicCounter; |
| 19 | import org.onosproject.store.service.AsyncAtomicValue; |
| 20 | import org.onosproject.store.service.AsyncConsistentMap; |
| 21 | import org.onosproject.store.service.AsyncDistributedSet; |
| 22 | import org.onosproject.store.service.DistributedQueue; |
| 23 | import org.onosproject.store.service.Serializer; |
| 24 | |
| 25 | /** |
| 26 | * Interface for entity that can create instances of different distributed primitives. |
| 27 | */ |
| 28 | public interface DistributedPrimitiveCreator { |
| 29 | |
| 30 | /** |
| 31 | * Creates a new {@code AsyncConsistentMap}. |
| 32 | * |
| 33 | * @param name map name |
| 34 | * @param serializer serializer to use for serializing/deserializing map entries |
| 35 | * @param <K> key type |
| 36 | * @param <V> value type |
| 37 | * @return map |
| 38 | */ |
| 39 | <K, V> AsyncConsistentMap<K, V> newAsyncConsistentMap(String name, Serializer serializer); |
| 40 | |
| 41 | /** |
| 42 | * Creates a new {@code AsyncAtomicCounter}. |
| 43 | * |
| 44 | * @param name counter name |
| 45 | * @return counter |
| 46 | */ |
| 47 | AsyncAtomicCounter newAsyncCounter(String name); |
| 48 | |
| 49 | /** |
| 50 | * Creates a new {@code AsyncAtomicValue}. |
| 51 | * |
| 52 | * @param name value name |
| 53 | * @param serializer serializer to use for serializing/deserializing value type |
| 54 | * @param <V> value type |
| 55 | * @return value |
| 56 | */ |
| 57 | <V> AsyncAtomicValue<V> newAsyncAtomicValue(String name, Serializer serializer); |
| 58 | |
| 59 | /** |
| 60 | * Creates a new {@code DistributedQueue}. |
| 61 | * |
| 62 | * @param name queue name |
| 63 | * @param serializer serializer to use for serializing/deserializing queue entries |
| 64 | * @param <E> queue entry type |
| 65 | * @return queue |
| 66 | */ |
| 67 | <E> DistributedQueue<E> newDistributedQueue(String name, Serializer serializer); |
| 68 | |
| 69 | /** |
| 70 | * Creates a new {@code AsyncDistributedSet}. |
| 71 | * |
| 72 | * @param name set name |
| 73 | * @param serializer serializer to use for serializing/deserializing set entries |
| 74 | * @param <E> set entry type |
| 75 | * @return set |
| 76 | */ |
| 77 | <E> AsyncDistributedSet<E> newAsyncDistributedSet(String name, Serializer serializer); |
| 78 | } |