blob: 1f32f5e635cfe00342a161c9a76a05355bafb7d8 [file] [log] [blame]
Madan Jampani63c659f2015-06-11 00:52:58 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Madan Jampani63c659f2015-06-11 00:52:58 -07003 *
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 /**
Madan Jampani63c659f2015-06-11 00:52:58 -070054 * Builds a queue based on the configuration options
55 * supplied to this builder.
56 *
57 * @return new distributed queue
58 * @throws java.lang.RuntimeException if a mandatory parameter is missing
59 */
60 DistributedQueue<E> build();
61}