blob: b0a25f20155ef4ba58c64baabbe203a3e48b2e46 [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 Jampani2914e4e2016-09-13 17:48:56 -070025import org.onosproject.store.service.AsyncDocumentTree;
Madan Jampani47b80ba2016-01-31 23:05:55 -080026import org.onosproject.store.service.AsyncLeaderElector;
Madan Jampani837a3632016-01-21 16:47:26 -080027import org.onosproject.store.service.Serializer;
Madan Jampani2914e4e2016-09-13 17:48:56 -070028import org.onosproject.store.service.WorkQueue;
Madan Jampani837a3632016-01-21 16:47:26 -080029
30/**
31 * Interface for entity that can create instances of different distributed primitives.
32 */
33public interface DistributedPrimitiveCreator {
34
35 /**
36 * Creates a new {@code AsyncConsistentMap}.
37 *
38 * @param name map name
39 * @param serializer serializer to use for serializing/deserializing map entries
40 * @param <K> key type
41 * @param <V> value type
42 * @return map
43 */
44 <K, V> AsyncConsistentMap<K, V> newAsyncConsistentMap(String name, Serializer serializer);
45
46 /**
Aaron Kruglikoved88ff62016-08-01 16:02:09 -070047 * Creates a new {@code AsyncConsistentTreeMap}.
48 *
49 * @param name tree name
50 * @param serializer serializer to use for serializing/deserializing map entries
51 * @param <V> value type
52 * @return distributedTreeMap
53 */
54 <V> AsyncConsistentTreeMap<V> newAsyncConsistentTreeMap(String name, Serializer serializer);
55
56 /**
Madan Jampani837a3632016-01-21 16:47:26 -080057 * Creates a new {@code AsyncAtomicCounter}.
58 *
59 * @param name counter name
60 * @return counter
61 */
62 AsyncAtomicCounter newAsyncCounter(String name);
63
64 /**
65 * Creates a new {@code AsyncAtomicValue}.
66 *
67 * @param name value name
68 * @param serializer serializer to use for serializing/deserializing value type
69 * @param <V> value type
70 * @return value
71 */
72 <V> AsyncAtomicValue<V> newAsyncAtomicValue(String name, Serializer serializer);
73
74 /**
Madan Jampani837a3632016-01-21 16:47:26 -080075 * Creates a new {@code AsyncDistributedSet}.
76 *
77 * @param name set name
78 * @param serializer serializer to use for serializing/deserializing set entries
79 * @param <E> set entry type
80 * @return set
81 */
82 <E> AsyncDistributedSet<E> newAsyncDistributedSet(String name, Serializer serializer);
Madan Jampani47b80ba2016-01-31 23:05:55 -080083
84 /**
85 * Creates a new {@code AsyncLeaderElector}.
86 *
87 * @param name leader elector name
88 * @return leader elector
89 */
90 AsyncLeaderElector newAsyncLeaderElector(String name);
Madan Jampanie14a09c2016-02-11 10:43:21 -080091
92 /**
Madan Jampani35708a92016-07-06 10:48:19 -070093 * Creates a new {@code WorkQueue}.
94 *
Ray Milkeybb23e0b2016-08-02 17:00:21 -070095 * @param <E> work element type
Madan Jampani35708a92016-07-06 10:48:19 -070096 * @param name work queue name
97 * @param serializer serializer
98 * @return work queue
99 */
100 <E> WorkQueue<E> newWorkQueue(String name, Serializer serializer);
101
102 /**
Madan Jampani2914e4e2016-09-13 17:48:56 -0700103 * Creates a new {@code AsyncDocumentTree}.
104 *
105 * @param <V> document tree node value type
106 * @param name tree name
107 * @param serializer serializer
108 * @return document tree
109 */
110 <V> AsyncDocumentTree<V> newAsyncDocumentTree(String name, Serializer serializer);
111
112 /**
Madan Jampanie14a09c2016-02-11 10:43:21 -0800113 * Returns the names of all created {@code AsyncConsistentMap} instances.
114 * @return set of {@code AsyncConsistentMap} names
115 */
116 Set<String> getAsyncConsistentMapNames();
117
118 /**
119 * Returns the names of all created {@code AsyncAtomicCounter} instances.
120 * @return set of {@code AsyncAtomicCounter} names
121 */
122 Set<String> getAsyncAtomicCounterNames();
Madan Jampani35708a92016-07-06 10:48:19 -0700123
124 /**
125 * Returns the names of all created {@code WorkQueue} instances.
126 * @return set of {@code WorkQueue} names
127 */
128 Set<String> getWorkQueueNames();
Ray Milkeybb23e0b2016-08-02 17:00:21 -0700129}