Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -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 OBJECT_MANAGER_H |
| 23 | #define OBJECT_MANAGER_H |
| 24 | |
| 25 | #include <string> |
| 26 | #include <ccnx-wrapper.h> |
| 27 | #include <hash-helper.h> |
| 28 | #include <boost/filesystem.hpp> |
| 29 | |
| 30 | // everything related to managing object files |
| 31 | |
| 32 | class ObjectManager |
| 33 | { |
| 34 | public: |
Alexander Afanasyev | dbc0671 | 2013-01-08 18:30:28 -0800 | [diff] [blame^] | 35 | ObjectManager (Ccnx::CcnxWrapperPtr ccnx, const boost::filesystem::path &folder); |
Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -0800 | [diff] [blame] | 36 | virtual ~ObjectManager (); |
| 37 | |
| 38 | HashPtr |
Alexander Afanasyev | dbc0671 | 2013-01-08 18:30:28 -0800 | [diff] [blame^] | 39 | localFileToObjects (const boost::filesystem::path &file, const Ccnx::Name &deviceName); |
| 40 | |
| 41 | bool |
| 42 | objectsToLocalFile (/*in*/const Ccnx::Name &deviceName, /*in*/const Hash &hash, /*out*/ const boost::filesystem::path &file); |
Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -0800 | [diff] [blame] | 43 | |
| 44 | private: |
| 45 | Ccnx::CcnxWrapperPtr m_ccnx; |
Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -0800 | [diff] [blame] | 46 | boost::filesystem::path m_folder; |
| 47 | }; |
| 48 | |
| 49 | typedef boost::shared_ptr<ObjectManager> ObjectManagerPtr; |
| 50 | |
| 51 | namespace Error { |
| 52 | struct ObjectManager : virtual boost::exception, virtual std::exception { }; |
| 53 | } |
| 54 | |
| 55 | #endif // OBJECT_MANAGER_H |