Skip to content

Commit 25e4d8f

Browse files
committed
Compilation fixes after upgrade to NFD 0.6.6 and removal of old-style CS
Change-Id: I5472ae71675d8419d8d6c70990182ef028803087
1 parent 11dfcb7 commit 25e4d8f

19 files changed

+59
-392
lines changed

docs/source/cs.rst

Lines changed: 5 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ NFD's Content Store
66
The Contest Store (CS) is implemented as a set of :ndnsim:`CS entries <nfd::cs::EntryImpl>`),
77
ordered by the full data name including the implicit digest. To manage entries, CS adopts a cache policy interface (:ndnsim:`nfd::cs::Policy`), invoked any time a CS entry is added, removed, updated, or used.
88

9-
By default, ndnSIM uses NFD's Content Store with an option to use an old-style ndnSIM-specific content store implementations (see :ref:`old_cs`). The supported cache replacement policies are the following:
9+
The supported cache replacement policies are the following:
1010

1111
+----------------------------------------------+----------------------------------------------------------+
1212
| **NFD's Content Store Policies** |
@@ -55,8 +55,7 @@ Examples:
5555
5656
- To effectively disable NFD content store an all nodes
5757

58-
Minimum allowed value for NFD content store maximum size is 1. If 0 is specified, it will be assumed
59-
that the old content store implementation should be used.
58+
Minimum allowed value for NFD content store maximum size is 1.
6059

6160
.. code-block:: c++
6261

@@ -75,131 +74,9 @@ contains:
7574
- flag indicating whether the Data packet is unsolicited
7675
- the timestamp at which the cached Data becomes stale
7776

78-
.. _old_cs:
79-
80-
Old Content Store Implementations
81-
+++++++++++++++++++++++++++++++++
82-
83-
We have also ported the old ndnSIM 1.0 content store implementations to the new code base.
84-
These implementations feature different cache replacement policies, but have very limited
85-
support for Interest selectors. If your scenario relies on proper selector processing,
86-
do not use these implementations as the simulation results most likely be incorrect.
87-
88-
To select old content store implementations, use :ndnsim:`StackHelper::SetOldContentStore`:
89-
90-
.. code-block:: c++
91-
92-
ndnHelper.SetOldContentStore("<content store implementation>",
93-
["<optional parameter>", "<optional parameter's value>" [, ...]]);
94-
...
95-
ndnHelper.Install (nodes);
96-
97-
Available old content store implementations are listed in the following table:
98-
99-
100-
+----------------------------------------------+----------------------------------------------------------+
101-
| **Simple content stores** |
102-
+----------------------------------------------+----------------------------------------------------------+
103-
| ``ns3::ndn::cs::Lru`` | **Least recently used (LRU) (default)** |
104-
+----------------------------------------------+----------------------------------------------------------+
105-
| ``ns3::ndn::cs::Fifo`` | First-in-first-Out (FIFO) |
106-
+----------------------------------------------+----------------------------------------------------------+
107-
| ``ns3::ndn::cs::Lfu`` | Least frequently used (LFU) |
108-
+----------------------------------------------+----------------------------------------------------------+
109-
| ``ns3::ndn::cs::Random`` | Random |
110-
+----------------------------------------------+----------------------------------------------------------+
111-
| ``ns3::ndn::cs::Nocache`` | Policy that completely disables caching |
112-
+----------------------------------------------+----------------------------------------------------------+
113-
+----------------------------------------------+----------------------------------------------------------+
114-
| **Content stores with entry lifetime tracking** |
115-
| |
116-
| These policies allow evaluation of CS enties lifetime (i.e., how long entries stay in CS) |
117-
+----------------------------------------------+----------------------------------------------------------+
118-
| ``ns3::ndn::cs::Stats::Lru`` | Least recently used (LRU) |
119-
+----------------------------------------------+----------------------------------------------------------+
120-
| ``ns3::ndn::cs::Stats::Fifo`` | Least frequently used (LFU) |
121-
+----------------------------------------------+----------------------------------------------------------+
122-
| ``ns3::ndn::cs::Stats::Lfu`` | Random |
123-
+----------------------------------------------+----------------------------------------------------------+
124-
| ``ns3::ndn::cs::Stats::Random`` | Policy that completely disables caching |
125-
+----------------------------------------------+----------------------------------------------------------+
126-
+----------------------------------------------+----------------------------------------------------------+
127-
| **Content stores respecting freshness field of Data packets** |
128-
| |
129-
| These policies cache Data packets only for the time indicated by FreshnessPeriod. |
130-
+----------------------------------------------+----------------------------------------------------------+
131-
| ``ns3::ndn::cs::Freshness::Lru`` | Least recently used (LRU) |
132-
+----------------------------------------------+----------------------------------------------------------+
133-
| ``ns3::ndn::cs::Freshness::Fifo`` | Least frequently used (LFU) |
134-
+----------------------------------------------+----------------------------------------------------------+
135-
| ``ns3::ndn::cs::Freshness::Lfu`` | Random |
136-
+----------------------------------------------+----------------------------------------------------------+
137-
| ``ns3::ndn::cs::Freshness::Random`` | Policy that completely disables caching |
138-
+----------------------------------------------+----------------------------------------------------------+
139-
+----------------------------------------------+----------------------------------------------------------+
140-
| **Content store realization that probabilistically accepts data packet into CS (placement policy)** |
141-
+----------------------------------------------+----------------------------------------------------------+
142-
| ``ns3::ndn::cs::Probability::Lru`` | Least recently used (LRU) |
143-
+----------------------------------------------+----------------------------------------------------------+
144-
| ``ns3::ndn::cs::Probability::Fifo`` | Least frequently used (LFU) |
145-
+----------------------------------------------+----------------------------------------------------------+
146-
| ``ns3::ndn::cs::Probability::Lfu`` | Random |
147-
+----------------------------------------------+----------------------------------------------------------+
148-
| ``ns3::ndn::cs::Probability::Random`` | Policy that completely disables caching |
149-
+----------------------------------------------+----------------------------------------------------------+
150-
151-
Examples:
152-
153-
154-
- Select simple LRU policy on node1, simple FIFO policy on node2, and simple random policy on
155-
other nodes with maximum CS sizes of 10000 packets:
156-
157-
.. code-block:: c++
158-
159-
ndnHelper.SetOldContentStore("ns3::ndn::cs::Lru", "MaxSize", "10000");
160-
ndnHelper.Install(node1);
161-
162-
ndnHelper.SetOldContentStore("ns3::ndn::cs::Fifo", "MaxSize", "10000");
163-
ndnHelper.Install(node2);
164-
165-
ndnHelper.SetOldContentStore("ns3::ndn::cs::Random", "MaxSize", "10000");
166-
...
167-
ndnHelper.Install(otherNodes);
168-
169-
.. note::
170-
171-
If ``MaxSize`` parameter is omitted, then will be used a default value (100).
172-
173-
.. note::
174-
175-
If ``MaxSize`` is set to 0, then no limit on ContentStore will be enforced
176-
177-
- Disable CS on node2
178-
179-
.. code-block:: c++
180-
181-
ndnHelper.SetOldContentStore("ns3::ndn::cs::Nocache");
182-
ndnHelper.Install(node3);
183-
184-
- Track lifetime of CS entries (must use ``ns3::ndn::cs::*::LifetimeStats`` policy):
185-
186-
.. code-block:: c++
187-
188-
void
189-
CacheEntryRemoved(std::string context, Ptr<const ndn::cs::Entry> entry, Time lifetime)
190-
{
191-
std::cout << entry->GetName() << " " << lifetime.ToDouble(Time::S) << "s" << std::endl;
192-
}
193-
194-
...
195-
196-
ndnHelper.SetOldContentStore("ns3::ndn::cs::Stats::Lru", "MaxSize", "10000");
197-
...
198-
ndnHelper.Install(nodes);
199-
200-
// connect to lifetime trace
201-
Config::Connect("/NodeList/*/$ns3::ndn::cs::Stats::Lru/WillRemoveEntry", MakeCallback(CacheEntryRemoved));
202-
77+
Misc
78+
~~~~
79+
20380
- Get aggregate statistics of CS hit/miss ratio (works with any policy)
20481

20582
The simplest way tro track CS hit/miss statistics is to use :ndnsim:`CsTracer`, in more

docs/source/helpers.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,6 @@ ndnSIM uses NFD's content store implementation, maximum size of which can be con
161161

162162
.. note::
163163

164-
NFD's content store implementation takes full consideration of Interest selectors.
165-
In contrast to that, the old ndnSIM 1.0 content store implementations have very limited
166-
support for Interest selectors, but features a number of different replacement policies.
167-
If your scenario relies on proper selector processing, do not use these implementations as
168-
the simulation results most likely be incorrect.
169-
170-
To select old content store implementations, use :ndnsim:`SetOldContentStore
171-
<StackHelper::SetOldContentStore>` StackHelper method:
172-
173-
.. code-block:: c++
174-
175-
ndnHelper.SetOldContentStore("<content store implementation>",
176-
["<optional parameter>", "<optional parameter's value>" [, ...]]);
177-
...
178-
ndnHelper.Install (nodes);
179-
180164
In simulation scenarios it is possible to select one of :ref:`the existing implementations
181165
of the content store or implement your own <content store>`.
182166

docs/source/metric.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ Run R script::
248248
Content store trace helper
249249
--------------------------
250250

251-
NOTE: This tracer works ONLY when the OldContentStore structure is used!
252-
253251
- :ndnsim:`ndn::CsTracer`
254252

255253
With the use of :ndnsim:`ndn::CsTracer` it is possible to obtain statistics of cache hits/cache misses on simulation nodes.

examples/ndn-congestion-alt-topo-plugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ main(int argc, char* argv[])
6969

7070
// Install NDN stack on all nodes
7171
ndn::StackHelper ndnHelper;
72-
ndnHelper.SetOldContentStore("ns3::ndn::cs::Lru", "MaxSize",
73-
"1"); // ! Attention ! If set to 0, then MaxSize is infinite
72+
ndnHelper.setPolicy("nfd::cs::lru");
73+
ndnHelper.setCsSize(1);
7474
ndnHelper.InstallAll();
7575

7676
// Set BestRoute strategy

examples/ndn-congestion-topo-plugin.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ main(int argc, char* argv[])
5757

5858
// Install NDN stack on all nodes
5959
ndn::StackHelper ndnHelper;
60-
ndnHelper.SetOldContentStore("ns3::ndn::cs::Lru", "MaxSize", "10000");
60+
ndnHelper.setPolicy("nfd::cs::lru");
61+
ndnHelper.setCsSize(10000);
6162
ndnHelper.InstallAll();
6263

6364
// Choosing forwarding strategy

examples/ndn-load-balancer/random-load-balancer-strategy.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2-
/**
3-
* Copyright (c) 2014, Regents of the University of California,
4-
* Arizona Board of Regents,
5-
* Colorado State University,
6-
* University Pierre & Marie Curie, Sorbonne University,
7-
* Washington University in St. Louis,
8-
* Beijing Institute of Technology,
9-
* The University of Memphis
2+
/*
3+
* Copyright (c) 2014-2019, Regents of the University of California,
4+
* Arizona Board of Regents,
5+
* Colorado State University,
6+
* University Pierre & Marie Curie, Sorbonne University,
7+
* Washington University in St. Louis,
8+
* Beijing Institute of Technology,
9+
* The University of Memphis
1010
*
1111
* This file is part of NFD (Named Data Networking Forwarding Daemon).
1212
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -29,7 +29,7 @@
2929

3030
#include <ndn-cxx/util/random.hpp>
3131

32-
#include "core/logger.hpp"
32+
#include "daemon/common/logger.hpp"
3333

3434
NFD_LOG_INIT("RandomLoadBalancerStrategy");
3535

@@ -61,7 +61,7 @@ hasFaceForForwarding(const Face& inFace, const fib::NextHopList& nexthops, const
6161
}
6262

6363
void
64-
RandomLoadBalancerStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
64+
RandomLoadBalancerStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
6565
const shared_ptr<pit::Entry>& pitEntry)
6666
{
6767
NFD_LOG_TRACE("afterReceiveInterest");
@@ -75,7 +75,7 @@ RandomLoadBalancerStrategy::afterReceiveInterest(const Face& inFace, const Inter
7575
const fib::NextHopList& nexthops = fibEntry.getNextHops();
7676

7777
// Ensure there is at least 1 Face is available for forwarding
78-
if (!hasFaceForForwarding(inFace, nexthops, pitEntry)) {
78+
if (!hasFaceForForwarding(ingress.face, nexthops, pitEntry)) {
7979
this->rejectPendingInterest(pitEntry);
8080
return;
8181
}
@@ -90,9 +90,9 @@ RandomLoadBalancerStrategy::afterReceiveInterest(const Face& inFace, const Inter
9090
for (selected = nexthops.begin(); selected != nexthops.end() && currentIndex != randomIndex;
9191
++selected, ++currentIndex) {
9292
}
93-
} while (!canForwardToNextHop(inFace, pitEntry, *selected));
93+
} while (!canForwardToNextHop(ingress.face, pitEntry, *selected));
9494

95-
this->sendInterest(pitEntry, selected->getFace(), interest);
95+
this->sendInterest(pitEntry, FaceEndpoint(selected->getFace(), 0), interest);
9696
}
9797

9898
const Name&

examples/ndn-load-balancer/random-load-balancer-strategy.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ class RandomLoadBalancerStrategy : public Strategy {
3838
public:
3939
RandomLoadBalancerStrategy(Forwarder& forwarder, const Name& name = getStrategyName());
4040

41-
virtual ~RandomLoadBalancerStrategy() override;
41+
virtual
42+
~RandomLoadBalancerStrategy() override;
4243

43-
virtual void
44-
afterReceiveInterest(const Face& inFace, const Interest& interest,
44+
void
45+
afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
4546
const shared_ptr<pit::Entry>& pitEntry) override;
4647

4748
static const Name&

examples/ndn-simple-wifi.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ main(int argc, char* argv[])
105105
ndn::StackHelper ndnHelper;
106106
// ndnHelper.AddNetDeviceFaceCreateCallback (WifiNetDevice::GetTypeId (), MakeCallback
107107
// (MyNetDeviceFaceCallback));
108-
ndnHelper.SetOldContentStore("ns3::ndn::cs::Lru", "MaxSize", "1000");
108+
ndnHelper.setPolicy("nfd::cs::lru");
109+
ndnHelper.setCsSize(1000);
109110
ndnHelper.SetDefaultRoutes(true);
110111
ndnHelper.Install(nodes);
111112

0 commit comments

Comments
 (0)