blob: 2e986c4aaeba305982afe8e2ebbf6cdc1e5a4806 [file] [log] [blame]
Madan Jampani837a3632016-01-21 16:47:26 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
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
Madan Jampanie14a09c2016-02-11 10:43:21 -080018import java.util.Set;
19
Madan Jampani837a3632016-01-21 16:47:26 -080020import org.onosproject.store.service.AsyncAtomicCounter;
21import 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;
Madan Jampani837a3632016-01-21 16:47:26 -080025import org.onosproject.store.service.AsyncDistributedSet;
Madan Jampani2914e4e2016-09-13 17:48:56 -070026import org.onosproject.store.service.AsyncDocumentTree;
Madan Jampani47b80ba2016-01-31 23:05:55 -080027import org.onosproject.store.service.AsyncLeaderElector;
Madan Jampani837a3632016-01-21 16:47:26 -080028import org.onosproject.store.service.Serializer;
Madan Jampani2914e4e2016-09-13 17:48:56 -070029import org.onosproject.store.service.WorkQueue;
Madan Jampani837a3632016-01-21 16:47:26 -080030
31/**
32 * Interface for entity that can create instances of different distributed primitives.
33 */
34public interface DistributedPrimitiveCreator {
35
36 /**
37 * Creates a new {@code AsyncConsistentMap}.
38 *
39 * @param name map name
40 * @param serializer serializer to use for serializing/deserializing map entries
41 * @param <K> key type
42 * @param <V> value type
43 * @return map
44 */
45 <K, V> AsyncConsistentMap<K, V> newAsyncConsistentMap(String name, Serializer serializer);
46
47 /**
Aaron Kruglikoved88ff62016-08-01 16:02:09 -070048 * Creates a new {@code AsyncConsistentTreeMap}.
49 *
50 * @param name tree name
51 * @param serializer serializer to use for serializing/deserializing map entries
52 * @param <V> value type
53 * @return distributedTreeMap
54 */
Aaron Kruglikov61582a02016-09-06 13:18:58 -070055 <V> AsyncConsistentTreeMap<V> newAsyncConsistentTreeMap(
56 String name, Serializer serializer);
57
58 /**
59 * Creates a new set backed {@code AsyncConsistentMultimap}.
60 *
61 * @param name multimap name
62 * @param serializer serializer to use for serializing/deserializing
63 * @param <K> key type
64 * @param <V> value type
65 * @return set backed distributedMultimap
66 */
67 <K, V> AsyncConsistentMultimap<K, V> newAsyncConsistentSetMultimap(
68 String name, Serializer serializer);
Aaron Kruglikoved88ff62016-08-01 16:02:09 -070069
70 /**
Madan Jampani837a3632016-01-21 16:47:26 -080071 * Creates a new {@code AsyncAtomicCounter}.
72 *
73 * @param name counter name
74 * @return counter
75 */
76 AsyncAtomicCounter newAsyncCounter(String name);
77
78 /**
79 * Creates a new {@code AsyncAtomicValue}.
80 *
81 * @param name value name
82 * @param serializer serializer to use for serializing/deserializing value type
83 * @param <V> value type
84 * @return value
85 */
86 <V> AsyncAtomicValue<V> newAsyncAtomicValue(String name, Serializer serializer);
87
88 /**
Madan Jampani837a3632016-01-21 16:47:26 -080089 * Creates a new {@code AsyncDistributedSet}.
90 *
91 * @param name set name
92 * @param serializer serializer to use for serializing/deserializing set entries
93 * @param <E> set entry type
94 * @return set
95 */
96 <E> AsyncDistributedSet<E> newAsyncDistributedSet(String name, Serializer serializer);
Madan Jampani47b80ba2016-01-31 23:05:55 -080097
98 /**
99 * Creates a new {@code AsyncLeaderElector}.
100 *
101 * @param name leader elector name
102 * @return leader elector
103 */
104 AsyncLeaderElector newAsyncLeaderElector(String name);
Madan Jampanie14a09c2016-02-11 10:43:21 -0800105
106 /**
Madan Jampani35708a92016-07-06 10:48:19 -0700107 * Creates a new {@code WorkQueue}.
108 *
Ray Milkeybb23e0b2016-08-02 17:00:21 -0700109 * @param <E> work element type
Madan Jampani35708a92016-07-06 10:48:19 -0700110 * @param name work queue name
111 * @param serializer serializer
112 * @return work queue
113 */
114 <E> WorkQueue<E> newWorkQueue(String name, Serializer serializer);
115
116 /**
Madan Jampani2914e4e2016-09-13 17:48:56 -0700117 * Creates a new {@code AsyncDocumentTree}.
118 *
119 * @param <V> document tree node value type
120 * @param name tree name
121 * @param serializer serializer
122 * @return document tree
123 */
124 <V> AsyncDocumentTree<V> newAsyncDocumentTree(String name, Serializer serializer);
125
126 /**
Madan Jampanie14a09c2016-02-11 10:43:21 -0800127 * Returns the names of all created {@code AsyncConsistentMap} instances.
128 * @return set of {@code AsyncConsistentMap} names
129 */
130 Set<String> getAsyncConsistentMapNames();
131
132 /**
133 * Returns the names of all created {@code AsyncAtomicCounter} instances.
134 * @return set of {@code AsyncAtomicCounter} names
135 */
136 Set<String> getAsyncAtomicCounterNames();
Madan Jampani35708a92016-07-06 10:48:19 -0700137
138 /**
139 * Returns the names of all created {@code WorkQueue} instances.
140 * @return set of {@code WorkQueue} names
141 */
142 Set<String> getWorkQueueNames();
Ray Milkeybb23e0b2016-08-02 17:00:21 -0700143}