Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame^] | 3 | * Copyright (c) 2013 University of California, Los Angeles |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 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 SYNC_LOG_H |
| 23 | #define SYNC_LOG_H |
| 24 | |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame^] | 25 | #include "db-helper.h" |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 26 | |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame^] | 27 | class SyncLog : public DbHelper |
| 28 | { |
| 29 | public: |
| 30 | SyncLog (const std::string &path) |
| 31 | : DbHelper (path) |
| 32 | { |
| 33 | } |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 34 | |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame^] | 35 | // done |
| 36 | void |
| 37 | UpdateDeviceSeqno (const std::string &name, uint64_t seqNo); |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 38 | |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame^] | 39 | // std::string |
| 40 | // LookupForwardingAlias (const std::string &deviceName); |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 41 | |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame^] | 42 | // void |
| 43 | // UpdateForwardingAlias (); |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 44 | |
Alexander Afanasyev | a199f97 | 2013-01-02 19:37:26 -0800 | [diff] [blame^] | 45 | // done |
| 46 | /** |
| 47 | * Create an entry in SyncLog and SyncStateNodes corresponding to the current state of SyncNodes |
| 48 | */ |
| 49 | HashPtr |
| 50 | RememberStateInStateLog (); |
| 51 | |
| 52 | // done |
| 53 | sqlite3_int64 |
| 54 | LookupSyncLog (const std::string &stateHash); |
| 55 | |
| 56 | // done |
| 57 | sqlite3_int64 |
| 58 | LookupSyncLog (const Hash &stateHash); |
| 59 | |
| 60 | // How difference is exposed will be determined later by the actual protocol |
| 61 | void |
| 62 | FindStateDifferences (const std::string &oldHash, const std::string &newHash); |
| 63 | |
| 64 | void |
| 65 | FindStateDifferences (const Hash &oldHash, const Hash &newHash); |
| 66 | }; |
| 67 | |
Alexander Afanasyev | 71b43e7 | 2012-12-27 01:03:43 -0800 | [diff] [blame] | 68 | |
| 69 | #endif // SYNC_LOG_H |