**breaking** Add KeyChain parameter to the producer API
Applications must be able to specify the KeyChain instance to use
Change-Id: If5054dbb8c00e2d18af8bf6a9199ded7266688f3
diff --git a/examples/full-sync.cpp b/examples/full-sync.cpp
index 01da1dd..3ed9814 100644
--- a/examples/full-sync.cpp
+++ b/examples/full-sync.cpp
@@ -20,6 +20,7 @@
#include <PSync/full-producer.hpp>
#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/logger.hpp>
#include <ndn-cxx/util/random.hpp>
#include <ndn-cxx/util/scheduler.hpp>
@@ -42,17 +43,15 @@
*/
Producer(const ndn::Name& syncPrefix, const std::string& userPrefix,
int numDataStreams, int maxNumPublish)
- : m_scheduler(m_face.getIoService())
- , m_fullProducer(80, m_face, syncPrefix, userPrefix,
+ : m_fullProducer(m_face, m_keyChain, 80, syncPrefix, userPrefix,
std::bind(&Producer::processSyncUpdate, this, _1),
1600_ms, 1600_ms)
- , m_numDataStreams(numDataStreams)
, m_maxNumPublish(maxNumPublish)
, m_rng(ndn::random::getRandomNumberEngine())
, m_rangeUniformRandom(0, 60000)
{
// Add user prefixes and schedule updates for them in specified interval
- for (int i = 0; i < m_numDataStreams; i++) {
+ for (int i = 0; i < numDataStreams; i++) {
ndn::Name prefix(userPrefix + "-" + std::to_string(i));
m_fullProducer.addUserNode(prefix);
m_scheduler.schedule(ndn::time::milliseconds(m_rangeUniformRandom(m_rng)),
@@ -93,11 +92,10 @@
private:
ndn::Face m_face;
- ndn::Scheduler m_scheduler;
+ ndn::KeyChain m_keyChain;
+ ndn::Scheduler m_scheduler{m_face.getIoService()};
psync::FullProducer m_fullProducer;
-
- int m_numDataStreams;
uint64_t m_maxNumPublish;
ndn::random::RandomNumberEngine& m_rng;
diff --git a/examples/producer.cpp b/examples/producer.cpp
index a6f4ca1..4e4c77a 100644
--- a/examples/producer.cpp
+++ b/examples/producer.cpp
@@ -20,6 +20,7 @@
#include <PSync/partial-producer.hpp>
#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/logger.hpp>
#include <ndn-cxx/util/random.hpp>
#include <ndn-cxx/util/scheduler.hpp>
@@ -37,16 +38,14 @@
* IBF size is set to 40 in m_producer as the expected number of update to IBF in a sync cycle
*/
PSyncPartialProducer(const ndn::Name& syncPrefix, const std::string& userPrefix,
- int nDataStreams, int maxNumPublish)
- : m_scheduler(m_face.getIoService())
- , m_producer(40, m_face, syncPrefix, userPrefix + "-0")
- , m_nDataStreams(nDataStreams)
+ int numDataStreams, int maxNumPublish)
+ : m_producer(m_face, m_keyChain, 40, syncPrefix, userPrefix + "-0")
, m_maxNumPublish(maxNumPublish)
, m_rng(ndn::random::getRandomNumberEngine())
, m_rangeUniformRandom(0, 60000)
{
// Add user prefixes and schedule updates for them
- for (int i = 0; i < m_nDataStreams; i++) {
+ for (int i = 0; i < numDataStreams; i++) {
ndn::Name updateName(userPrefix + "-" + std::to_string(i));
// Add the user prefix to the producer
@@ -84,11 +83,10 @@
private:
ndn::Face m_face;
- ndn::Scheduler m_scheduler;
+ ndn::KeyChain m_keyChain;
+ ndn::Scheduler m_scheduler{m_face.getIoService()};
psync::PartialProducer m_producer;
-
- int m_nDataStreams;
uint64_t m_maxNumPublish;
ndn::random::RandomNumberEngine& m_rng;