enable default callbacks for fetch-manager
diff --git a/src/fetch-manager.cc b/src/fetch-manager.cc
index 788d635..8d98207 100644
--- a/src/fetch-manager.cc
+++ b/src/fetch-manager.cc
@@ -39,13 +39,20 @@
static const string SCHEDULE_FETCHES_TAG = "ScheduleFetches";
-FetchManager::FetchManager (CcnxWrapperPtr ccnx, const Mapping &mapping, uint32_t parallelFetches/* = 3*/)
+FetchManager::FetchManager (Ccnx::CcnxWrapperPtr ccnx
+ , const Mapping &mapping
+ , uint32_t parallelFetches // = 3
+ , const SegmentCallback &defaultSegmentCallback
+ , const FinishCallback &defaultFinishCallback
+ )
: m_ccnx (ccnx)
, m_mapping (mapping)
, m_maxParallelFetches (parallelFetches)
, m_currentParallelFetches (0)
, m_scheduler (new Scheduler)
, m_executor (new Executor(1))
+ , m_defaultSegmentCallback(defaultSegmentCallback)
+ , m_defaultFinishCallback(defaultFinishCallback)
{
m_scheduler->start ();
m_executor->start();
@@ -64,6 +71,14 @@
m_fetchList.clear_and_dispose (fetcher_disposer ());
}
+// Enqueue using default callbacks
+void
+FetchManager::Enqueue (const Ccnx::Name &deviceName, const Ccnx::Name &baseName,
+ uint64_t minSeqNo, uint64_t maxSeqNo, int priority)
+{
+ Enqueue(deviceName, baseName, m_defaultSegmentCallback, m_defaultFinishCallback, minSeqNo, maxSeqNo, priority);
+}
+
void
FetchManager::Enqueue (const Ccnx::Name &deviceName, const Ccnx::Name &baseName,
const SegmentCallback &segmentCallback, const FinishCallback &finishCallback,
diff --git a/src/fetch-manager.h b/src/fetch-manager.h
index 793c5c6..8c0ad83 100644
--- a/src/fetch-manager.h
+++ b/src/fetch-manager.h
@@ -46,7 +46,12 @@
typedef boost::function<Ccnx::Name(const Ccnx::Name &)> Mapping;
typedef boost::function<void(Ccnx::Name &deviceName, Ccnx::Name &baseName, uint64_t seq, Ccnx::PcoPtr pco)> SegmentCallback;
typedef boost::function<void(Ccnx::Name &deviceName, Ccnx::Name &baseName)> FinishCallback;
- FetchManager (Ccnx::CcnxWrapperPtr ccnx, const Mapping &mapping, uint32_t parallelFetches = 3);
+ FetchManager (Ccnx::CcnxWrapperPtr ccnx
+ , const Mapping &mapping
+ , uint32_t parallelFetches = 3
+ , const SegmentCallback &defaultSegmentCallback = SegmentCallback()
+ , const FinishCallback &defaultFinishCallback = FinishCallback()
+ );
virtual ~FetchManager ();
void
@@ -54,6 +59,11 @@
const SegmentCallback &segmentCallback, const FinishCallback &finishCallback,
uint64_t minSeqNo, uint64_t maxSeqNo, int priority=PRIORITY_NORMAL);
+ // Enqueue using default callbacks
+ void
+ Enqueue (const Ccnx::Name &deviceName, const Ccnx::Name &baseName,
+ uint64_t minSeqNo, uint64_t maxSeqNo, int priority=PRIORITY_NORMAL);
+
// only for Fetcher
inline Ccnx::CcnxWrapperPtr
GetCcnx ();
@@ -90,6 +100,8 @@
SchedulerPtr m_scheduler;
ExecutorPtr m_executor;
TaskPtr m_scheduleFetchesTask;
+ SegmentCallback m_defaultSegmentCallback;
+ FinishCallback m_defaultFinishCallback;
};
Ccnx::CcnxWrapperPtr