Add OnDemandShardState to report additional Shard state
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / OnDemandShardState.java
1 /*
2  * Copyright (c) 2017 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 akka.actor.ActorRef;
11 import akka.actor.ActorSelection;
12 import java.util.Collection;
13 import org.opendaylight.controller.cluster.raft.client.messages.OnDemandRaftState;
14
15 /**
16  * Extends OnDemandRaftState to add Shard state.
17  *
18  * @author Thomas Pantelis
19  */
20 public class OnDemandShardState extends OnDemandRaftState {
21     private Collection<ActorSelection> treeChangeListenerActors;
22     private Collection<ActorSelection> dataChangeListenerActors;
23     private Collection<ActorRef> commitCohortActors;
24
25     public Collection<ActorSelection> getTreeChangeListenerActors() {
26         return treeChangeListenerActors;
27     }
28
29     public Collection<ActorSelection> getDataChangeListenerActors() {
30         return dataChangeListenerActors;
31     }
32
33     public Collection<ActorRef> getCommitCohortActors() {
34         return commitCohortActors;
35     }
36
37     public static Builder newBuilder() {
38         return new Builder();
39     }
40
41     public static class Builder extends AbstractBuilder<Builder> {
42         private final OnDemandShardState state = new OnDemandShardState();
43
44         @Override
45         protected OnDemandRaftState state() {
46             return state;
47         }
48
49         public Builder treeChangeListenerActors(Collection<ActorSelection> actors) {
50             state.treeChangeListenerActors = actors;
51             return self();
52         }
53
54         public Builder dataChangeListenerActors(Collection<ActorSelection> actors) {
55             state.dataChangeListenerActors = actors;
56             return self();
57         }
58
59         public Builder commitCohortActors(Collection<ActorRef> actors) {
60             state.commitCohortActors = actors;
61             return self();
62         }
63     }
64 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.