Moving some logic of dealing with sequence numbers to SyncAppDataFetch
Adding recursive mutexes to SyncLogic, so hopefully it is now thread-safe
Small modification of publishing/retrieval names. Now session ID is
appended by SyncAppDataFetch / SyncAppDataPublish
diff --git a/test/test_data_fetch_and_publish.cc b/test/test_data_fetch_and_publish.cc
index b227572..a442830 100644
--- a/test/test_data_fetch_and_publish.cc
+++ b/test/test_data_fetch_and_publish.cc
@@ -71,7 +71,7 @@
string str[5] = {"panda", "express", "tastes", "so", "good"};
for (int i = 0; i < 5; i++) {
- foo.set(interest + "/" + seq[i], str[i]);
+ foo.set(interest + "/" + "0/" /*session*/ + seq[i], str[i]);
}
boost::function<void (string, string)> setFunc =
@@ -89,7 +89,7 @@
BOOST_CHECK_EQUAL(publisher.getHighestSeq(interest, 0), 5);
BOOST_CHECK_EQUAL(publisher.getRecentData(interest, 0), str[4]);
- fetcher.fetch(interest, 1, 5);
+ fetcher.onUpdate (interest, SeqNo (0,5), SeqNo (0,0));
// give time for ccnd to react
sleep(1);
BOOST_CHECK_EQUAL(foo.toString(), bar.toString());
@@ -99,7 +99,7 @@
bind(&TestStructApp::erase, &bar, _1, _2);
fetcher.setDataCallback(eraseFunc);
- fetcher.fetch(interest, 1, 5);
+ fetcher.onUpdate (interest, SeqNo (0,5), SeqNo (0,0));
// give time for ccnd to react
sleep(1);
TestStructApp poo;
diff --git a/test/test_interest_table.cc b/test/test_interest_table.cc
index 7cca0eb..3c39046 100644
--- a/test/test_interest_table.cc
+++ b/test/test_interest_table.cc
@@ -42,15 +42,20 @@
BOOST_CHECK_NO_THROW (delete table);
}
-void func (const std::string &, uint32_t, uint32_t)
+void funcUpdate (const std::string &, const SeqNo &newSeq, const SeqNo &oldSeq)
{
- cout << "func\n";
+ cout << "funcUpdate\n";
+}
+
+void funcRemove (const std::string &)
+{
+ cout << "funcRemove\n";
}
BOOST_AUTO_TEST_CASE (SyncLogicTest)
{
SyncLogic *logic = 0;
- BOOST_CHECK_NO_THROW (logic = new SyncLogic ("/prefix", func, make_shared<CcnxWrapper> ()));
+ BOOST_CHECK_NO_THROW (logic = new SyncLogic ("/prefix", funcUpdate, funcRemove, make_shared<CcnxWrapper> ()));
BOOST_CHECK_EQUAL (logic->getListChecksSize (), 0);
// 0s