blob: 41a19f0df621917ce0905fd0af8988befdde41b8 [file] [log] [blame]
Madan Jampani619453b2015-07-22 23:47:09 -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 */
Madan Jampanib5d72d52015-04-03 16:53:50 -070016package org.onosproject.store.service;
17
18/**
19 * Builder for AtomicCounter.
20 */
21public interface AtomicCounterBuilder {
22
23 /**
24 * Sets the name for the atomic counter.
25 * <p>
26 * Each atomic counter 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 AtomicCounterBuilder
34 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070035 AtomicCounterBuilder withName(String name);
Madan Jampanib5d72d52015-04-03 16:53:50 -070036
37 /**
38 * Creates this counter 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 AtomicCounterBuilder
47 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070048 AtomicCounterBuilder withPartitionsDisabled();
Madan Jampanib5d72d52015-04-03 16:53:50 -070049
50 /**
Flavio Castro41b1f3a2015-07-31 13:51:32 -070051 * Instantiates Metering service to gather usage and performance metrics.
52 * By default, usage data will be stored.
53 *
54 * @return this AtomicCounterBuilder
55 */
56 AtomicCounterBuilder withMeteringDisabled();
57
58 /**
Madan Jampanib5d72d52015-04-03 16:53:50 -070059 * Builds a AtomicCounter based on the configuration options
60 * supplied to this builder.
61 *
62 * @return new AtomicCounter
63 * @throws java.lang.RuntimeException if a mandatory parameter is missing
64 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070065 AtomicCounter build();
Madan Jampanib5d72d52015-04-03 16:53:50 -070066
67 /**
68 * Builds a AsyncAtomicCounter based on the configuration options
69 * supplied to this builder.
70 *
71 * @return new AsyncAtomicCounter
72 * @throws java.lang.RuntimeException if a mandatory parameter is missing
73 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070074 AsyncAtomicCounter buildAsyncCounter();
Madan Jampanib5d72d52015-04-03 16:53:50 -070075}