logic: Implemented exclude filter
This commit implements the exclude filter mechanism that is required to
handle simultaneous data generations. When a node receives data, it
resends the corresponding sync interest with augmented exclude filter.
Change-Id: I6500abf29877e51bb2a91eca83f9c0eba0e59655
Refs: #3928
diff --git a/src/logic.hpp b/src/logic.hpp
index c684fa2..c452d20 100644
--- a/src/logic.hpp
+++ b/src/logic.hpp
@@ -303,9 +303,10 @@
* This method simply passes the valid reply to processSyncData.
*
* @param data The valid Sync Reply.
+ * @param firstData Whether the data is new or that obtained using exclude filter
*/
void
- onSyncDataValidated(const shared_ptr<const Data>& data);
+ onSyncDataValidated(const shared_ptr<const Data>& data, bool firstData = true);
/**
* @brief Process normal Sync Interest
@@ -343,11 +344,13 @@
* @param name The data name of the Sync Reply.
* @param digest The digest in the data name.
* @param syncReplyBlock The content of the Sync Reply.
+ * @param firstData Whether the data is new or obtained using exclude filter
*/
void
processSyncData(const Name& name,
ndn::ConstBufferPtr digest,
- const Block& syncReplyBlock);
+ const Block& syncReplyBlock,
+ bool firstData);
/**
* @brief Insert state diff into log
@@ -432,6 +435,29 @@
void
onRecoveryTimeout(const Interest& interest);
+ /**
+ * @brief Helper method to send Exclude Interest
+ *
+ * @param interest The interest whose exclude filter will be augmented
+ * @param data The data whose implicit digest will be inserted into exclude filter
+ */
+ void
+ sendExcludeInterest(const Interest& interest, const Data& data);
+
+ /**
+ * @brief Helper method to form the exclude Interest and calls sendExcludeInterest
+ *
+ * @param interest The interest whose exclude filter will be augmented
+ * @param nodePrefix The prefix of the sender node
+ * @param commit The commit whose contents will be used to obtain the implicit
+ digest to be excluded
+ * @param previousRoot The digest to be included in the interest
+ */
+ void
+ formAndSendExcludeInterest(const Name& nodePrefix,
+ const State& commit,
+ ndn::ConstBufferPtr previousRoot);
+
public:
static const ndn::Name DEFAULT_NAME;
static const ndn::Name EMPTY_NAME;