blob: 2316dd11b42101845586e7ee84bbd58637e32a84 [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 Jampani837a3632016-01-21 16:47:26 -080025import org.onosproject.store.service.DistributedQueue;
26import 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 /**
63 * Creates a new {@code DistributedQueue}.
64 *
65 * @param name queue name
66 * @param serializer serializer to use for serializing/deserializing queue entries
67 * @param <E> queue entry type
68 * @return queue
69 */
70 <E> DistributedQueue<E> newDistributedQueue(String name, Serializer serializer);
71
72 /**
73 * Creates a new {@code AsyncDistributedSet}.
74 *
75 * @param name set name
76 * @param serializer serializer to use for serializing/deserializing set entries
77 * @param <E> set entry type
78 * @return set
79 */
80 <E> AsyncDistributedSet<E> newAsyncDistributedSet(String name, Serializer serializer);
Madan Jampani47b80ba2016-01-31 23:05:55 -080081
82 /**
83 * Creates a new {@code AsyncLeaderElector}.
84 *
85 * @param name leader elector name
86 * @return leader elector
87 */
88 AsyncLeaderElector newAsyncLeaderElector(String name);
Madan Jampanie14a09c2016-02-11 10:43:21 -080089
90 /**
91 * 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 Jampani837a3632016-01-21 16:47:26 -0800101}