blob: 8819977bc575f45c59fdc1b5e739bb280ee3d7be [file] [log] [blame]
Madan Jampanib5d72d52015-04-03 16:53:50 -07001package org.onosproject.store.service;
2
3/**
4 * Builder for AtomicCounter.
5 */
6public interface AtomicCounterBuilder {
7
8 /**
9 * Sets the name for the atomic counter.
10 * <p>
11 * Each atomic counter is identified by a unique name.
12 * </p>
13 * <p>
14 * Note: This is a mandatory parameter.
15 * </p>
16 *
17 * @param name name of the atomic counter
18 * @return this AtomicCounterBuilder
19 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070020 AtomicCounterBuilder withName(String name);
Madan Jampanib5d72d52015-04-03 16:53:50 -070021
22 /**
23 * Creates this counter on the partition that spans the entire cluster.
24 * <p>
25 * When partitioning is disabled, the counter state will be
26 * ephemeral and does not survive a full cluster restart.
27 * </p>
28 * <p>
29 * Note: By default partitions are enabled.
30 * </p>
31 * @return this AtomicCounterBuilder
32 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070033 AtomicCounterBuilder withPartitionsDisabled();
Madan Jampanib5d72d52015-04-03 16:53:50 -070034
35 /**
36 * Builds a AtomicCounter based on the configuration options
37 * supplied to this builder.
38 *
39 * @return new AtomicCounter
40 * @throws java.lang.RuntimeException if a mandatory parameter is missing
41 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070042 AtomicCounter build();
Madan Jampanib5d72d52015-04-03 16:53:50 -070043
44 /**
45 * Builds a AsyncAtomicCounter based on the configuration options
46 * supplied to this builder.
47 *
48 * @return new AsyncAtomicCounter
49 * @throws java.lang.RuntimeException if a mandatory parameter is missing
50 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070051 AsyncAtomicCounter buildAsyncCounter();
Madan Jampanib5d72d52015-04-03 16:53:50 -070052}