Alexander Afanasyev | 49a1852 | 2013-01-18 17:49:04 -0800 | [diff] [blame] | 1 | /* -*- 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 | |
| 35 | class FetchManager |
| 36 | { |
| 37 | enum |
| 38 | { |
| 39 | PRIORITY_NORMAL, |
| 40 | PRIORITY_HIGH |
| 41 | }; |
| 42 | |
| 43 | public: |
| 44 | FetchManager (Ccnx::CcnxWrapperPtr ccnx, SyncLogPtr sync); |
| 45 | virtual ~FetchManager (); |
| 46 | |
| 47 | void |
Alexander Afanasyev | e41e7d2 | 2013-01-19 15:13:47 -0800 | [diff] [blame^] | 48 | 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 Afanasyev | 49a1852 | 2013-01-18 17:49:04 -0800 | [diff] [blame] | 56 | |
| 57 | private: |
| 58 | Ccnx::CcnxWrapperPtr m_ccnx; |
| 59 | SyncLogPtr m_sync; // to access forwarding hints |
Alexander Afanasyev | e41e7d2 | 2013-01-19 15:13:47 -0800 | [diff] [blame^] | 60 | SchedulerPtr m_scheduler; |
Alexander Afanasyev | 49a1852 | 2013-01-18 17:49:04 -0800 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | |
| 64 | typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str; |
| 65 | namespace Error { |
| 66 | struct Fetcher : virtual boost::exception, virtual std::exception { }; |
| 67 | } |
| 68 | |
| 69 | typedef boost::shared_ptr<FetchManager> FetchManagerPtr; |
| 70 | |
| 71 | |
| 72 | #endif // FETCHER_H |