blob: 5080b82306dc83ee71de17e7518761fd341a0626 [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;
23import org.onosproject.store.service.AsyncDistributedSet;
Madan Jampani47b80ba2016-01-31 23:05:55 -080024import org.onosproject.store.service.AsyncLeaderElector;
Madan Jampani35708a92016-07-06 10:48:19 -070025import org.onosproject.store.service.WorkQueue;
Madan Jampani837a3632016-01-21 16:47:26 -080026import org.onosproject.store.service.Serializer;
27
28/**
29 * Interface for entity that can create instances of different distributed primitives.
30 */
31public interface DistributedPrimitiveCreator {
32
33 /**
34 * Creates a new {@code AsyncConsistentMap}.
35 *
36 * @param name map name
37 * @param serializer serializer to use for serializing/deserializing map entries
38 * @param <K> key type
39 * @param <V> value type
40 * @return map
41 */
42 <K, V> AsyncConsistentMap<K, V> newAsyncConsistentMap(String name, Serializer serializer);
43
44 /**
45 * Creates a new {@code AsyncAtomicCounter}.
46 *
47 * @param name counter name
48 * @return counter
49 */
50 AsyncAtomicCounter newAsyncCounter(String name);
51
52 /**
53 * Creates a new {@code AsyncAtomicValue}.
54 *
55 * @param name value name
56 * @param serializer serializer to use for serializing/deserializing value type
57 * @param <V> value type
58 * @return value
59 */
60 <V> AsyncAtomicValue<V> newAsyncAtomicValue(String name, Serializer serializer);
61
62 /**
Madan Jampani837a3632016-01-21 16:47:26 -080063 * Creates a new {@code AsyncDistributedSet}.
64 *
65 * @param name set name
66 * @param serializer serializer to use for serializing/deserializing set entries
67 * @param <E> set entry type
68 * @return set
69 */
70 <E> AsyncDistributedSet<E> newAsyncDistributedSet(String name, Serializer serializer);
Madan Jampani47b80ba2016-01-31 23:05:55 -080071
72 /**
73 * Creates a new {@code AsyncLeaderElector}.
74 *
75 * @param name leader elector name
76 * @return leader elector
77 */
78 AsyncLeaderElector newAsyncLeaderElector(String name);
Madan Jampanie14a09c2016-02-11 10:43:21 -080079
80 /**
Madan Jampani35708a92016-07-06 10:48:19 -070081 * Creates a new {@code WorkQueue}.
82 *
Ray Milkeybb23e0b2016-08-02 17:00:21 -070083 * @param <E> work element type
Madan Jampani35708a92016-07-06 10:48:19 -070084 * @param name work queue name
85 * @param serializer serializer
86 * @return work queue
87 */
88 <E> WorkQueue<E> newWorkQueue(String name, Serializer serializer);
89
90 /**
Madan Jampanie14a09c2016-02-11 10:43:21 -080091 * Returns the names of all created {@code AsyncConsistentMap} instances.
92 * @return set of {@code AsyncConsistentMap} names
93 */
94 Set<String> getAsyncConsistentMapNames();
95
96 /**
97 * Returns the names of all created {@code AsyncAtomicCounter} instances.
98 * @return set of {@code AsyncAtomicCounter} names
99 */
100 Set<String> getAsyncAtomicCounterNames();
Madan Jampani35708a92016-07-06 10:48:19 -0700101
102 /**
103 * Returns the names of all created {@code WorkQueue} instances.
104 * @return set of {@code WorkQueue} names
105 */
106 Set<String> getWorkQueueNames();
Ray Milkeybb23e0b2016-08-02 17:00:21 -0700107}