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.net.URI;
13 import java.util.Collection;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.opendaylight.controller.cluster.access.concepts.MemberName;
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 URI 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(@NonNull URI namespace, @NonNull String moduleName, @NonNull String shardName,
41             @Nullable String shardStrategyName, @NonNull Collection<MemberName> shardMemberNames) {
42         this.namespace = requireNonNull(namespace, "nameSpace should not be null");
43         this.moduleName = requireNonNull(moduleName, "moduleName should not be null");
44         this.shardName = requireNonNull(shardName, "shardName should not be null");
45         this.shardStrategyName = shardStrategyName;
46         this.shardMemberNames = requireNonNull(shardMemberNames, "shardMemberNames");
47     }
48
49     public URI getNamespace() {
50         return namespace;
51     }
52
53     public String getModuleName() {
54         return moduleName;
55     }
56
57     public String getShardName() {
58         return shardName;
59     }
60
61     public String getShardStrategyName() {
62         return shardStrategyName;
63     }
64
65     public Collection<MemberName> getShardMemberNames() {
66         return shardMemberNames;
67     }
68
69     @Override
70     public String toString() {
71         return "ModuleShardConfiguration [namespace=" + namespace + ", moduleName=" + moduleName + ", shardName="
72                 + shardName + ", shardMemberNames=" + shardMemberNames + ", shardStrategyName=" + shardStrategyName
73                 + "]";
74     }
75 }