Now almost all necessary operations of sync tree and sync log work
diff --git a/src/main.cc b/src/main.cc
index f8338c4..82b5c7d 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -21,10 +21,61 @@
*/
#include "sqlite-helper.h"
+#include <iostream>
+
+using namespace std;
+using namespace boost;
+
+typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str;
+
int
main (int argc, char **argv)
{
- DbHelper db ("./");
+ try
+ {
+ DbHelper db ("./");
+
+ HashPtr hash = db.RememberStateInStateLog ();
+ // should be empty
+ cout << "Hash: [" << *hash << "]" << endl;
+
+ //
+ db.UpdateDeviceSeqno ("Alex", 1);
+ hash = db.RememberStateInStateLog ();
+ cout << "Hash: [" << *hash << "]" << endl;
+
+ db.UpdateDeviceSeqno ("Alex", 2);
+ hash = db.RememberStateInStateLog ();
+ cout << "Hash: [" << *hash << "]" << endl;
+
+ db.UpdateDeviceSeqno ("Alex", 2);
+ hash = db.RememberStateInStateLog ();
+ cout << "Hash: [" << *hash << "]" << endl;
+
+ db.UpdateDeviceSeqno ("Alex", 1);
+ hash = db.RememberStateInStateLog ();
+ cout << "Hash: [" << *hash << "]" << endl;
+
+ db.FindStateDifferences ("00", "ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52");
+ db.FindStateDifferences ("ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52", "00");
+ db.FindStateDifferences ("869c38c6dffe8911ced320aecc6d9244904d13d3e8cd21081311f2129b4557ce",
+ "ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52");
+ db.FindStateDifferences ("ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52",
+ "869c38c6dffe8911ced320aecc6d9244904d13d3e8cd21081311f2129b4557ce");
+
+ db.UpdateDeviceSeqno ("Bob", 1);
+ hash = db.RememberStateInStateLog ();
+ cout << "Hash: [" << *hash << "]" << endl;
+
+ db.FindStateDifferences ("00", "48f4d95b503b9a79c2d5939fa67722b13fc01db861fc501d09efd0a38dbafab8");
+ db.FindStateDifferences ("ec0a9941fa726e1fb8f34ecdbd8e3faa75dc9dba22e6a2ea1d8482aae5fdfb52",
+ "48f4d95b503b9a79c2d5939fa67722b13fc01db861fc501d09efd0a38dbafab8");
+ }
+ catch (const boost::exception &e)
+ {
+ cout << "ERRORR: " << *get_error_info<errmsg_info_str> (e) << endl;
+ }
+
return 0;
}