blob: eb385511c726dee0aa407b1ddc648b72e3605154 [file] [log] [blame]
Alexander Afanasyev49a18522013-01-18 17:49:04 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012-2013 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 * Zhenkai Zhu <zhenkai@cs.ucla.edu>
20 */
21
22#ifndef FETCH_MANAGER_H
23#define FETCH_MANAGER_H
24
25#include <boost/exception/all.hpp>
26#include <boost/shared_ptr.hpp>
27#include <string>
28#include <stdint.h>
29#include "scheduler.h"
30
31#include "ccnx-wrapper.h"
32#include "ccnx-tunnel.h"
33#include "sync-log.h"
34
35class FetchManager
36{
37 enum
38 {
39 PRIORITY_NORMAL,
40 PRIORITY_HIGH
41 };
42
43public:
44 FetchManager (Ccnx::CcnxWrapperPtr ccnx, SyncLogPtr sync);
45 virtual ~FetchManager ();
46
47 void
Alexander Afanasyeve41e7d22013-01-19 15:13:47 -080048 Enqueue (const Ccnx::Name &deviceName,
49 uint32_t minSeqNo, uint32_t maxSeqNo, int priority=PRIORITY_NORMAL);
50
51 Ccnx::CcnxWrapperPtr
52 GetCcnx ();
53
54 SchedulerPtr
55 GetScheduler ();
Alexander Afanasyev49a18522013-01-18 17:49:04 -080056
57private:
58 Ccnx::CcnxWrapperPtr m_ccnx;
59 SyncLogPtr m_sync; // to access forwarding hints
Alexander Afanasyeve41e7d22013-01-19 15:13:47 -080060 SchedulerPtr m_scheduler;
Alexander Afanasyev49a18522013-01-18 17:49:04 -080061};
62
63
64typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str;
65namespace Error {
66struct Fetcher : virtual boost::exception, virtual std::exception { };
67}
68
69typedef boost::shared_ptr<FetchManager> FetchManagerPtr;
70
71
72#endif // FETCHER_H