add fetch-task-db and integrate it with fetch-manager
diff --git a/src/fetch-task-db.h b/src/fetch-task-db.h
new file mode 100644
index 0000000..1f8e16a
--- /dev/null
+++ b/src/fetch-task-db.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+#ifndef FETCH_TASK_DB_H
+#define FETCH_TASK_DB_H
+
+#include <sqlite3.h>
+#include <ccnx-common.h>
+#include <ccnx-name.h>
+#include <boost/filesystem.hpp>
+#include <boost/shared_ptr.hpp>
+
+class FetchTaskDb
+{
+public:
+ FetchTaskDb(const boost::filesystem::path &folder, const std::string &tag);
+ ~FetchTaskDb();
+
+ // task with same deviceName and baseName combination will be added only once
+ // if task already exists, this call does nothing
+ void
+ addTask(const Ccnx::Name &deviceName, const Ccnx::Name &baseName, uint64_t minSeqNo, uint64_t maxSeqNo, int priority);
+
+ void
+ deleteTask(const Ccnx::Name &deviceName, const Ccnx::Name &baseName);
+
+ typedef boost::function<void(const Ccnx::Name &, const Ccnx::Name &, uint64_t, uint64_t, int)> FetchTaskCallback;
+
+ void
+ foreachTask(const FetchTaskCallback &callback);
+
+private:
+ sqlite3 *m_db;
+};
+
+typedef boost::shared_ptr<FetchTaskDb> FetchTaskDbPtr;
+
+#endif // FETCH_TASK_DB_H