From ce1626b90b749055e28fdfa68ed3ae6de305a64f Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 18 Dec 2014 21:16:52 +0000
Subject: [PATCH] OPENDJ-1602 (CR-5566) New pluggable storage based backend

---
 opendj3-server-dev/src/server/org/opends/server/backends/pluggable/VLVIndex.java |   63 +------------------------------
 1 files changed, 2 insertions(+), 61 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/VLVIndex.java b/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/VLVIndex.java
index b7ec6a4..0050067 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/VLVIndex.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/VLVIndex.java
@@ -255,24 +255,6 @@
   /**
    * Update the vlvIndex for a new entry.
    *
-   * @param txn A database transaction, or null if none is required.
-   * @param entryID     The entry ID.
-   * @param entry       The entry to be indexed.
-   * @return True if the entry ID for the entry are added. False if
-   *         the entry ID already exists.
-   * @throws StorageRuntimeException If an error occurs in the JE database.
-   * @throws DirectoryException If a Directory Server error occurs.
-   */
-  public boolean addEntry(WriteableStorage txn, EntryID entryID, Entry entry)
-      throws StorageRuntimeException, DirectoryException
-  {
-    return shouldInclude(entry)
-        && insertValues(txn, entryID.longValue(), entry);
-  }
-
-  /**
-   * Update the vlvIndex for a new entry.
-   *
    * @param buffer      The index buffer to buffer the changes.
    * @param entryID     The entry ID.
    * @param entry       The entry to be indexed.
@@ -287,7 +269,7 @@
     if (shouldInclude(entry))
     {
       final SortValues sortValues = new SortValues(entryID, entry, sortOrder);
-      buffer.getVLVIndex(this).addValues(sortValues);
+      buffer.getBufferedVLVIndexValues(this).addValues(sortValues);
       return true;
     }
     return false;
@@ -309,7 +291,7 @@
     if (shouldInclude(entry))
     {
       final SortValues sortValues = new SortValues(entryID, entry, sortOrder);
-      buffer.getVLVIndex(this).deleteValues(sortValues);
+      buffer.getBufferedVLVIndexValues(this).deleteValues(sortValues);
       return true;
     }
     return false;
@@ -476,47 +458,6 @@
     return pos >= 0;
   }
 
-  private boolean insertValues(WriteableStorage txn, long entryID, Entry entry)
-      throws StorageRuntimeException, DirectoryException
-  {
-    ByteString[] values = getSortValues(entry);
-    AttributeType[] types = getSortTypes();
-    ByteString key = encodeKey(entryID, values, types);
-
-    SortValuesSet sortValuesSet = getSortValuesSet(txn, key, true);
-    boolean success = sortValuesSet.add(entryID, values, types);
-
-    int newSize = sortValuesSet.size();
-    if(newSize >= sortedSetCapacity)
-    {
-      SortValuesSet splitSortValuesSet = sortValuesSet.split(newSize / 2);
-      put(txn, splitSortValuesSet); // splitAfter
-      put(txn, sortValuesSet); // after
-
-      if(logger.isTraceEnabled())
-      {
-        logger.trace("SortValuesSet with key %s has reached" +
-            " the entry size of %d. Spliting into two sets with " +
-            " keys %s and %s.", splitSortValuesSet.getKeySortValues(),
-                                newSize, sortValuesSet.getKeySortValues(),
-                                splitSortValuesSet.getKeySortValues());
-      }
-    }
-    else
-    {
-      ByteString after = sortValuesSet.toByteString();
-      put(txn, key, after);
-      // TODO: What about phantoms?
-    }
-
-    if(success)
-    {
-      count.getAndIncrement();
-    }
-
-    return success;
-  }
-
   private void put(WriteableStorage txn, SortValuesSet set) throws DirectoryException
   {
     put(txn, set.getKeyBytes(), set.toByteString());

--
Gitblit v1.10.0