d9a55ab1e98e7c0f752e73035d8f25494e9f34d1
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / ShardLeaderStateChanged.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.messages;
9
10 import com.google.common.base.Optional;
11 import com.google.common.base.Preconditions;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.controller.cluster.notifications.LeaderStateChanged;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
15
16 /**
17  * A local message derived from LeaderStateChanged containing additional Shard-specific info that is sent
18  * when some state of the shard leader has changed. This message is used by the ShardManager to maintain
19  * current Shard information.
20  *
21  * @author Thomas Pantelis
22  */
23 public class ShardLeaderStateChanged extends LeaderStateChanged {
24
25     private final Optional<DataTree> localShardDataTree;
26
27     public ShardLeaderStateChanged(@Nonnull String memberId, @Nonnull String leaderId,
28             @Nonnull Optional<DataTree> localShardDataTree) {
29         super(memberId, leaderId);
30         this.localShardDataTree = Preconditions.checkNotNull(localShardDataTree);
31     }
32
33     public @Nonnull Optional<DataTree> getLocalShardDataTree() {
34         return localShardDataTree;
35     }
36 }