<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi!<div><br></div><div>Can you define "instant" load more specifically?  You can't have "instant" load, since it would be either 100% (packet "on the line") or 0% (nothing is on the line).</div><div><br></div><div>In any case, to implement this, you could extend forwarding strategy to keep track of amount of sent/received data on each face.  Here is some example (though not exactly what you're looking for) <a href="https://github.com/cawka/ndnSIM-ddos-interest-flooding/blob/master/extensions/stats.h">https://github.com/cawka/ndnSIM-ddos-interest-flooding/blob/master/extensions/stats.h</a> how it can be implemented.  In the example, the forwarding strategy extension keeps track of number of forwarded interests and number of unsatisfied.  You can overload different methods (InInterest, InData, DidSendOutInterest, DidSendOutData) and get amount of sent/received data instead.</div><div><br></div><div>After you have this module implemented, you can create a policy to control how DATA packets are cached.  Currently, there are a number of policies available, including LRU, LFU, Random, Persistent, and some other.  It is not the case with all policies that all passing by DATA packets will be cached.  For example, with Random policy, there is always a chance that new item will be rejected.  In your case, you would need to write a policy, that on every insert consults "stats" module and applies probabilistic decision whether to cache item or not.</div><div><br></div><div><br></div><div>Here is just a little bit background that could be useful to understand content store (I made this example before for FIB, but it is good for Content Store as well):</div><div><br></div><div>-----------------</div><div><br></div><div><div>Content Store (as well as FIB and PIT) is organized using the underlying data structure that is a complex tree.  Each node of the tree corresponds to a name component, and connection to child nodes is implemented as a hash array.   If you want, you can check more details by looking into the source code in <a href="https://github.com/NDN-">https://github.com/NDN-</a>Routing/ndnSIM/blob/master/utils/trie/trie.h. </div><div><br></div><div>An example</div><div><br></div><div>Let say, Content Store has cached DATA packets with the following names:</div><div><br></div><div>/a</div><div>/a/b</div><div>/a/d</div><div>/b/a</div><div>/b/b</div><div><br></div><div>The structure that will be created would look like</div><div><br></div><div>(root) --- a (*) ----- b (*)</div><div> \          \</div><div>  \           \------ d (*)</div><div>   \ </div><div>    \----- b ----- a (*)</div><div>             \</div><div>              \---- b (*)<br><br>The nodes with (*) mean that at this level there is a payload (valid CS entry), which can be returned during the lookup process.</div><div><br></div><div>Children on each level are stored in a hash-based container.</div></div><div><br></div><div><div>In addition to this trie structure, each inserted item is also subject to a policy:  every time an item is inserted, looked up, modified, or deleted, a policy is getting notified and can do some action, e.g., remove item, promote item, or do something else.  Here are links to existing policy implementations:</div><div>LRU: <a href="https://github.com/NDN-Routing/ndnSIM/blob/master/utils/trie/lru-policy.h">https://github.com/NDN-Routing/ndnSIM/blob/master/utils/trie/lru-policy.h</a></div><div>LFU: <a href="https://github.com/NDN-Routing/ndnSIM/blob/master/utils/trie/lfu-policy.h">https://github.com/NDN-Routing/ndnSIM/blob/master/utils/trie/lfu-policy.h</a></div><div>Random: <a href="https://github.com/NDN-Routing/ndnSIM/blob/master/utils/trie/random-policy.h">https://github.com/NDN-Routing/ndnSIM/blob/master/utils/trie/random-policy.h</a></div><div>Persistent: <a href="https://github.com/NDN-Routing/ndnSIM/blob/master/utils/trie/persistent-policy.h">https://github.com/NDN-Routing/ndnSIM/blob/master/utils/trie/persistent-policy.h</a></div><div><br></div><div>-----------------</div></div><div><br></div><div>---</div><div>Alex</div><div><br><div><div>On May 28, 2013, at 6:49 PM, 陈胜蓝 <<a href="mailto:blindeafer@163.com">blindeafer@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; font-size: 14px; font-family: arial; ">Hi all,<div>I have an idea about cache scheme.In this scheme,I want to get the instant incoming link load everytime a contentobject come into a node and the outgoing link load(s) according to PIT entry if the contentobject is matched in PIT.What function I could modify and how can I write function to realize this idea?</div><div>BTW,I wonder if a node will cache every contentobject when it comes in?What class and member function a node implement to cache a contentobject?</div><div><br></div><div>Best regards.</div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>_______________________________________________<br>ndnSIM mailing list<br><a href="mailto:ndnSIM@lists.cs.ucla.edu">ndnSIM@lists.cs.ucla.edu</a><br>http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim<br></blockquote></div><br></div></body></html>