From 054633ac7b957f0e2c27ee443b17e79d4ffbb38d Mon Sep 17 00:00:00 2001
From: "Brian S. O'Neill" <bronee@gmail.com>
Date: Sat, 16 Dec 2006 21:18:49 +0000
Subject: Support write-no-sync mode for Sleepycat repositories.

---
 .../repo/sleepycat/BDBRepositoryBuilder.java       | 25 ++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

(limited to 'src/main/java/com/amazon/carbonado/repo/sleepycat')

diff --git a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
index 28123a3..86636c4 100644
--- a/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
+++ b/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
@@ -91,6 +91,7 @@ public class BDBRepositoryBuilder extends AbstractRepositoryBuilder {
     private double mLockTimeout = 0.5;
     private double mTxnTimeout = 300.0;
     private boolean mTxnNoSync;
+    private boolean mTxnWriteNoSync;
     private Boolean mDatabasesTransactional = null;
     private Map<Class<?>, Integer> mDatabasePageSizes;
     private boolean mPrivate;
@@ -422,21 +423,37 @@ public class BDBRepositoryBuilder extends AbstractRepositoryBuilder {
     }
 
     /**
-     * When true, commits are not forcibly flushed to disk. This improves
-     * performance, but there is a chance of losing the most recent commits if
-     * the machine crashes.
+     * When true, commits are not immediately written or flushed to disk. This
+     * improves performance, but there is a chance of losing the most recent
+     * commits if the process is killed or if the machine crashes.
      */
     public void setTransactionNoSync(boolean noSync) {
         mTxnNoSync = noSync;
     }
 
     /**
-     * Returns true if transactions are forcibly flushed to disk.
+     * Returns true if transactions are not written or flushed to disk.
      */
     public boolean getTransactionNoSync() {
         return mTxnNoSync;
     }
 
+    /**
+     * When true, commits are written, but they are not flushed to disk. This
+     * improves performance, but there is a chance of losing the most recent
+     * commits if the machine crashes.
+     */
+    public void setTransactionWriteNoSync(boolean noSync) {
+        mTxnWriteNoSync = noSync;
+    }
+
+    /**
+     * Returns true if transactions are not flushed to disk.
+     */
+    public boolean getTransactionWriteNoSync() {
+        return mTxnWriteNoSync;
+    }
+
     /**
      * When true, allows databases to be transactional. This setting affects
      * the databases, not the environment. If this is not explicitly set, the
-- 
cgit v1.2.3