Yuta HIGUCHI

relay BACKUPS_CHANGED as ReplicaInfo

Change-Id: I72abd05e7d2d4a2c448323ad304c8f21b1d6a90b
...@@ -36,7 +36,7 @@ public class ReplicaInfoEvent extends AbstractEvent<ReplicaInfoEvent.Type, Devic ...@@ -36,7 +36,7 @@ public class ReplicaInfoEvent extends AbstractEvent<ReplicaInfoEvent.Type, Devic
36 */ 36 */
37 MASTER_CHANGED, 37 MASTER_CHANGED,
38 // 38 //
39 - // BACKUPS_CHANGED? 39 + BACKUPS_CHANGED,
40 } 40 }
41 41
42 42
......
...@@ -18,10 +18,9 @@ package org.onlab.onos.store.flow.impl; ...@@ -18,10 +18,9 @@ package org.onlab.onos.store.flow.impl;
18 import static com.google.common.base.Preconditions.checkNotNull; 18 import static com.google.common.base.Preconditions.checkNotNull;
19 import static org.slf4j.LoggerFactory.getLogger; 19 import static org.slf4j.LoggerFactory.getLogger;
20 import static org.onlab.onos.store.flow.ReplicaInfoEvent.Type.MASTER_CHANGED; 20 import static org.onlab.onos.store.flow.ReplicaInfoEvent.Type.MASTER_CHANGED;
21 +import static org.onlab.onos.store.flow.ReplicaInfoEvent.Type.BACKUPS_CHANGED;
21 22
22 import java.util.Collections; 23 import java.util.Collections;
23 -import java.util.List;
24 -
25 import org.apache.felix.scr.annotations.Activate; 24 import org.apache.felix.scr.annotations.Activate;
26 import org.apache.felix.scr.annotations.Component; 25 import org.apache.felix.scr.annotations.Component;
27 import org.apache.felix.scr.annotations.Deactivate; 26 import org.apache.felix.scr.annotations.Deactivate;
...@@ -96,12 +95,24 @@ public class ReplicaInfoManager implements ReplicaInfoService { ...@@ -96,12 +95,24 @@ public class ReplicaInfoManager implements ReplicaInfoService {
96 95
97 @Override 96 @Override
98 public void event(MastershipEvent event) { 97 public void event(MastershipEvent event) {
99 - // TODO: distinguish stby list update, when MastershipService, 98 + final ReplicaInfo replicaInfo
100 - // start publishing them 99 + = new ReplicaInfo(event.roleInfo().master(),
101 - final List<NodeId> standbyList = Collections.<NodeId>emptyList(); 100 + event.roleInfo().backups());
102 - eventDispatcher.post(new ReplicaInfoEvent(MASTER_CHANGED, 101 +
103 - event.subject(), 102 + switch (event.type()) {
104 - new ReplicaInfo(event.roleInfo().master(), standbyList))); 103 + case MASTER_CHANGED:
104 + eventDispatcher.post(new ReplicaInfoEvent(MASTER_CHANGED,
105 + event.subject(),
106 + replicaInfo));
107 + break;
108 + case BACKUPS_CHANGED:
109 + eventDispatcher.post(new ReplicaInfoEvent(BACKUPS_CHANGED,
110 + event.subject(),
111 + replicaInfo));
112 + break;
113 + default:
114 + break;
115 + }
105 } 116 }
106 } 117 }
107 118
......