blob: a8827a7b8201f00739289512a2e7e107bb47fd49 [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 Kruglikoved88ff62016-08-01 16:02:09 -070023import org.onosproject.store.service.AsyncConsistentTreeMap;
Madan Jampani837a3632016-01-21 16:47:26 -080024import org.onosproject.store.service.AsyncDistributedSet;
Madan Jampani47b80ba2016-01-31 23:05:55 -080025import org.onosproject.store.service.AsyncLeaderElector;
Madan Jampani35708a92016-07-06 10:48:19 -070026import org.onosproject.store.service.WorkQueue;
Madan Jampani837a3632016-01-21 16:47:26 -080027import org.onosproject.store.service.Serializer;
28
29/**
30 * Interface for entity that can create instances of different distributed primitives.
31 */
32public interface DistributedPrimitiveCreator {
33
34 /**
35 * Creates a new {@code AsyncConsistentMap}.
36 *
37 * @param name map name
38 * @param serializer serializer to use for serializing/deserializing map entries
39 * @param <K> key type
40 * @param <V> value type
41 * @return map
42 */
43 <K, V> AsyncConsistentMap<K, V> newAsyncConsistentMap(String name, Serializer serializer);
44
45 /**
Aaron Kruglikoved88ff62016-08-01 16:02:09 -070046 * Creates a new {@code AsyncConsistentTreeMap}.
47 *
48 * @param name tree name
49 * @param serializer serializer to use for serializing/deserializing map entries
50 * @param <V> value type
51 * @return distributedTreeMap
52 */
53 <V> AsyncConsistentTreeMap<V> newAsyncConsistentTreeMap(String name, Serializer serializer);
54
55 /**
Madan Jampani837a3632016-01-21 16:47:26 -080056 * Creates a new {@code AsyncAtomicCounter}.
57 *
58 * @param name counter name
59 * @return counter
60 */
61 AsyncAtomicCounter newAsyncCounter(String name);
62
63 /**
64 * Creates a new {@code AsyncAtomicValue}.
65 *
66 * @param name value name
67 * @param serializer serializer to use for serializing/deserializing value type
68 * @param <V> value type
69 * @return value
70 */
71 <V> AsyncAtomicValue<V> newAsyncAtomicValue(String name, Serializer serializer);
72
73 /**
Madan Jampani837a3632016-01-21 16:47:26 -080074 * Creates a new {@code AsyncDistributedSet}.
75 *
76 * @param name set name
77 * @param serializer serializer to use for serializing/deserializing set entries
78 * @param <E> set entry type
79 * @return set
80 */
81 <E> AsyncDistributedSet<E> newAsyncDistributedSet(String name, Serializer serializer);
Madan Jampani47b80ba2016-01-31 23:05:55 -080082
83 /**
84 * Creates a new {@code AsyncLeaderElector}.
85 *
86 * @param name leader elector name
87 * @return leader elector
88 */
89 AsyncLeaderElector newAsyncLeaderElector(String name);
Madan Jampanie14a09c2016-02-11 10:43:21 -080090
91 /**
Madan Jampani35708a92016-07-06 10:48:19 -070092 * Creates a new {@code WorkQueue}.
93 *
Ray Milkeybb23e0b2016-08-02 17:00:21 -070094 * @param <E> work element type
Madan Jampani35708a92016-07-06 10:48:19 -070095 * @param name work queue name
96 * @param serializer serializer
97 * @return work queue
98 */
99 <E> WorkQueue<E> newWorkQueue(String name, Serializer serializer);
100
101 /**
Madan Jampanie14a09c2016-02-11 10:43:21 -0800102 * Returns the names of all created {@code AsyncConsistentMap} instances.
103 * @return set of {@code AsyncConsistentMap} names
104 */
105 Set<String> getAsyncConsistentMapNames();
106
107 /**
108 * Returns the names of all created {@code AsyncAtomicCounter} instances.
109 * @return set of {@code AsyncAtomicCounter} names
110 */
111 Set<String> getAsyncAtomicCounterNames();
Madan Jampani35708a92016-07-06 10:48:19 -0700112
113 /**
114 * Returns the names of all created {@code WorkQueue} instances.
115 * @return set of {@code WorkQueue} names
116 */
117 Set<String> getWorkQueueNames();
Ray Milkeybb23e0b2016-08-02 17:00:21 -0700118}