catchunks: remove modular version discovery
refs: #4832, #4556
Change-Id: I99b4f42d1457c74321c9b6ae84f793a93c4c1436
diff --git a/tools/chunks/README.md b/tools/chunks/README.md
index f1cf967..d92710f 100644
--- a/tools/chunks/README.md
+++ b/tools/chunks/README.md
@@ -11,22 +11,15 @@
discovering the latest version of the file, and writes the content of the retrieved file to
the standard output.
-## Version discovery methods in ndncatchunks
+## Version discovery in ndncatchunks
-* `fixed` : sends an Interest attempting to find a data packet with the
- specified prefix and version number. A version component must be present at the
- end of the user-specified NDN name.
-
-* `realtime` : sends discovery Interests to fetch metadata of the solicited content from which
- the data version will be resolved.
- The version number of the solicited content is included in the name of returned
- metadata data packet.
- For more information about the packet format and naming convention of interest and
- data packets for realtime version discovery, please refer to:
+If a version component is present at the end of the user-specified NDN name, the provided version
+number will be used, without any version discovery process. Otherwise, discovery Interest(s) will
+be sent out to fetch metadata of the solicited content from which the Data version will be resolved.
+For more information about the packet format and naming convention of Interest and Data packets of
+version discovery in ndncatchunks, please refer to:
[Realtime Data Retrieval (RDR) protocol wiki page](https://redmine.named-data.net/projects/ndn-tlv/wiki/RDR)
-The default discovery method is `realtime`.
-
## Interest pipeline types in ndncatchunks
* `fixed`: maintains a fixed-size window of Interests in flight; the window size is configurable
@@ -50,40 +43,35 @@
The following command will publish the text of the GPL-3 license under the `/localhost/demo/gpl3`
prefix:
- ndnputchunks ndn:/localhost/demo/gpl3 < /usr/share/common-licenses/GPL-3
+ ndnputchunks /localhost/demo/gpl3 < /usr/share/common-licenses/GPL-3
To find the published version you have to start ndnputchunks with the `-p` command line option,
for example:
- ndnputchunks -p ndn:/localhost/demo/gpl3 < /usr/share/common-licenses/GPL-3
+ ndnputchunks -p /localhost/demo/gpl3 < /usr/share/common-licenses/GPL-3
This command will print the published version to the standard output.
-To publish data with a specific version, you must append a version component to the end of the
+To publish Data with a specific version, you must append a version component to the end of the
prefix. The version component must follow the aforementioned NDN naming conventions.
For example, the following command will publish the version `%FD%00%00%01Qc%CF%17v` of the
`/localhost/demo/gpl3` prefix:
- ndnputchunks ndn:/localhost/demo/gpl3/%FD%00%00%01Qc%CF%17v < /usr/share/common-licenses/GPL-3
+ ndnputchunks /localhost/demo/gpl3/%FD%00%00%01Qc%CF%17v < /usr/share/common-licenses/GPL-3
If the version component is not valid, a new well-formed version will be generated and appended
to the supplied NDN name.
-
### Retrieval
To retrieve the latest version of a published file, the following command can be used:
- ndncatchunks ndn:/localhost/demo/gpl3
+ ndncatchunks /localhost/demo/gpl3
-This command will use the realtime method to discover the version number of the file.
+To fetch a specific version of a published file, you can specify the version number at the end of
+the name. For example, if the version is known to be `%FD%00%00%01Qc%CF%17v`, the following command
+will fetch that exact version of the file (without version discovery):
-To fetch a specific version of a published file, you can use the `fixed` version discovery method.
-In this case the version needs to be supplied as part of the name. For example, if the version
-is known to be `%FD%00%00%01Qc%CF%17v`, the following command will fetch that exact version of the
-file:
-
- ndncatchunks -d fixed ndn:/localhost/demo/gpl3/%FD%00%00%01Qc%CF%17v
-
+ ndncatchunks /localhost/demo/gpl3/%FD%00%00%01Qc%CF%17v
For more information, run the programs with `--help` as argument.
diff --git a/tools/chunks/catchunks/discover-version-fixed.cpp b/tools/chunks/catchunks/discover-version-fixed.cpp
deleted file mode 100644
index c122d2f..0000000
--- a/tools/chunks/catchunks/discover-version-fixed.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2016-2019, Regents of the University of California,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Andrea Tosatto
- */
-
-#include "discover-version-fixed.hpp"
-
-namespace ndn {
-namespace chunks {
-
-DiscoverVersionFixed::DiscoverVersionFixed(const Name& prefix, Face& face, const Options& options)
- : Options(options)
- , DiscoverVersion(prefix, face)
-{
-}
-
-void
-DiscoverVersionFixed::run()
-{
- Interest interest(m_prefix);
- interest.setInterestLifetime(interestLifetime);
- interest.setMustBeFresh(mustBeFresh);
- interest.setMaxSuffixComponents(2);
- interest.setMinSuffixComponents(2);
-
- expressInterest(interest, maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack);
-}
-
-void
-DiscoverVersionFixed::handleData(const Interest& interest, const Data& data)
-{
- if (isVerbose)
- std::cerr << "Data: " << data << std::endl;
-
- // data name must end with a segment number, preceded by a version number
- if (data.getName().size() >= 2 &&
- data.getName()[-1].isSegment() &&
- data.getName()[-2].isVersion()) {
- if (isVerbose)
- std::cerr << "Found data with the requested version: " << data.getName()[-2] << std::endl;
-
- this->emitSignal(onDiscoverySuccess, data.getName().getPrefix(-1));
- }
- else {
- // data isn't a valid segment, add to the exclude list
- m_strayExcludes.excludeOne(data.getName()[-1]);
- Interest newInterest(interest);
- newInterest.refreshNonce();
- newInterest.setExclude(m_strayExcludes);
-
- expressInterest(newInterest, maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack);
- }
-}
-
-} // namespace chunks
-} // namespace ndn
diff --git a/tools/chunks/catchunks/discover-version-fixed.hpp b/tools/chunks/catchunks/discover-version-fixed.hpp
deleted file mode 100644
index 2514098..0000000
--- a/tools/chunks/catchunks/discover-version-fixed.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2016-2017, Regents of the University of California,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Andrea Tosatto
- */
-
-#ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_FIXED_HPP
-#define NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_FIXED_HPP
-
-#include "discover-version.hpp"
-
-namespace ndn {
-namespace chunks {
-
-/**
- * @brief Service to retrieve a specific version segment. The version is specified in the prefix
- *
- * Send a request of a specific version and expect to be answered with one segment.
- *
- * The received name component after version can be an invalid segment number, this component will
- * be excluded in the next interests. In the unlikely case that there are too many excluded
- * components such that the Interest cannot fit in ndn::MAX_NDN_PACKET_SIZE, the discovery
- * procedure will throw Face::Error.
- *
- * DiscoverVersionFixed's user is notified once after one segment with the user specified version
- * is found or on failure to find any Data version.
- */
-class DiscoverVersionFixed : public DiscoverVersion
-{
-public:
- /**
- * @brief create a DiscoverVersionFixed service
- */
- DiscoverVersionFixed(const Name& prefix, Face& face, const Options& options);
-
- /**
- * @brief identify the latest Data version published.
- */
- void
- run() final;
-
-private:
- void
- handleData(const Interest& interest, const Data& data) final;
-
-private:
- Exclude m_strayExcludes;
-};
-
-} // namespace chunks
-} // namespace ndn
-
-#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_FIXED_HPP
diff --git a/tools/chunks/catchunks/discover-version-realtime.cpp b/tools/chunks/catchunks/discover-version-realtime.cpp
deleted file mode 100644
index 7175211..0000000
--- a/tools/chunks/catchunks/discover-version-realtime.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2016-2019, Regents of the University of California,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Chavoosh Ghasemi <chghasemi@cs.arizona.edu>
- */
-
-#include "discover-version-realtime.hpp"
-
-#include <ndn-cxx/metadata-object.hpp>
-
-namespace ndn {
-namespace chunks {
-
-DiscoverVersionRealtime::DiscoverVersionRealtime(const Name& prefix,
- Face& face,
- const Options& options)
- : chunks::Options(options)
- , DiscoverVersion(prefix, face)
- , Options(options)
-{
-}
-
-void
-DiscoverVersionRealtime::run()
-{
- expressInterest(MetadataObject::makeDiscoveryInterest(m_prefix)
- .setInterestLifetime(discoveryTimeout),
- maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack);
-}
-
-void
-DiscoverVersionRealtime::handleData(const Interest& interest, const Data& data)
-{
- if (isVerbose)
- std::cerr << "Data: " << data << std::endl;
-
- // make a metadata object from received metadata packet
- MetadataObject mobject;
- try {
- mobject = MetadataObject(data);
- }
- catch (const tlv::Error& e) {
- this->emitSignal(onDiscoveryFailure, "Invalid metadata packet: "s + e.what());
- return;
- }
-
- if (mobject.getVersionedName().empty() || !mobject.getVersionedName()[-1].isVersion()) {
- this->emitSignal(onDiscoveryFailure, mobject.getVersionedName().toUri() +
- " is not a valid versioned name");
- return;
- }
-
- if (isVerbose) {
- std::cerr << "Discovered Data version: " << mobject.getVersionedName()[-1].toVersion() << std::endl;
- }
- this->emitSignal(onDiscoverySuccess, mobject.getVersionedName());
-}
-
-} // namespace chunks
-} // namespace ndn
diff --git a/tools/chunks/catchunks/discover-version-realtime.hpp b/tools/chunks/catchunks/discover-version-realtime.hpp
deleted file mode 100644
index 2e3f975..0000000
--- a/tools/chunks/catchunks/discover-version-realtime.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2016-2019, Regents of the University of California,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- *
- * @author Chavoosh Ghasemi <chghasemi@cs.arizona.edu>
- */
-
-#ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_REALTIME_HPP
-#define NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_REALTIME_HPP
-
-#include "discover-version.hpp"
-
-namespace ndn {
-namespace chunks {
-
-/**
- * @brief Options for discover version realtime
- *
- * The canonical name to use is DiscoverVersionRealtime::Options
- */
-class DiscoverVersionRealtimeOptions : public virtual Options
-{
-public:
- explicit
- DiscoverVersionRealtimeOptions(const Options& opts = Options())
- : Options(opts)
- {
- }
-
-public:
- time::milliseconds discoveryTimeout{DEFAULT_INTEREST_LIFETIME}; ///< timeout for version discovery
-};
-
-/**
- * @brief Service for discovering Data version by sending discovery interests
- *
- * This service employs RDR-style metadata class for version discovery.
- * @see https://redmine.named-data.net/projects/ndn-tlv/wiki/RDR
- */
-class DiscoverVersionRealtime : public DiscoverVersion, protected DiscoverVersionRealtimeOptions
-{
-public:
- typedef DiscoverVersionRealtimeOptions Options;
-
-public:
- /**
- * @param prefix Name of solicited data
- * @param face The face through which discovery Interests are expressed
- * @param options Additional information about the service
- */
- DiscoverVersionRealtime(const Name& prefix, Face& face, const Options& options);
-
- /**
- * @brief Send a discovery Interest out
- */
- void
- run() final;
-
-private:
- void
- handleData(const Interest& interest, const Data& data) final;
-};
-
-} // namespace chunks
-} // namespace ndn
-
-#endif // NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_REALTIME_HPP
diff --git a/tools/chunks/catchunks/discover-version.cpp b/tools/chunks/catchunks/discover-version.cpp
index 3a4309c..7ac5195 100644
--- a/tools/chunks/catchunks/discover-version.cpp
+++ b/tools/chunks/catchunks/discover-version.cpp
@@ -23,42 +23,73 @@
* @author Wentao Shang
* @author Steve DiBenedetto
* @author Andrea Tosatto
+ * @author Chavoosh Ghasemi
*/
#include "discover-version.hpp"
#include "data-fetcher.hpp"
+#include <ndn-cxx/metadata-object.hpp>
+
namespace ndn {
namespace chunks {
-DiscoverVersion::DiscoverVersion(const Name& prefix, Face& face)
- : m_prefix(prefix)
+DiscoverVersion::DiscoverVersion(const Name& prefix, Face& face, const Options& options)
+ : chunks::Options(options)
+ , m_prefix(prefix)
, m_face(face)
{
}
-DiscoverVersion::~DiscoverVersion() = default;
-
void
-DiscoverVersion::expressInterest(const Interest& interest, int maxRetriesNack, int maxRetriesTimeout)
+DiscoverVersion::run()
{
- fetcher = DataFetcher::fetch(m_face, interest, maxRetriesNack, maxRetriesTimeout,
- bind(&DiscoverVersion::handleData, this, _1, _2),
- bind(&DiscoverVersion::handleNack, this, _1, _2),
- bind(&DiscoverVersion::handleTimeout, this, _1, _2),
- isVerbose);
+ if (!m_prefix.empty() && m_prefix[-1].isVersion()) {
+ onDiscoverySuccess(m_prefix);
+ return;
+ }
+
+ Interest interest = MetadataObject::makeDiscoveryInterest(m_prefix)
+ .setInterestLifetime(interestLifetime);
+
+ m_fetcher = DataFetcher::fetch(m_face, interest,
+ maxRetriesOnTimeoutOrNack, maxRetriesOnTimeoutOrNack,
+ bind(&DiscoverVersion::handleData, this, _1, _2),
+ [this] (const Interest& interest, const std::string& reason) {
+ onDiscoveryFailure(reason);
+ },
+ [this] (const Interest& interest, const std::string& reason) {
+ onDiscoveryFailure(reason);
+ },
+ isVerbose);
}
void
-DiscoverVersion::handleNack(const Interest& interest, const std::string& reason)
+DiscoverVersion::handleData(const Interest& interest, const Data& data)
{
- onDiscoveryFailure(reason);
-}
+ if (isVerbose)
+ std::cerr << "Data: " << data << std::endl;
-void
-DiscoverVersion::handleTimeout(const Interest& interest, const std::string& reason)
-{
- onDiscoveryFailure(reason);
+ // make a metadata object from received metadata packet
+ MetadataObject mobject;
+ try {
+ mobject = MetadataObject(data);
+ }
+ catch (const tlv::Error& e) {
+ onDiscoveryFailure("Invalid metadata packet: "s + e.what());
+ return;
+ }
+
+ if (mobject.getVersionedName().empty() || !mobject.getVersionedName()[-1].isVersion()) {
+ onDiscoveryFailure(mobject.getVersionedName().toUri() + " is not a valid versioned name");
+ return;
+ }
+
+ if (isVerbose) {
+ std::cerr << "Discovered Data version: " << mobject.getVersionedName()[-1] << std::endl;
+ }
+
+ onDiscoverySuccess(mobject.getVersionedName());
}
} // namespace chunks
diff --git a/tools/chunks/catchunks/discover-version.hpp b/tools/chunks/catchunks/discover-version.hpp
index d29f94a..5049cc2 100644
--- a/tools/chunks/catchunks/discover-version.hpp
+++ b/tools/chunks/catchunks/discover-version.hpp
@@ -23,6 +23,7 @@
* @author Wentao Shang
* @author Steve DiBenedetto
* @author Andrea Tosatto
+ * @author Chavoosh Ghasemi
*/
#ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_DISCOVER_VERSION_HPP
@@ -53,43 +54,28 @@
/**
* @brief Signal emitted when a failure occurs.
*/
- signal::Signal<DiscoverVersion, const std::string&> onDiscoveryFailure;
-
- DECLARE_SIGNAL_EMIT(onDiscoverySuccess)
- DECLARE_SIGNAL_EMIT(onDiscoveryFailure)
+ signal::Signal<DiscoverVersion, std::string> onDiscoveryFailure;
public:
/**
* @brief create a DiscoverVersion service
*/
- DiscoverVersion(const Name& prefix, Face& face);
-
- virtual
- ~DiscoverVersion();
+ DiscoverVersion(const Name& prefix, Face& face, const Options& options);
/**
* @brief identify the latest Data version published.
*/
- virtual void
- run() = 0;
-
-protected:
void
- expressInterest(const Interest& interest, int maxRetriesNack, int maxRetriesTimeout);
+ run();
- virtual void
- handleData(const Interest& interest, const Data& data) = 0;
+private:
+ void
+ handleData(const Interest& interest, const Data& data);
- virtual void
- handleNack(const Interest& interest, const std::string& reason);
-
- virtual void
- handleTimeout(const Interest& interest, const std::string& reason);
-
-protected:
+private:
const Name m_prefix;
Face& m_face;
- shared_ptr<DataFetcher> fetcher;
+ shared_ptr<DataFetcher> m_fetcher;
};
} // namespace chunks
diff --git a/tools/chunks/catchunks/main.cpp b/tools/chunks/catchunks/main.cpp
index 718fb49..af345cf 100644
--- a/tools/chunks/catchunks/main.cpp
+++ b/tools/chunks/catchunks/main.cpp
@@ -30,8 +30,7 @@
*/
#include "consumer.hpp"
-#include "discover-version-fixed.hpp"
-#include "discover-version-realtime.hpp"
+#include "discover-version.hpp"
#include "options.hpp"
#include "pipeline-interests-aimd.hpp"
#include "pipeline-interests-cubic.hpp"
@@ -51,10 +50,8 @@
{
std::string programName(argv[0]);
Options options;
- std::string discoverType("realtime");
std::string pipelineType("cubic");
size_t maxPipelineSize(1);
- int64_t discoveryTimeoutMs(DEFAULT_INTEREST_LIFETIME.count());
std::string uri;
// congestion control parameters, CWA refers to conservative window adaptation,
@@ -70,8 +67,6 @@
po::options_description basicDesc("Basic Options");
basicDesc.add_options()
("help,h", "print this help message and exit")
- ("discover-version,d", po::value<std::string>(&discoverType)->default_value(discoverType),
- "version discovery algorithm to use; valid values are: 'fixed', 'realtime'")
("pipeline-type,p", po::value<std::string>(&pipelineType)->default_value(pipelineType),
"type of Interest pipeline to use; valid values are: 'fixed', 'aimd', 'cubic'")
("fresh,f", po::bool_switch(&options.mustBeFresh), "only return fresh content")
@@ -84,11 +79,6 @@
("version,V", "print program version and exit")
;
- po::options_description realDiscoveryDesc("Realtime version discovery options");
- realDiscoveryDesc.add_options()
- ("discovery-timeout,t", po::value<int64_t>(&discoveryTimeoutMs)->default_value(discoveryTimeoutMs),
- "discovery timeout (in milliseconds)");
-
po::options_description fixedPipeDesc("Fixed pipeline options");
fixedPipeDesc.add_options()
("pipeline-size,s", po::value<size_t>(&maxPipelineSize)->default_value(maxPipelineSize),
@@ -136,7 +126,6 @@
po::options_description visibleDesc;
visibleDesc.add(basicDesc)
- .add(realDiscoveryDesc)
.add(fixedPipeDesc)
.add(adaptivePipeDesc)
.add(cubicPipeDesc);
@@ -145,11 +134,16 @@
hiddenDesc.add_options()
("ndn-name,n", po::value<std::string>(&uri), "NDN name of the requested content");
+ po::options_description deprecatedDesc;
+ deprecatedDesc.add_options()
+ ("discover-version,d", po::value<std::string>(), "version discovery algorithm to use")
+ ("discovery-timeout,t", po::value<int64_t>(), "discovery timeout (in milliseconds)");
+
po::positional_options_description p;
p.add("ndn-name", -1);
po::options_description optDesc;
- optDesc.add(visibleDesc).add(hiddenDesc);
+ optDesc.add(visibleDesc).add(hiddenDesc).add(deprecatedDesc);
po::variables_map vm;
try {
@@ -171,6 +165,14 @@
return 0;
}
+ if (vm.count("discover-version") > 0) {
+ std::cout << "WARNING: -d option is deprecated and will be removed in the near future" << std::endl;
+ }
+
+ if (vm.count("discovery-timeout") > 0) {
+ std::cout << "WARNING: -t option is deprecated and will be removed in the near future" << std::endl;
+ }
+
if (vm.count("version") > 0) {
std::cout << "ndncatchunks " << tools::VERSION << std::endl;
return 0;
@@ -182,13 +184,6 @@
return 2;
}
- Name prefix(uri);
- if (discoverType == "fixed" && (prefix.empty() || !prefix[-1].isVersion())) {
- std::cerr << "ERROR: The specified name must contain a version component when using "
- "fixed version discovery" << std::endl;
- return 2;
- }
-
if (maxPipelineSize < 1 || maxPipelineSize > 1024) {
std::cerr << "ERROR: pipeline size must be between 1 and 1024" << std::endl;
return 2;
@@ -199,11 +194,6 @@
return 2;
}
- if (discoveryTimeoutMs < 0) {
- std::cerr << "ERROR: timeout cannot be negative" << std::endl;
- return 2;
- }
-
if (vm["lifetime"].as<int64_t>() < 0) {
std::cerr << "ERROR: lifetime cannot be negative" << std::endl;
return 2;
@@ -218,19 +208,7 @@
try {
Face face;
- unique_ptr<DiscoverVersion> discover;
- if (discoverType == "fixed") {
- discover = make_unique<DiscoverVersionFixed>(prefix, face, options);
- }
- else if (discoverType == "realtime") {
- DiscoverVersionRealtime::Options optionsRealtime(options);
- optionsRealtime.discoveryTimeout = time::milliseconds(discoveryTimeoutMs);
- discover = make_unique<DiscoverVersionRealtime>(prefix, face, optionsRealtime);
- }
- else {
- std::cerr << "ERROR: discover version type not valid" << std::endl;
- return 2;
- }
+ auto discover = make_unique<DiscoverVersion>(Name(uri), face, options);
unique_ptr<PipelineInterests> pipeline;
unique_ptr<StatisticsCollector> statsCollector;