Skip to content

Commit

Permalink
dag: allow pending ancestors
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyuan129 committed Sep 16, 2022
1 parent 540aecb commit 25f40d9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/dag/dag-module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ DagModule::getAncestors(EdgeState state)
auto parent = getOrConstruct(toStateName(ptr));
// if this is pending, update its descendents
if (parent.status == EdgeState::INITIALIZED) {
NDN_LOG_TRACE(parent.stateName << " is a pending state, stop here...");
NDN_LOG_TRACE(parent.stateName << " is a pending ancestor, stop here...\n"
"Adding " << state.stateName << "into descendants..");
parent.descendants.insert(state.stateName);
update(parent);
}
else {
// we gonna expand this ptr in the next round.
Expand Down Expand Up @@ -76,7 +79,10 @@ DagModule::getAncestors(EdgeState state)
}

if (parent.status == EdgeState::INITIALIZED) {
NDN_LOG_TRACE(parent.stateName << " is a pending state, stop here...");
NDN_LOG_TRACE(parent.stateName << " is a pending state, stop here...\n"
"Adding " << state.stateName << "into descendants..");
parent.descendants.insert(state.stateName);
update(parent);
}
else {
nextFrontier.push_back(parent.stateName);
Expand Down Expand Up @@ -168,6 +174,12 @@ DagModule::onNewRecord(EdgeState& state)
if (!state.record.isGenesis()) {
evaluateAncestors(state);
}

// resolve all pending descendants
for (auto& desc : state.descendants) {
auto descState = getOrConstruct(desc);
evaluateWaitlist(descState);
}
return *this;
}

Expand Down
3 changes: 2 additions & 1 deletion src/sync/sync-module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ SyncModule::recursiveFetcher(const NodeID& nid, const SeqNo& s, std::shared_ptr<
}
acc->clear();
}
});
},
MAX_RETRIES);
}

Name
Expand Down
2 changes: 2 additions & 0 deletions src/sync/sync-module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ using YieldRecordCallback = std::function<void(const Record&)>;
class SyncModule
{
public:
const ssize_t MAX_RETRIES = 3;

explicit
SyncModule(const SyncOptions &options, const SecurityOptions& secOps, ndn::Face& face,
storage::Interface storageIntf, const YieldRecordCallback& yield);
Expand Down

0 comments on commit 25f40d9

Please sign in to comment.