blob: f6cc0a7b37fab75331b0a39081bbd68c38f94e8c [file] [log] [blame]
Alexander Afanasyeva199f972013-01-02 19:37:26 -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 ACTION_LOG_H
23#define ACTION_LOG_H
24
25#include "sync-log.h"
Alexander Afanasyev433ecda2013-01-02 22:13:45 -080026#include <boost/tuple/tuple.hpp>
Alexander Afanasyeva199f972013-01-02 19:37:26 -080027
Alexander Afanasyevb6bc01a2013-01-02 23:34:20 -080028class ActionLog;
29typedef boost::shared_ptr<ActionLog> ActionLogPtr;
30
Alexander Afanasyeva199f972013-01-02 19:37:26 -080031class ActionLog : public SyncLog
32{
33public:
34 ActionLog (const std::string &path, const std::string &localName);
35
Alexander Afanasyeva199f972013-01-02 19:37:26 -080036 void
37 AddActionUpdate (const std::string &filename,
Alexander Afanasyev433ecda2013-01-02 22:13:45 -080038 const Hash &hash,
39 time_t atime, time_t mtime, time_t ctime,
40 int mode);
Alexander Afanasyeva199f972013-01-02 19:37:26 -080041
42 void
43 AddActionMove (const std::string &oldFile, const std::string &newFile);
Alexander Afanasyev433ecda2013-01-02 22:13:45 -080044
Alexander Afanasyeva199f972013-01-02 19:37:26 -080045 void
46 AddActionDelete (const std::string &filename);
Alexander Afanasyev433ecda2013-01-02 22:13:45 -080047
48private:
Alexander Afanasyevb6bc01a2013-01-02 23:34:20 -080049 boost::tuple<sqlite3_int64, sqlite3_int64, sqlite3_int64, std::string>
Alexander Afanasyev433ecda2013-01-02 22:13:45 -080050 GetExistingRecord (const std::string &filename);
Alexander Afanasyevee7e6132013-01-03 20:03:14 -080051
52 static void
53 apply_action_xFun (sqlite3_context *context, int argc, sqlite3_value **argv);
Alexander Afanasyeva199f972013-01-02 19:37:26 -080054
55protected:
Alexander Afanasyeva199f972013-01-02 19:37:26 -080056};
57
58#endif // ACTION_LOG_H