blob: 3dad8e05fbc36b15d0ed447a5732ce605fe201c2 [file] [log] [blame]
Madan Jampani25461112015-02-17 14:17:29 -08001/*
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 */
16
Madan Jampani94c23532015-02-05 17:40:01 -080017package org.onosproject.store.consistent.impl;
18
19import java.util.Collections;
20import java.util.HashMap;
21import java.util.Map;
22
23/**
24 * Partitioned database configuration.
25 */
26public class PartitionedDatabaseConfig {
27 private final Map<String, DatabaseConfig> partitions = new HashMap<>();
28
29 /**
30 * Returns the configuration for all partitions.
31 * @return partition map to configuartion mapping.
32 */
33 public Map<String, DatabaseConfig> partitions() {
34 return Collections.unmodifiableMap(partitions);
35 }
36
37 /**
38 * Adds the specified partition name and configuration.
39 * @param name partition name.
40 * @param config partition config
41 * @return this instance
42 */
Madan Jampani09342702015-02-05 23:32:40 -080043 public PartitionedDatabaseConfig addPartition(String name, DatabaseConfig config) {
Madan Jampani94c23532015-02-05 17:40:01 -080044 partitions.put(name, config);
45 return this;
46 }
47}