9c33cf0810ab0aa7335f243a6b9178356659a864
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / RemovePrefixShardReplica.java
1 /*
2  * Copyright (c) 2017 Cisco 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
9 package org.opendaylight.controller.cluster.datastore.messages;
10
11 import com.google.common.base.Preconditions;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.controller.cluster.access.concepts.MemberName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15
16 /**
17  * A message sent to the ShardManager to dynamically remove a local prefix shard
18  *  replica available in this node.
19  */
20 public class RemovePrefixShardReplica {
21
22     private final YangInstanceIdentifier prefix;
23     private final MemberName memberName;
24
25     /**
26      * Constructor.
27      *
28      * @param prefix prefix of the local shard that is to be dynamically removed.
29      */
30     public RemovePrefixShardReplica(@Nonnull final YangInstanceIdentifier prefix,
31                                     @Nonnull final MemberName memberName) {
32         this.prefix = Preconditions.checkNotNull(prefix, "prefix should not be null");
33         this.memberName = Preconditions.checkNotNull(memberName, "memberName should not be null");
34     }
35
36     public YangInstanceIdentifier getShardPrefix() {
37         return prefix;
38     }
39
40     public MemberName getMemberName() {
41         return memberName;
42     }
43
44     @Override
45     public String toString() {
46         return "RemovePrefixShardReplica [prefix=" + prefix + ", memberName=" + memberName + "]";
47     }
48 }