relay BACKUPS_CHANGED as ReplicaInfo
Change-Id: I72abd05e7d2d4a2c448323ad304c8f21b1d6a90b
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/flow/ReplicaInfoEvent.java b/core/store/dist/src/main/java/org/onlab/onos/store/flow/ReplicaInfoEvent.java
index c956c8a..ef4de4d 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/flow/ReplicaInfoEvent.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/flow/ReplicaInfoEvent.java
@@ -36,7 +36,7 @@
*/
MASTER_CHANGED,
//
- // BACKUPS_CHANGED?
+ BACKUPS_CHANGED,
}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/flow/impl/ReplicaInfoManager.java b/core/store/dist/src/main/java/org/onlab/onos/store/flow/impl/ReplicaInfoManager.java
index 5d766e6..c3fa99a 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/flow/impl/ReplicaInfoManager.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/flow/impl/ReplicaInfoManager.java
@@ -18,10 +18,9 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
import static org.onlab.onos.store.flow.ReplicaInfoEvent.Type.MASTER_CHANGED;
+import static org.onlab.onos.store.flow.ReplicaInfoEvent.Type.BACKUPS_CHANGED;
import java.util.Collections;
-import java.util.List;
-
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -96,12 +95,24 @@
@Override
public void event(MastershipEvent event) {
- // TODO: distinguish stby list update, when MastershipService,
- // start publishing them
- final List<NodeId> standbyList = Collections.<NodeId>emptyList();
- eventDispatcher.post(new ReplicaInfoEvent(MASTER_CHANGED,
- event.subject(),
- new ReplicaInfo(event.roleInfo().master(), standbyList)));
+ final ReplicaInfo replicaInfo
+ = new ReplicaInfo(event.roleInfo().master(),
+ event.roleInfo().backups());
+
+ switch (event.type()) {
+ case MASTER_CHANGED:
+ eventDispatcher.post(new ReplicaInfoEvent(MASTER_CHANGED,
+ event.subject(),
+ replicaInfo));
+ break;
+ case BACKUPS_CHANGED:
+ eventDispatcher.post(new ReplicaInfoEvent(BACKUPS_CHANGED,
+ event.subject(),
+ replicaInfo));
+ break;
+ default:
+ break;
+ }
}
}