Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -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 ACTION_LOG_H |
| 23 | #define ACTION_LOG_H |
| 24 | |
| 25 | #include "sync-log.h" |
Alexander Afanasyev | 433ecda | 2013-01-02 22:13:45 -0800 | [diff] [blame] | 26 | #include <boost/tuple/tuple.hpp> |
Alexander Afanasyev | c9eb68f | 2013-01-07 13:40:00 -0800 | [diff] [blame] | 27 | #include <ccnx-wrapper.h> |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame] | 28 | |
Alexander Afanasyev | b6bc01a | 2013-01-02 23:34:20 -0800 | [diff] [blame] | 29 | class ActionLog; |
| 30 | typedef boost::shared_ptr<ActionLog> ActionLogPtr; |
| 31 | |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame] | 32 | class ActionLog : public SyncLog |
| 33 | { |
| 34 | public: |
Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -0800 | [diff] [blame] | 35 | ActionLog (Ccnx::CcnxWrapperPtr ccnx, const boost::filesystem::path &path, |
| 36 | const std::string &localName, const std::string &sharedFolder); |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame] | 37 | |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame] | 38 | void |
| 39 | AddActionUpdate (const std::string &filename, |
Alexander Afanasyev | 433ecda | 2013-01-02 22:13:45 -0800 | [diff] [blame] | 40 | const Hash &hash, |
Alexander Afanasyev | 68f2a95 | 2013-01-08 14:34:16 -0800 | [diff] [blame] | 41 | time_t wtime, |
Alexander Afanasyev | 433ecda | 2013-01-02 22:13:45 -0800 | [diff] [blame] | 42 | int mode); |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame] | 43 | |
| 44 | void |
| 45 | AddActionMove (const std::string &oldFile, const std::string &newFile); |
Alexander Afanasyev | 433ecda | 2013-01-02 22:13:45 -0800 | [diff] [blame] | 46 | |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame] | 47 | void |
| 48 | AddActionDelete (const std::string &filename); |
Alexander Afanasyev | 433ecda | 2013-01-02 22:13:45 -0800 | [diff] [blame] | 49 | |
| 50 | private: |
Alexander Afanasyev | b6bc01a | 2013-01-02 23:34:20 -0800 | [diff] [blame] | 51 | boost::tuple<sqlite3_int64, sqlite3_int64, sqlite3_int64, std::string> |
Alexander Afanasyev | 433ecda | 2013-01-02 22:13:45 -0800 | [diff] [blame] | 52 | GetExistingRecord (const std::string &filename); |
Alexander Afanasyev | ee7e613 | 2013-01-03 20:03:14 -0800 | [diff] [blame] | 53 | |
| 54 | static void |
| 55 | apply_action_xFun (sqlite3_context *context, int argc, sqlite3_value **argv); |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame] | 56 | |
Alexander Afanasyev | c9eb68f | 2013-01-07 13:40:00 -0800 | [diff] [blame] | 57 | private: |
| 58 | Ccnx::CcnxWrapperPtr m_ccnx; |
| 59 | Ccnx::Name m_sharedFolderName; |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | #endif // ACTION_LOG_H |