blob: 436457d66dda61b7eef20a83f6d9860adb9b2d87 [file] [log] [blame]
Jihwan Kim1f536272015-12-18 03:10:09 +09001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Jihwan Kim1f536272015-12-18 03:10:09 +09003 *
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 AtomicCounterMap.
20 */
21public interface AtomicCounterMapBuilder<K> {
22
23 /**
24 * Sets the name for the atomic counter map.
25 * <p>
26 * Each atomic counter map is identified by a unique name.
27 * </p>
28 * <p>
29 * Note: This is a mandatory parameter.
30 * </p>
31 *
32 * @param name name of the atomic counter
33 * @return this AtomicCounterMapBuilder
34 */
35 AtomicCounterMapBuilder<K> withName(String name);
36
37 /**
38 * Creates this counter map on the partition that spans the entire cluster.
39 * <p>
40 * When partitioning is disabled, the counter state will be
41 * ephemeral and does not survive a full cluster restart.
42 * </p>
43 * <p>
44 * Note: By default partitions are enabled.
45 * </p>
46 * @return this AtomicCounterMapBuilder
47 */
48 AtomicCounterMapBuilder<K> withPartitionsDisabled();
49
50 /**
51 * Instantiates Metering service to gather usage and performance metrics.
52 * By default, usage data will be stored.
53 *
54 * @return this AtomicCounterMapBuilder
55 */
56 AtomicCounterMapBuilder<K> withMeteringDisabled();
57
58 /**
59 * Builds a AtomicCounterMap based on the configuration options
60 * supplied to this builder.
61 *
62 * @return new AtomicCounterMap
63 * @throws java.lang.RuntimeException if a mandatory parameter is missing
64 */
65 AtomicCounterMap<K> build();
66
67 /**
68 * Builds a AsyncAtomicCounterMap based on the configuration options
69 * supplied to this builder.
70 *
71 * @return new AsyncAtomicCounterMap
72 * @throws java.lang.RuntimeException if a mandatory parameter is missing
73 */
74 AsyncAtomicCounterMap<K> buildAsyncAtomicCounterMap();
75}