Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
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 | |
| 18 | import org.onosproject.store.service.AsyncAtomicCounter; |
Jordan Halterman | c955df7 | 2017-02-04 20:43:28 -0800 | [diff] [blame] | 19 | import org.onosproject.store.service.AsyncAtomicCounterMap; |
Jordan Halterman | 5a1053e | 2017-05-19 18:03:47 -0700 | [diff] [blame] | 20 | import org.onosproject.store.service.AsyncAtomicIdGenerator; |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 21 | import org.onosproject.store.service.AsyncAtomicValue; |
| 22 | import org.onosproject.store.service.AsyncConsistentMap; |
Aaron Kruglikov | 61582a0 | 2016-09-06 13:18:58 -0700 | [diff] [blame] | 23 | import org.onosproject.store.service.AsyncConsistentMultimap; |
Aaron Kruglikov | ed88ff6 | 2016-08-01 16:02:09 -0700 | [diff] [blame] | 24 | import org.onosproject.store.service.AsyncConsistentTreeMap; |
Jordan Halterman | 4743258 | 2018-01-25 16:56:45 -0800 | [diff] [blame] | 25 | import org.onosproject.store.service.AsyncDistributedLock; |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 26 | import org.onosproject.store.service.AsyncDistributedSet; |
Madan Jampani | 2914e4e | 2016-09-13 17:48:56 -0700 | [diff] [blame] | 27 | import org.onosproject.store.service.AsyncDocumentTree; |
Madan Jampani | 47b80ba | 2016-01-31 23:05:55 -0800 | [diff] [blame] | 28 | import org.onosproject.store.service.AsyncLeaderElector; |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 29 | import org.onosproject.store.service.AtomicCounterMapOptions; |
| 30 | import org.onosproject.store.service.AtomicCounterOptions; |
| 31 | import org.onosproject.store.service.AtomicIdGeneratorOptions; |
| 32 | import org.onosproject.store.service.AtomicValueOptions; |
| 33 | import org.onosproject.store.service.ConsistentMapOptions; |
| 34 | import org.onosproject.store.service.ConsistentMultimapOptions; |
| 35 | import org.onosproject.store.service.ConsistentTreeMapOptions; |
| 36 | import org.onosproject.store.service.DistributedLockOptions; |
| 37 | import org.onosproject.store.service.DistributedSetOptions; |
| 38 | import org.onosproject.store.service.DocumentTreeOptions; |
| 39 | import org.onosproject.store.service.LeaderElectorOptions; |
Madan Jampani | 2914e4e | 2016-09-13 17:48:56 -0700 | [diff] [blame] | 40 | import org.onosproject.store.service.WorkQueue; |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 41 | import org.onosproject.store.service.WorkQueueOptions; |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 42 | |
Ray Milkey | 6837293 | 2018-09-21 11:00:46 -0700 | [diff] [blame] | 43 | import java.util.Set; |
Jordan Halterman | 7b7644f | 2017-10-16 12:57:55 -0700 | [diff] [blame] | 44 | |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 45 | /** |
| 46 | * Interface for entity that can create instances of different distributed primitives. |
| 47 | */ |
| 48 | public interface DistributedPrimitiveCreator { |
| 49 | |
| 50 | /** |
| 51 | * Creates a new {@code AsyncConsistentMap}. |
| 52 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 53 | * @param options map options |
| 54 | * @param <K> key type |
| 55 | * @param <V> value type |
| 56 | * @return map |
| 57 | */ |
| 58 | <K, V> AsyncConsistentMap<K, V> newAsyncConsistentMap(ConsistentMapOptions options); |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 59 | |
| 60 | /** |
Aaron Kruglikov | ed88ff6 | 2016-08-01 16:02:09 -0700 | [diff] [blame] | 61 | * Creates a new {@code AsyncConsistentTreeMap}. |
| 62 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 63 | * @param options tree map options |
| 64 | * @param <V> value type |
| 65 | * @return distributedTreeMap |
| 66 | */ |
| 67 | <V> AsyncConsistentTreeMap<V> newAsyncConsistentTreeMap(ConsistentTreeMapOptions options); |
Aaron Kruglikov | 61582a0 | 2016-09-06 13:18:58 -0700 | [diff] [blame] | 68 | |
| 69 | /** |
| 70 | * Creates a new set backed {@code AsyncConsistentMultimap}. |
| 71 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 72 | * @param options multimap options |
| 73 | * @param <K> key type |
| 74 | * @param <V> value type |
| 75 | * @return set backed distributedMultimap |
| 76 | */ |
| 77 | <K, V> AsyncConsistentMultimap<K, V> newAsyncConsistentSetMultimap(ConsistentMultimapOptions options); |
Aaron Kruglikov | ed88ff6 | 2016-08-01 16:02:09 -0700 | [diff] [blame] | 78 | |
| 79 | /** |
Jordan Halterman | c955df7 | 2017-02-04 20:43:28 -0800 | [diff] [blame] | 80 | * Creates a new {@code AsyncAtomicCounterMap}. |
| 81 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 82 | * @param options counter map options |
| 83 | * @param <K> key type |
| 84 | * @return atomic counter map |
| 85 | */ |
| 86 | <K> AsyncAtomicCounterMap<K> newAsyncAtomicCounterMap(AtomicCounterMapOptions options); |
Jordan Halterman | c955df7 | 2017-02-04 20:43:28 -0800 | [diff] [blame] | 87 | |
| 88 | /** |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 89 | * Creates a new {@code AsyncAtomicCounter}. |
| 90 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 91 | * @param options counter options |
| 92 | * @return counter |
| 93 | */ |
| 94 | AsyncAtomicCounter newAsyncCounter(AtomicCounterOptions options); |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 95 | |
| 96 | /** |
Jordan Halterman | 5a1053e | 2017-05-19 18:03:47 -0700 | [diff] [blame] | 97 | * Creates a new {@code AsyncAtomixIdGenerator}. |
| 98 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 99 | * @param options ID generator options |
| 100 | * @return ID generator |
| 101 | */ |
| 102 | AsyncAtomicIdGenerator newAsyncIdGenerator(AtomicIdGeneratorOptions options); |
Jordan Halterman | 5a1053e | 2017-05-19 18:03:47 -0700 | [diff] [blame] | 103 | |
| 104 | /** |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 105 | * Creates a new {@code AsyncAtomicValue}. |
| 106 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 107 | * @param options value options |
| 108 | * @param <V> value type |
| 109 | * @return value |
| 110 | */ |
| 111 | <V> AsyncAtomicValue<V> newAsyncAtomicValue(AtomicValueOptions options); |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 112 | |
| 113 | /** |
Madan Jampani | 837a363 | 2016-01-21 16:47:26 -0800 | [diff] [blame] | 114 | * Creates a new {@code AsyncDistributedSet}. |
| 115 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 116 | * @param options set options |
| 117 | * @param <E> set entry type |
| 118 | * @return set |
| 119 | */ |
| 120 | <E> AsyncDistributedSet<E> newAsyncDistributedSet(DistributedSetOptions options); |
Madan Jampani | 47b80ba | 2016-01-31 23:05:55 -0800 | [diff] [blame] | 121 | |
| 122 | /** |
Jordan Halterman | 4743258 | 2018-01-25 16:56:45 -0800 | [diff] [blame] | 123 | * Creates a new {@code AsyncDistributedLock}. |
| 124 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 125 | * @param options lock options |
| 126 | * @return lock |
| 127 | */ |
| 128 | AsyncDistributedLock newAsyncDistributedLock(DistributedLockOptions options); |
Jordan Halterman | 4743258 | 2018-01-25 16:56:45 -0800 | [diff] [blame] | 129 | |
| 130 | /** |
Madan Jampani | 47b80ba | 2016-01-31 23:05:55 -0800 | [diff] [blame] | 131 | * Creates a new {@code AsyncLeaderElector}. |
| 132 | * |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 133 | * @param options leader elector options |
| 134 | * @return leader elector |
| 135 | */ |
| 136 | AsyncLeaderElector newAsyncLeaderElector(LeaderElectorOptions options); |
Madan Jampani | e14a09c | 2016-02-11 10:43:21 -0800 | [diff] [blame] | 137 | |
| 138 | /** |
Madan Jampani | 35708a9 | 2016-07-06 10:48:19 -0700 | [diff] [blame] | 139 | * Creates a new {@code WorkQueue}. |
| 140 | * |
Ray Milkey | bb23e0b | 2016-08-02 17:00:21 -0700 | [diff] [blame] | 141 | * @param <E> work element type |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 142 | * @param options work queue options |
| 143 | * @return work queue |
| 144 | */ |
| 145 | <E> WorkQueue<E> newWorkQueue(WorkQueueOptions options); |
Madan Jampani | 35708a9 | 2016-07-06 10:48:19 -0700 | [diff] [blame] | 146 | |
| 147 | /** |
Madan Jampani | 2914e4e | 2016-09-13 17:48:56 -0700 | [diff] [blame] | 148 | * Creates a new {@code AsyncDocumentTree}. |
| 149 | * |
| 150 | * @param <V> document tree node value type |
Jordan Halterman | 2c04599 | 2018-03-20 21:33:00 -0700 | [diff] [blame] | 151 | * @param options tree options |
| 152 | * @return document tree |
| 153 | */ |
| 154 | <V> AsyncDocumentTree<V> newAsyncDocumentTree(DocumentTreeOptions options); |
Madan Jampani | 2914e4e | 2016-09-13 17:48:56 -0700 | [diff] [blame] | 155 | |
| 156 | /** |
Madan Jampani | e14a09c | 2016-02-11 10:43:21 -0800 | [diff] [blame] | 157 | * Returns the names of all created {@code AsyncConsistentMap} instances. |
| 158 | * @return set of {@code AsyncConsistentMap} names |
| 159 | */ |
| 160 | Set<String> getAsyncConsistentMapNames(); |
| 161 | |
| 162 | /** |
| 163 | * Returns the names of all created {@code AsyncAtomicCounter} instances. |
| 164 | * @return set of {@code AsyncAtomicCounter} names |
| 165 | */ |
| 166 | Set<String> getAsyncAtomicCounterNames(); |
Madan Jampani | 35708a9 | 2016-07-06 10:48:19 -0700 | [diff] [blame] | 167 | |
| 168 | /** |
| 169 | * Returns the names of all created {@code WorkQueue} instances. |
| 170 | * @return set of {@code WorkQueue} names |
| 171 | */ |
| 172 | Set<String> getWorkQueueNames(); |
Ray Milkey | bb23e0b | 2016-08-02 17:00:21 -0700 | [diff] [blame] | 173 | } |