core: delete deprecated getGlobalScheduler() API
refs #1290
Change-Id: If994e3bd303f0788d8e945351c182bbd4ab5e0b2
diff --git a/daemon/core/scheduler.cpp b/daemon/core/scheduler.cpp
index 439b914..a453112 100644
--- a/daemon/core/scheduler.cpp
+++ b/daemon/core/scheduler.cpp
@@ -5,13 +5,14 @@
*/
#include "scheduler.hpp"
+#include "global-io.hpp"
namespace nfd {
namespace scheduler {
static shared_ptr<Scheduler> g_scheduler;
-Scheduler&
+inline Scheduler&
getGlobalScheduler()
{
if (!static_cast<bool>(g_scheduler)) {
@@ -20,6 +21,18 @@
return *g_scheduler;
}
+EventId
+schedule(const time::nanoseconds& after, const Scheduler::Event& event)
+{
+ return getGlobalScheduler().scheduleEvent(after, event);
+}
+
+void
+cancel(const EventId& eventId)
+{
+ getGlobalScheduler().cancelEvent(eventId);
+}
+
void
resetGlobalScheduler()
{
diff --git a/daemon/core/scheduler.hpp b/daemon/core/scheduler.hpp
index a7f452b..7ae8083 100644
--- a/daemon/core/scheduler.hpp
+++ b/daemon/core/scheduler.hpp
@@ -7,7 +7,7 @@
#ifndef NFD_CORE_SCHEDULER_HPP
#define NFD_CORE_SCHEDULER_HPP
-#include "global-io.hpp"
+#include "common.hpp"
#include <ndn-cpp-dev/util/scheduler.hpp>
namespace nfd {
@@ -20,32 +20,20 @@
*/
using ndn::EventId;
-} // namespace scheduler
+/** \brief schedule an event
+ */
+EventId
+schedule(const time::nanoseconds& after, const Scheduler::Event& event);
-// TODO delete this after transition
-using scheduler::Scheduler;
+/** \brief cancel a scheduled event
+ */
+void
+cancel(const EventId& eventId);
+
+} // namespace scheduler
using scheduler::EventId;
-namespace scheduler {
-
-// TODO delete this after transition
-Scheduler&
-getGlobalScheduler();
-
-inline EventId
-schedule(const time::nanoseconds& after, const Scheduler::Event& event)
-{
- return getGlobalScheduler().scheduleEvent(after, event);
-}
-
-inline void
-cancel(const EventId& eventId)
-{
- getGlobalScheduler().cancelEvent(eventId);
-}
-
-} // namespace scheduler
} // namespace nfd
#endif // NFD_CORE_SCHEDULER_HPP
diff --git a/daemon/face/ndnlp-partial-message-store.cpp b/daemon/face/ndnlp-partial-message-store.cpp
index e252c84..9cb9f33 100644
--- a/daemon/face/ndnlp-partial-message-store.cpp
+++ b/daemon/face/ndnlp-partial-message-store.cpp
@@ -61,9 +61,8 @@
return Block(buffer);
}
-PartialMessageStore::PartialMessageStore(Scheduler& scheduler, const time::nanoseconds& idleDuration)
- : m_scheduler(scheduler)
- , m_idleDuration(idleDuration)
+PartialMessageStore::PartialMessageStore(const time::nanoseconds& idleDuration)
+ : m_idleDuration(idleDuration)
{
}
@@ -99,7 +98,7 @@
PartialMessageStore::scheduleCleanup(uint64_t messageIdentifier,
shared_ptr<PartialMessage> partialMessage)
{
- partialMessage->m_expiry = m_scheduler.scheduleEvent(m_idleDuration,
+ partialMessage->m_expiry = scheduler::schedule(m_idleDuration,
bind(&PartialMessageStore::cleanup, this, messageIdentifier));
}
@@ -112,7 +111,7 @@
return;
}
- m_scheduler.cancelEvent(it->second->m_expiry);
+ scheduler::cancel(it->second->m_expiry);
m_partialMessages.erase(it);
}
diff --git a/daemon/face/ndnlp-partial-message-store.hpp b/daemon/face/ndnlp-partial-message-store.hpp
index 7cd3df8..74e3fd9 100644
--- a/daemon/face/ndnlp-partial-message-store.hpp
+++ b/daemon/face/ndnlp-partial-message-store.hpp
@@ -52,8 +52,8 @@
class PartialMessageStore : noncopyable
{
public:
- PartialMessageStore(Scheduler& scheduler,
- const time::nanoseconds& idleDuration = time::milliseconds(100));
+ explicit
+ PartialMessageStore(const time::nanoseconds& idleDuration = time::milliseconds(100));
virtual
~PartialMessageStore();
@@ -79,7 +79,6 @@
private:
std::map<uint64_t, shared_ptr<PartialMessage> > m_partialMessages;
- Scheduler& m_scheduler;
time::nanoseconds m_idleDuration;
};
diff --git a/daemon/main.cpp b/daemon/main.cpp
index 0f73167..dff26cd 100644
--- a/daemon/main.cpp
+++ b/daemon/main.cpp
@@ -5,7 +5,10 @@
*/
#include <getopt.h>
+#include <boost/filesystem.hpp>
+
#include "core/logger.hpp"
+#include "core/global-io.hpp"
#include "fw/forwarder.hpp"
#include "mgmt/internal-face.hpp"
#include "mgmt/fib-manager.hpp"
@@ -14,8 +17,6 @@
#include "mgmt/status-server.hpp"
#include "mgmt/config-file.hpp"
-#include <boost/filesystem.hpp>
-
namespace nfd {
NFD_LOG_INIT("Main");