Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / config / ModuleShardConfiguration.java
1 /*
2  * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.datastore.config;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.util.Collection;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.jdt.annotation.Nullable;
15 import org.opendaylight.controller.cluster.access.concepts.MemberName;
16 import org.opendaylight.yangtools.yang.common.XMLNamespace;
17
18 /**
19  * Encapsulates information for adding a new module shard configuration.
20  *
21  * @author Thomas Pantelis
22  */
23 public class ModuleShardConfiguration {
24     private final XMLNamespace namespace;
25     private final String moduleName;
26     private final String shardName;
27     private final String shardStrategyName;
28     private final Collection<MemberName> shardMemberNames;
29
30     /**
31      * Constructs a new instance.
32      *
33      * @param namespace the name space of the module.
34      * @param moduleName the name of the module.
35      * @param shardName the name of the shard.
36      * @param shardStrategyName the name of the sharding strategy (eg "module"). If null the default strategy
37      *                          is used.
38      * @param shardMemberNames the names of the shard's member replicas.
39      */
40     public ModuleShardConfiguration(final @NonNull XMLNamespace namespace, final @NonNull String moduleName,
41             final @NonNull String shardName, final @Nullable String shardStrategyName,
42             final @NonNull Collection<MemberName> shardMemberNames) {
43         this.namespace = requireNonNull(namespace, "nameSpace should not be null");
44         this.moduleName = requireNonNull(moduleName, "moduleName should not be null");
45         this.shardName = requireNonNull(shardName, "shardName should not be null");
46         this.shardStrategyName = shardStrategyName;
47         this.shardMemberNames = requireNonNull(shardMemberNames, "shardMemberNames");
48     }
49
50     public XMLNamespace getNamespace() {
51         return namespace;
52     }
53
54     public String getModuleName() {
55         return moduleName;
56     }
57
58     public String getShardName() {
59         return shardName;
60     }
61
62     public String getShardStrategyName() {
63         return shardStrategyName;
64     }
65
66     public Collection<MemberName> getShardMemberNames() {
67         return shardMemberNames;
68     }
69
70     @Override
71     public String toString() {
72         return "ModuleShardConfiguration [namespace=" + namespace + ", moduleName=" + moduleName + ", shardName="
73                 + shardName + ", shardMemberNames=" + shardMemberNames + ", shardStrategyName=" + shardStrategyName
74                 + "]";
75     }
76 }