<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -39,6 +39,12 @@ void Store_setCompareFunction_(Store *self, void *func)
 	self-&gt;compareFunc = func;
 }
 
+void Store_setHardSync_(Store *self, int aBool)
+{
+	self-&gt;hardSync = aBool;
+}
+
+
 int Store_open(Store *self)
 {
 	self-&gt;db = tcbdbnew();
@@ -67,7 +73,13 @@ int Store_open(Store *self)
 	}
 
 	{
-		int flags = BDBOWRITER | BDBOCREAT | BDBONOLCK; //BDBOTSYNC
+		int flags = BDBOWRITER | BDBOCREAT | BDBONOLCK;
+		
+		if (self-&gt;hardSync) 
+		{
+			printf(&quot;Store: hard disk syncing enabled\n&quot;);
+			flags |= BDBOTSYNC;
+		}
 		
 		if (!tcbdbopen(self-&gt;db, self-&gt;path, flags))
 		{</diff>
      <filename>source/Store.c</filename>
    </modified>
    <modified>
      <diff>@@ -23,12 +23,14 @@ typedef struct
 	char *path;
 	void *compareFunc;
 	void *db;
+	int hardSync;
 } Store;
 
 Store *Store_new(void);
 void Store_free(Store *self);
 
 void Store_setCompareFunction_(Store *self, void *func);
+void Store_setHardSync_(Store *self, int aBool);
 
 void Store_setPath_(Store *self, const char *p);
 const char *Store_path(Store *self);</diff>
      <filename>source/Store.h</filename>
    </modified>
    <modified>
      <diff>@@ -1224,6 +1224,11 @@ void VertexServer_setDebug_(VertexServer *self, int aBool)
 	self-&gt;debug = aBool;
 }
 
+void VertexServer_setHardSync_(VertexServer *self, int aBool)
+{
+	self-&gt;hardSync = 1;
+}
+
 void VertexServer_writePidFile(VertexServer *self)
 {
 	FILE *pidFile = fopen(self-&gt;pidPath, &quot;w&quot;);
@@ -1332,6 +1337,8 @@ int VertexServer_run(VertexServer *self)
 	//VertexServer_setStaticPath_(self, &quot;.&quot;);
 	VertexServer_registerSignals(self);
 	
+	PDB_setHardSync_(self-&gt;pdb, self-&gt;hardSync);
+	
 	if (PDB_open(self-&gt;pdb)) 
 	{ 
 		Log_Printf(&quot;unable to open database file\n&quot;);</diff>
      <filename>source/VertexServer.c</filename>
    </modified>
    <modified>
      <diff>@@ -54,6 +54,7 @@ typedef struct
 	yajl_gen yajl;
 	
 	int debug;
+	int hardSync;
 } VertexServer;
 
 typedef int (VertexAction)(VertexServer *);
@@ -67,6 +68,7 @@ void VertexServer_setLogPath_(VertexServer *self, const char *path);
 void VertexServer_setPidPath_(VertexServer *self, const char *path);
 void VertexServer_setIsDaemon_(VertexServer *self, int isDaemon);
 void VertexServer_setDebug_(VertexServer *self, int aBool);
+void VertexServer_setHardSync_(VertexServer *self, int aBool);
 
 int VertexServer_process(VertexServer *self);
 int VertexServer_run(VertexServer *self);</diff>
      <filename>source/VertexServer.h</filename>
    </modified>
    <modified>
      <diff>@@ -43,6 +43,11 @@ int main(int argc, char **argv)
 			a ++;
 			VertexServer_setDebug_(server, 1);
 		}
+		else if (strcmp(argv[a], &quot;-hardsync&quot;) == 0)
+		{
+			a ++;
+			VertexServer_setHardSync_(server, 1);
+		}
 	}
 	
 	VertexServer_run(server);</diff>
      <filename>source/main.c</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,6 @@
 #include &lt;assert.h&gt;
 
 #define PDB_USE_TX 1
-//#define PDB_USE_SYNC 1
 
 static int pathCompareBase(const char *p1, int len1, const char *p2, int len2, void *optionalOpaqueValue)
 {
@@ -119,6 +118,11 @@ void PDB_setPathCString_(PDB *self, const char *path)
 	Datum_appendCString_(File_path(self-&gt;corruptFile), &quot;.corrupt&quot;);
 }
 
+void PDB_setHardSync_(PDB *self, int aBool)
+{
+	self-&gt;hardSync = aBool;
+}
+
 void PDB_createRootIfNeeded(PDB *self)
 {
 	int size;
@@ -134,8 +138,8 @@ void PDB_createRootIfNeeded(PDB *self)
 	
 int PDB_open(PDB *self)
 {
-
 	Store_setCompareFunction_(self-&gt;store, pathCompare);
+	Store_setHardSync_(self-&gt;store, self-&gt;hardSync);
 	
 	if (Datum_isEmpty(File_path(self-&gt;dbFile)))
 	{</diff>
      <filename>source/pdb/PDB.c</filename>
    </modified>
    <modified>
      <diff>@@ -38,6 +38,7 @@ typedef struct
 		
 	yajl_gen yajl;
 	int isClosing;
+	int hardSync;
 } PDB;
 
 PDB *PDB_new(void);
@@ -53,6 +54,8 @@ void PDB_setPathCString_(PDB *self, const char *path);
 int PDB_open(PDB *self);
 void PDB_close(PDB *self);
 
+void PDB_setHardSync_(PDB *self, int aBool);
+
 // clean shutdown ------------
 void PDB_setUseBackups_(PDB *self, int aBool);
 int PDB_replaceDbWithLastBackUp(PDB *self);</diff>
      <filename>source/pdb/PDB.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ceebcb0387e575147aa3ff84b5ec68b9d70383fb</id>
    </parent>
    <parent>
      <id>3666e5a76e991faa4f8fe532c8fa1dfc114f51cf</id>
    </parent>
  </parents>
  <author>
    <name>Rich Collins</name>
    <email>richcollins@gmail.com</email>
  </author>
  <url>http://github.com/hassy/vertexdb/commit/a3586a279e8fbeed5ce2073775fc38c1f4ca8b45</url>
  <id>a3586a279e8fbeed5ce2073775fc38c1f4ca8b45</id>
  <committed-date>2009-10-30T23:30:50-07:00</committed-date>
  <authored-date>2009-10-30T23:30:50-07:00</authored-date>
  <message>Merge branch 'master' of git://github.com/stevedekorte/vertexdb</message>
  <tree>e5bd135d24e11d2be00086b7abee22733d1c4964</tree>
  <committer>
    <name>Rich Collins</name>
    <email>richcollins@gmail.com</email>
  </committer>
</commit>
