initial Device Anti-Entropy
Change-Id: I2c9928b3dd195d857815b9d94cbf0f79f26e4435
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/AntiEntropyReply.java b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/AntiEntropyReply.java
index 94c20ea..9bc095e 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/AntiEntropyReply.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/AntiEntropyReply.java
@@ -18,10 +18,10 @@
* Suggest to the sender about the more up-to-date data this node has,
* and request for more recent data that the receiver has.
*/
-public class AntiEntropyReply<ID, VALUE> extends ClusterMessage {
+public class AntiEntropyReply<ID, V extends VersionedValue<?>> extends ClusterMessage {
private final NodeId sender;
- private final ImmutableMap<ID, VersionedValue<VALUE>> suggestion;
+ private final ImmutableMap<ID, V> suggestion;
private final ImmutableSet<ID> request;
/**
@@ -32,7 +32,7 @@
* @param request Collection of identifiers
*/
public AntiEntropyReply(NodeId sender,
- Map<ID, VersionedValue<VALUE>> suggestion,
+ Map<ID, V> suggestion,
Set<ID> request) {
super(AE_REPLY);
this.sender = sender;
@@ -44,14 +44,34 @@
return sender;
}
- public ImmutableMap<ID, VersionedValue<VALUE>> suggestion() {
+ /**
+ * Returns collection of values, which the recipient of this reply is likely
+ * to be missing or has outdated version.
+ *
+ * @return
+ */
+ public ImmutableMap<ID, V> suggestion() {
return suggestion;
}
+ /**
+ * Returns collection of identifier to request.
+ *
+ * @return collection of identifier to request
+ */
public ImmutableSet<ID> request() {
return request;
}
+ /**
+ * Checks if reply contains any suggestion or request.
+ *
+ * @return true if nothing is suggested and requested
+ */
+ public boolean isEmpty() {
+ return suggestion.isEmpty() && request.isEmpty();
+ }
+
// Default constructor for serializer
protected AntiEntropyReply() {
super(AE_REPLY);