Centralize/deduplicate some constants
Change-Id: I80c542abbf6d4978261c0f7e839bef2fb1fa3a91
diff --git a/PSync/common.hpp b/PSync/common.hpp
index d72198d..aee210a 100644
--- a/PSync/common.hpp
+++ b/PSync/common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis
+ * Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -23,6 +23,7 @@
#include "PSync/detail/config.hpp"
#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/util/time.hpp>
#include <cstddef>
#include <cstdint>
@@ -32,6 +33,13 @@
namespace psync {
+using namespace ndn::time_literals;
+
+const ndn::time::milliseconds HELLO_INTEREST_LIFETIME = 1_s;
+const ndn::time::milliseconds HELLO_REPLY_FRESHNESS = 1_s;
+const ndn::time::milliseconds SYNC_INTEREST_LIFETIME = 1_s;
+const ndn::time::milliseconds SYNC_REPLY_FRESHNESS = 1_s;
+
enum class CompressionScheme {
NONE,
ZLIB,
diff --git a/PSync/consumer.hpp b/PSync/consumer.hpp
index 3a695cb..b081937 100644
--- a/PSync/consumer.hpp
+++ b/PSync/consumer.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis
+ * Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -28,19 +28,13 @@
#include <ndn-cxx/util/random.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/segment-fetcher.hpp>
-#include <ndn-cxx/util/time.hpp>
#include <map>
namespace psync {
-using namespace ndn::time_literals;
-
using ReceiveHelloCallback = std::function<void(const std::map<ndn::Name, uint64_t>&)>;
-const ndn::time::milliseconds HELLO_INTEREST_LIFETIME = 1_s;
-const ndn::time::milliseconds SYNC_INTEREST_LIFETIME = 1_s;
-
/**
* @brief Consumer logic to subscribe to producer's data
*
diff --git a/PSync/full-producer.hpp b/PSync/full-producer.hpp
index d510d2d..b12d439 100644
--- a/PSync/full-producer.hpp
+++ b/PSync/full-producer.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis
+ * Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -29,8 +29,6 @@
namespace psync {
-const ndn::time::milliseconds SYNC_INTEREST_LIFTIME = 1_s;
-
/**
* @brief Full sync logic to synchronize with other nodes
* where all nodes wants to get all names prefixes synced.
@@ -63,7 +61,7 @@
const ndn::Name& syncPrefix,
const ndn::Name& userPrefix,
const UpdateCallback& onUpdateCallBack,
- ndn::time::milliseconds syncInterestLifetime = SYNC_INTEREST_LIFTIME,
+ ndn::time::milliseconds syncInterestLifetime = SYNC_INTEREST_LIFETIME,
ndn::time::milliseconds syncReplyFreshness = SYNC_REPLY_FRESHNESS,
CompressionScheme ibltCompression = CompressionScheme::DEFAULT,
CompressionScheme contentCompression = CompressionScheme::DEFAULT);
diff --git a/PSync/partial-producer.hpp b/PSync/partial-producer.hpp
index 8a60a28..07ffabd 100644
--- a/PSync/partial-producer.hpp
+++ b/PSync/partial-producer.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis
+ * Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -28,12 +28,9 @@
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/scheduler.hpp>
-#include <ndn-cxx/util/time.hpp>
namespace psync {
-const ndn::time::milliseconds HELLO_REPLY_FRESHNESS = 1_s;
-
/**
* @brief Partial sync logic to publish data names
*
diff --git a/PSync/producer-base.hpp b/PSync/producer-base.hpp
index 03eae63..123b360 100644
--- a/PSync/producer-base.hpp
+++ b/PSync/producer-base.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis
+ * Copyright (c) 2014-2021, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
@@ -30,7 +30,6 @@
#include <ndn-cxx/security/validator-config.hpp>
#include <ndn-cxx/util/random.hpp>
#include <ndn-cxx/util/scheduler.hpp>
-#include <ndn-cxx/util/time.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>
@@ -40,9 +39,6 @@
namespace psync {
namespace bm = boost::bimaps;
-using namespace ndn::time_literals;
-
-const ndn::time::milliseconds SYNC_REPLY_FRESHNESS = 1_s;
/**
* @brief Base class for PartialProducer and FullProducer