directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r787602 - in /directory/apacheds/trunk: jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java xdbm-base/src/main/java/org/apache/directory/server/xdbm/Index.java
Date Tue, 23 Jun 2009 09:34:24 GMT
Author: elecharny
Date: Tue Jun 23 09:34:24 2009
New Revision: 787602

URL: http://svn.apache.org/viewvc?rev=787602&view=rev
Log:
o Added some javadoc on the Index.drop( K ) method
o Removed a useless Tuple creation

Modified:
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Index.java

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=787602&r1=787601&r2=787602&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
Tue Jun 23 09:34:24 2009
@@ -471,19 +471,18 @@
 
 
     /**
-     * @see Index#drop(Long)
+     * {@inheritDoc}
      */
-    public void drop( Long id ) throws Exception
+    public void drop( Long entryId ) throws Exception
     {
-        Cursor<Tuple<Long,K>> values = reverse.cursor( id );
-        Tuple<Long,K> tuple = new Tuple<Long,K>( id, null );
-
+        Cursor<Tuple<Long,K>> values = reverse.cursor( entryId );
+        
         while ( values.next() )
         {
-            forward.remove( values.get().getValue(), id );
+            forward.remove( values.get().getValue(), entryId );
         }
 
-        reverse.remove( id );
+        reverse.remove( entryId );
     }
 
 

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Index.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Index.java?rev=787602&r1=787601&r2=787602&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Index.java
(original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Index.java
Tue Jun 23 09:34:24 2009
@@ -168,7 +168,34 @@
     void add( K attrVal, Long id ) throws Exception;
 
 
-    void drop( Long id ) throws Exception;
+    /**
+     * Remove all the reference to an entry from the index.
+     * 
+     * As an entry might be referenced more than once in the forward index,
+     * depending on which index we are dealing with, we need to iterate 
+     * over all the values contained into the reverse index for this entryId.
+     * 
+     * For instance, considering the ObjectClass index for an entry having
+     * three ObjectClasses (top, person, inetOrgPerson), then the reverse
+     * index will contain :
+     * 
+     * [entryId, [top, person, inetOrgPerson]]
+     * 
+     * and the forward index will contain many entries like :
+     * [top, [..., entryId, ...]]
+     * [person,  [..., entryId, ...]]
+     * [inetOrgPerson,  [..., entryId, ...]]
+     * 
+     * So dropping the entryId means that we must first get all the values from
+     * the reverse index (and we will get [top, person, inetOrgPerson]) then to
+     * iterate through all those values to remove entryId from the associated 
+     * list of entryIds.
+     * 
+     * 
+     * @param entryId The master table entry ID to remove
+     * @throws Exception
+     */
+    void drop( Long entryId ) throws Exception;
 
 
     void drop( K attrVal, Long id ) throws Exception;



Mime
View raw message