blob: f44ec1f0b6ffd723e8c5e600f85858567cdcde51 [file] [log] [blame]
Madan Jampani837a3632016-01-21 16:47:26 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Madan Jampani837a3632016-01-21 16:47:26 -08003 *
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 */
16package org.onosproject.store.primitives;
17
18import org.onosproject.store.service.AsyncAtomicCounter;
Jordan Haltermanc955df72017-02-04 20:43:28 -080019import org.onosproject.store.service.AsyncAtomicCounterMap;
Jordan Halterman5a1053e2017-05-19 18:03:47 -070020import org.onosproject.store.service.AsyncAtomicIdGenerator;
Madan Jampani837a3632016-01-21 16:47:26 -080021import org.onosproject.store.service.AsyncAtomicValue;
22import org.onosproject.store.service.AsyncConsistentMap;
Aaron Kruglikov61582a02016-09-06 13:18:58 -070023import org.onosproject.store.service.AsyncConsistentMultimap;
Aaron Kruglikoved88ff62016-08-01 16:02:09 -070024import org.onosproject.store.service.AsyncConsistentTreeMap;
Jordan Halterman47432582018-01-25 16:56:45 -080025import org.onosproject.store.service.AsyncDistributedLock;
Madan Jampani837a3632016-01-21 16:47:26 -080026import org.onosproject.store.service.AsyncDistributedSet;
Madan Jampani2914e4e2016-09-13 17:48:56 -070027import org.onosproject.store.service.AsyncDocumentTree;
Madan Jampani47b80ba2016-01-31 23:05:55 -080028import org.onosproject.store.service.AsyncLeaderElector;
Jordan Halterman2c045992018-03-20 21:33:00 -070029import org.onosproject.store.service.AtomicCounterMapOptions;
30import org.onosproject.store.service.AtomicCounterOptions;
31import org.onosproject.store.service.AtomicIdGeneratorOptions;
32import org.onosproject.store.service.AtomicValueOptions;
33import org.onosproject.store.service.ConsistentMapOptions;
34import org.onosproject.store.service.ConsistentMultimapOptions;
35import org.onosproject.store.service.ConsistentTreeMapOptions;
36import org.onosproject.store.service.DistributedLockOptions;
37import org.onosproject.store.service.DistributedSetOptions;
38import org.onosproject.store.service.DocumentTreeOptions;
39import org.onosproject.store.service.LeaderElectorOptions;
Madan Jampani2914e4e2016-09-13 17:48:56 -070040import org.onosproject.store.service.WorkQueue;
Jordan Halterman2c045992018-03-20 21:33:00 -070041import org.onosproject.store.service.WorkQueueOptions;
Madan Jampani837a3632016-01-21 16:47:26 -080042
Ray Milkey68372932018-09-21 11:00:46 -070043import java.util.Set;
Jordan Halterman7b7644f2017-10-16 12:57:55 -070044
Madan Jampani837a3632016-01-21 16:47:26 -080045/**
46 * Interface for entity that can create instances of different distributed primitives.
47 */
48public interface DistributedPrimitiveCreator {
49
50 /**
51 * Creates a new {@code AsyncConsistentMap}.
52 *
Jordan Halterman2c045992018-03-20 21:33:00 -070053 * @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 Jampani837a3632016-01-21 16:47:26 -080059
60 /**
Aaron Kruglikoved88ff62016-08-01 16:02:09 -070061 * Creates a new {@code AsyncConsistentTreeMap}.
62 *
Jordan Halterman2c045992018-03-20 21:33:00 -070063 * @param options tree map options
64 * @param <V> value type
65 * @return distributedTreeMap
66 */
67 <V> AsyncConsistentTreeMap<V> newAsyncConsistentTreeMap(ConsistentTreeMapOptions options);
Aaron Kruglikov61582a02016-09-06 13:18:58 -070068
69 /**
70 * Creates a new set backed {@code AsyncConsistentMultimap}.
71 *
Jordan Halterman2c045992018-03-20 21:33:00 -070072 * @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 Kruglikoved88ff62016-08-01 16:02:09 -070078
79 /**
Jordan Haltermanc955df72017-02-04 20:43:28 -080080 * Creates a new {@code AsyncAtomicCounterMap}.
81 *
Jordan Halterman2c045992018-03-20 21:33:00 -070082 * @param options counter map options
83 * @param <K> key type
84 * @return atomic counter map
85 */
86 <K> AsyncAtomicCounterMap<K> newAsyncAtomicCounterMap(AtomicCounterMapOptions options);
Jordan Haltermanc955df72017-02-04 20:43:28 -080087
88 /**
Madan Jampani837a3632016-01-21 16:47:26 -080089 * Creates a new {@code AsyncAtomicCounter}.
90 *
Jordan Halterman2c045992018-03-20 21:33:00 -070091 * @param options counter options
92 * @return counter
93 */
94 AsyncAtomicCounter newAsyncCounter(AtomicCounterOptions options);
Madan Jampani837a3632016-01-21 16:47:26 -080095
96 /**
Jordan Halterman5a1053e2017-05-19 18:03:47 -070097 * Creates a new {@code AsyncAtomixIdGenerator}.
98 *
Jordan Halterman2c045992018-03-20 21:33:00 -070099 * @param options ID generator options
100 * @return ID generator
101 */
102 AsyncAtomicIdGenerator newAsyncIdGenerator(AtomicIdGeneratorOptions options);
Jordan Halterman5a1053e2017-05-19 18:03:47 -0700103
104 /**
Madan Jampani837a3632016-01-21 16:47:26 -0800105 * Creates a new {@code AsyncAtomicValue}.
106 *
Jordan Halterman2c045992018-03-20 21:33:00 -0700107 * @param options value options
108 * @param <V> value type
109 * @return value
110 */
111 <V> AsyncAtomicValue<V> newAsyncAtomicValue(AtomicValueOptions options);
Madan Jampani837a3632016-01-21 16:47:26 -0800112
113 /**
Madan Jampani837a3632016-01-21 16:47:26 -0800114 * Creates a new {@code AsyncDistributedSet}.
115 *
Jordan Halterman2c045992018-03-20 21:33:00 -0700116 * @param options set options
117 * @param <E> set entry type
118 * @return set
119 */
120 <E> AsyncDistributedSet<E> newAsyncDistributedSet(DistributedSetOptions options);
Madan Jampani47b80ba2016-01-31 23:05:55 -0800121
122 /**
Jordan Halterman47432582018-01-25 16:56:45 -0800123 * Creates a new {@code AsyncDistributedLock}.
124 *
Jordan Halterman2c045992018-03-20 21:33:00 -0700125 * @param options lock options
126 * @return lock
127 */
128 AsyncDistributedLock newAsyncDistributedLock(DistributedLockOptions options);
Jordan Halterman47432582018-01-25 16:56:45 -0800129
130 /**
Madan Jampani47b80ba2016-01-31 23:05:55 -0800131 * Creates a new {@code AsyncLeaderElector}.
132 *
Jordan Halterman2c045992018-03-20 21:33:00 -0700133 * @param options leader elector options
134 * @return leader elector
135 */
136 AsyncLeaderElector newAsyncLeaderElector(LeaderElectorOptions options);
Madan Jampanie14a09c2016-02-11 10:43:21 -0800137
138 /**
Madan Jampani35708a92016-07-06 10:48:19 -0700139 * Creates a new {@code WorkQueue}.
140 *
Ray Milkeybb23e0b2016-08-02 17:00:21 -0700141 * @param <E> work element type
Jordan Halterman2c045992018-03-20 21:33:00 -0700142 * @param options work queue options
143 * @return work queue
144 */
145 <E> WorkQueue<E> newWorkQueue(WorkQueueOptions options);
Madan Jampani35708a92016-07-06 10:48:19 -0700146
147 /**
Madan Jampani2914e4e2016-09-13 17:48:56 -0700148 * Creates a new {@code AsyncDocumentTree}.
149 *
150 * @param <V> document tree node value type
Jordan Halterman2c045992018-03-20 21:33:00 -0700151 * @param options tree options
152 * @return document tree
153 */
154 <V> AsyncDocumentTree<V> newAsyncDocumentTree(DocumentTreeOptions options);
Madan Jampani2914e4e2016-09-13 17:48:56 -0700155
156 /**
Madan Jampanie14a09c2016-02-11 10:43:21 -0800157 * 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 Jampani35708a92016-07-06 10:48:19 -0700167
168 /**
169 * Returns the names of all created {@code WorkQueue} instances.
170 * @return set of {@code WorkQueue} names
171 */
172 Set<String> getWorkQueueNames();
Ray Milkeybb23e0b2016-08-02 17:00:21 -0700173}