You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by ka...@apache.org on 2013/04/29 15:44:26 UTC

svn commit: r1477067 - /labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java

Author: kayyagari
Date: Mon Apr 29 13:44:26 2013
New Revision: 1477067

URL: http://svn.apache.org/r1477067
Log:
modified the internal insert method to return the InsertResult type

Modified:
    labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java

Modified: labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java?rev=1477067&r1=1477066&r2=1477067&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java (original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java Mon Apr 29 13:44:26 2013
@@ -760,8 +760,13 @@ public class BTree<K, V>
             // Commented atm, we will have to play around the idea of transactions later
             writeLock.lock();
 
-            existingValue = insert( key, value, revision );
+            InsertResult<K, V> result = insert( key, value, revision );
 
+            if( result instanceof ModifyResult )
+            {
+                existingValue = ( ( ModifyResult<K, V> ) result ).getModifiedValue();
+            }
+            
             // If the BTree is managed, we have to update the rootPage on disk
             if ( isManaged() )
             {
@@ -1161,9 +1166,9 @@ public class BTree<K, V>
      * @param key Inserted key
      * @param value Inserted value
      * @param revision The revision to use
-     * @return Existing value, if any.
+     * @return an instance of the InsertResult.
      */
-    /*No qualifier*/V insert( K key, V value, long revision ) throws IOException
+    /*No qualifier*/InsertResult<K, V> insert( K key, V value, long revision ) throws IOException
     {
         if ( key == null )
         {
@@ -1284,7 +1289,7 @@ public class BTree<K, V>
         }
 
         // Return the value we have found if it was modified
-        return modifiedValue;
+        return result;
     }
 
 
@@ -1869,7 +1874,7 @@ public class BTree<K, V>
         this.keepRevisions = keepRevisions;
     }
 
-
+    
     /**
      * @see Object#toString()
      */



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org