blob: 0ffd64f19df14e27214d0f1d21bd94ab07b7b76e [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
28class ActionLog : public SyncLog
29{
30public:
31 ActionLog (const std::string &path, const std::string &localName);
32
Alexander Afanasyeva199f972013-01-02 19:37:26 -080033 void
34 AddActionUpdate (const std::string &filename,
Alexander Afanasyev433ecda2013-01-02 22:13:45 -080035 const Hash &hash,
36 time_t atime, time_t mtime, time_t ctime,
37 int mode);
Alexander Afanasyeva199f972013-01-02 19:37:26 -080038
39 void
40 AddActionMove (const std::string &oldFile, const std::string &newFile);
Alexander Afanasyev433ecda2013-01-02 22:13:45 -080041
Alexander Afanasyeva199f972013-01-02 19:37:26 -080042 void
43 AddActionDelete (const std::string &filename);
Alexander Afanasyev433ecda2013-01-02 22:13:45 -080044
45private:
46 boost::tuple<sqlite3_int64, sqlite3_int64, sqlite3_int64>
47 GetExistingRecord (const std::string &filename);
Alexander Afanasyeva199f972013-01-02 19:37:26 -080048
49protected:
Alexander Afanasyeva199f972013-01-02 19:37:26 -080050};
51
52#endif // ACTION_LOG_H