blob: 646dc28cc973e7c691a358b907a2b1f561871325 [file] [log] [blame]
Madan Jampani63c659f2015-06-11 00:52:58 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
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.service;
17
18/**
19 * Builder for distributed queue.
20 *
21 * @param <E> type queue elements.
22 */
23public interface DistributedQueueBuilder<E> {
24
25 /**
26 * Sets the name of the queue.
27 * <p>
28 * Each queue is identified by a unique name.
29 * </p>
30 * <p>
31 * Note: This is a mandatory parameter.
32 * </p>
33 *
34 * @param name name of the queue
35 * @return this DistributedQueueBuilder for method chaining
36 */
37 DistributedQueueBuilder<E> withName(String name);
38
39 /**
40 * Sets a serializer that can be used to serialize
41 * the elements pushed into the queue. The serializer
42 * builder should be pre-populated with any classes that will be
43 * put into the queue.
44 * <p>
45 * Note: This is a mandatory parameter.
46 * </p>
47 *
48 * @param serializer serializer
49 * @return this DistributedQueueBuilder for method chaining
50 */
51 DistributedQueueBuilder<E> withSerializer(Serializer serializer);
52
53 /**
Flavio Castro41b1f3a2015-07-31 13:51:32 -070054 *
55 *
56 * @return this DistributedQueueBuilder for method chaining
57 */
58 DistributedQueueBuilder<E> withMeteringDisabled();
59
60
61 /**
Madan Jampani63c659f2015-06-11 00:52:58 -070062 * Disables persistence of queues entries.
63 * <p>
64 * When persistence is disabled, a full cluster restart will wipe out all
65 * queue entries.
66 * </p>
67 * @return this DistributedQueueBuilder for method chaining
68 */
69 DistributedQueueBuilder<E> withPersistenceDisabled();
70
71 /**
72 * Builds a queue based on the configuration options
73 * supplied to this builder.
74 *
75 * @return new distributed queue
76 * @throws java.lang.RuntimeException if a mandatory parameter is missing
77 */
78 DistributedQueue<E> build();
79}