[ndnSIM] NFD Content Store policy

Junxiao Shi shijunxiao at email.arizona.edu
Tue Jul 5 18:51:53 PDT 2016

Hi Fabio

Although I haven't implemented any CS replacement policy, I participated in
the design of nfd::cs::Policy class.

Policy::doAfterInsert method is invoked when a CS entry is *already*
inserted. The latest inserted entry is given in the interator.
The iterator type is declared in cs-internal.hpp. When you dereference the
iterator with *i, you'll get a nfd::cs::Entry object.
Entry object is declared in cs-entry.hpp. You can access the Data packet
from the entry.
If your policy decides that the latest inserted entry should not be
admitted, the policy can evict this entry immediately.

To get access to other entries previously inserted to the CS, the policy
needs to maintain a data structure that keeps the iterators (not the
EntryImpl objects).
You may find examples in existing policy implementations, for example
LruPolicy class m_queue member.

To associate additional information with an Entry, a policy implementation
can declare a struct that associates the iterator and additional
information, and then place this struct in the policy's internal data
structure. nfd::cs::Entry and nfd::cs::EntryImpl classes should not be
An example is nfd::cs::priority_fifo::EntryInfo type, and
PriorityFifoPolicy::m_entryInfoMap member.

Yours, Junxiao

On Tue, Jul 5, 2016 at 6:07 PM, Fabio Campioni <fcampioni at algomau.ca> wrote:

> Hi all,
> I have recently switched from using the old content store to the new NFD
> API for creating a cache replacement policy. However, in the methods,
> specifically doAfterInsert, where an iterator object is passed to it, I am
> not sure what methods are available in that object or how to actually
> access the data and cannot find anything in the NFD documentation. Would
> anyone who has worked with the NFD content store be able to point me in the
> right direction?
> Thank you,
> Fabio Campioni
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160705/3ea9f986/attachment.html>

More information about the ndnSIM mailing list