blob: ee8481d24d86e1a95ebf11560caef0947d2ff427 [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 */
20 public AtomicCounterBuilder withName(String name);
21
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 */
33 public AtomicCounterBuilder withPartitionsDisabled();
34
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 */
42 public AtomicCounter build();
43
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 */
51 public AsyncAtomicCounter buildAsyncCounter();
52}