add remove API
diff --git a/model/sync-app-socket.h b/model/sync-app-socket.h
index 38a2657..29f8dc1 100644
--- a/model/sync-app-socket.h
+++ b/model/sync-app-socket.h
@@ -62,6 +62,14 @@
*/
bool publish (const std::string &prefix, uint32_t session, const std::string &dataBuffer, int freshness);
+ /**
+ * @brief delete a participant's subtree from the sync tree; SyncLogic will do the work
+ * this is just a wrapper
+ *
+ * @param the prefix for the participant
+ */
+ bool remove (const std::string &prefix) {return m_syncLogic->remove(prefix);}
+
private:
CcnxWrapperPtr m_ccnxHandle;
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index 6b11c9a..f7bf4e7 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -295,15 +295,9 @@
}
void
-SyncLogic::addLocalNames (const string &prefix, uint32_t session, uint32_t seq)
-{
- NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix);
- SeqNo seqN(session, seq);
- DiffStatePtr diff = make_shared<DiffState>();
- diff->update(info, seqN);
- m_state.update(info, seqN);
+SyncLogic::processPendingSyncInterests(DiffStatePtr &diff) {
diff->setDigest(m_state.getDigest());
- m_log.insert(diff);
+ m_log.insert(diff);
vector<string> pis = m_syncInterestTable.fetchAll ();
stringstream ss;
@@ -315,6 +309,30 @@
}
void
+SyncLogic::addLocalNames (const string &prefix, uint32_t session, uint32_t seq)
+{
+ NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix);
+ SeqNo seqN(session, seq);
+ m_state.update(info, seqN);
+
+ DiffStatePtr diff = make_shared<DiffState>();
+ diff->update(info, seqN);
+
+ processPendingSyncInterests(diff);
+}
+
+void
+SyncLogic::remove(const string &prefix) {
+ NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix);
+ m_state.remove(info);
+
+ DiffStatePtr diff = make_shared<DiffState>();
+ diff->remove(info);
+
+ processPendingSyncInterests(diff);
+}
+
+void
SyncLogic::sendSyncInterest ()
{
ostringstream os;
diff --git a/model/sync-logic.h b/model/sync-logic.h
index 42a2ae0..1cc42b6 100644
--- a/model/sync-logic.h
+++ b/model/sync-logic.h
@@ -75,6 +75,12 @@
*/
void processSyncData (const std::string &name, const std::string &dataBuffer);
+ /**
+ * @brief remove a participant's subtree from the sync tree
+ * @param the name prefix for the participant
+ */
+ void remove(const std::string &prefix);
+
#ifdef _DEBUG
size_t
getListChecksSize ()
@@ -91,7 +97,9 @@
processSyncInterest (DigestConstPtr digest, const std::string &interestname, bool timedProcessing=false);
void sendSyncInterest ();
- // void checkAgain (const std::string &interest, DigestPtr digest);
+
+ void
+ processPendingSyncInterests();
private:
typedef std::list< boost::tuple< boost::system_time, boost::function< void ( ) > > > DelayedChecksList;