blob: 5705e45261e9b80d5f07b9b1f8dded8cfe9d88fd [file] [log] [blame]
Alexander Afanasyev71b43e72012-12-27 01:03:43 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
Alexander Afanasyeva199f972013-01-02 19:37:26 -08003 * Copyright (c) 2013 University of California, Los Angeles
Alexander Afanasyev71b43e72012-12-27 01:03:43 -08004 *
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 SYNC_LOG_H
23#define SYNC_LOG_H
24
Alexander Afanasyeva199f972013-01-02 19:37:26 -080025#include "db-helper.h"
Alexander Afanasyev6f70a0f2013-01-02 20:44:09 -080026#include <sync-state.pb.h>
27
28typedef boost::shared_ptr<SyncStateMsg> SyncStateMsgPtr;
Alexander Afanasyev71b43e72012-12-27 01:03:43 -080029
Alexander Afanasyeva199f972013-01-02 19:37:26 -080030class SyncLog : public DbHelper
31{
32public:
33 SyncLog (const std::string &path)
34 : DbHelper (path)
35 {
36 }
Alexander Afanasyev71b43e72012-12-27 01:03:43 -080037
Alexander Afanasyeva199f972013-01-02 19:37:26 -080038 // done
39 void
40 UpdateDeviceSeqno (const std::string &name, uint64_t seqNo);
Alexander Afanasyev71b43e72012-12-27 01:03:43 -080041
Alexander Afanasyeva199f972013-01-02 19:37:26 -080042 // std::string
43 // LookupForwardingAlias (const std::string &deviceName);
Alexander Afanasyev71b43e72012-12-27 01:03:43 -080044
Alexander Afanasyeva199f972013-01-02 19:37:26 -080045 // void
46 // UpdateForwardingAlias ();
Alexander Afanasyev71b43e72012-12-27 01:03:43 -080047
Alexander Afanasyeva199f972013-01-02 19:37:26 -080048 // done
49 /**
50 * Create an entry in SyncLog and SyncStateNodes corresponding to the current state of SyncNodes
51 */
52 HashPtr
53 RememberStateInStateLog ();
54
55 // done
56 sqlite3_int64
57 LookupSyncLog (const std::string &stateHash);
58
59 // done
60 sqlite3_int64
61 LookupSyncLog (const Hash &stateHash);
62
63 // How difference is exposed will be determined later by the actual protocol
Alexander Afanasyev6f70a0f2013-01-02 20:44:09 -080064 SyncStateMsgPtr
Alexander Afanasyeva199f972013-01-02 19:37:26 -080065 FindStateDifferences (const std::string &oldHash, const std::string &newHash);
66
Alexander Afanasyev6f70a0f2013-01-02 20:44:09 -080067 SyncStateMsgPtr
Alexander Afanasyeva199f972013-01-02 19:37:26 -080068 FindStateDifferences (const Hash &oldHash, const Hash &newHash);
69};
70
Alexander Afanasyev71b43e72012-12-27 01:03:43 -080071
72#endif // SYNC_LOG_H