[ndnSIM] Question on Content store insert

황인찬 neogeoss at ajou.ac.kr
Tue Oct 18 03:31:52 PDT 2016


Dear NDNSim users,

I am customizing content store in my own way. While I am doing it, I became
curious about the details of cs entry insertion
function.
The problem is I could not find the function definition. Could any of you
tell me about the location of its definition?

https://github.com/named-data-ndnSIM/NFD/blob/bc600d7ccc3d2bf27e8305cc1d2a5780e10c81d4/daemon/table/cs.cpp#L103

void

Cs::insert(const Data& data, bool isUnsolicited)

{

NFD_LOG_DEBUG("insert " << data.getName());


if (m_policy->getLimit() == 0) {

// shortcut for disabled CS

return;

}


// recognize CachePolicy

shared_ptr<lp::CachePolicyTag> tag = data.getTag<lp::CachePolicyTag>();

if (tag != nullptr) {

lp::CachePolicyType policy = tag->get().getPolicy();

if (policy == lp::CachePolicyType::NO_CACHE) {

return;

}

}


bool isNewEntry = false;

iterator it;

// use .insert because gcc46 does not support .emplace

std::tie(it, isNewEntry) = m_table.insert(EntryImpl(data.shared_from_this(),
isUnsolicited));

EntryImpl& entry = const_cast<EntryImpl&>(*it);


entry.updateStaleTime();


if (!isNewEntry) { // existing entry

// XXX This doesn't forbid unsolicited Data from refreshing a solicited
entry.

if (entry.isUnsolicited() && !isUnsolicited) {

entry.unsetUnsolicited();

}


m_policy->afterRefresh(it);

}

else {

m_policy->afterInsert(it);

}

}
is the function i am looking at.


Lots of love,

inchan hwang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20161018/144af6d1/attachment.html>


More information about the ndnSIM mailing list