From 17e216ed32e21eddece22d782f8a256711ab3ad8 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 04 Dec 2014 15:08:07 +0000
Subject: [PATCH] OPENDJ-1602 (CR-5566) New pluggable storage based backend
---
opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java | 124 ++--------------------------------------
1 files changed, 8 insertions(+), 116 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java
index be3c7aa..2e8f6ff 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java
@@ -55,7 +55,6 @@
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
-import com.sleepycat.je.Transaction;
import static org.opends.messages.JebMessages.*;
import static org.opends.server.util.ServerConstants.*;
@@ -115,29 +114,22 @@
* class in the SDK could implement the logic, I hope).
*/
- /**
- * A database key for the presence index.
- */
- public static final DatabaseEntry presenceKey =
- new DatabaseEntry("+".getBytes());
+ /** A database key for the presence index. */
+ static final DatabaseEntry presenceKey = new DatabaseEntry("+".getBytes());
- /**
- * The entryContainer in which this attribute index resides.
- */
- private EntryContainer entryContainer;
- private Environment env;
- private State state;
+ /** The entryContainer in which this attribute index resides. */
+ private final EntryContainer entryContainer;
+ private final Environment env;
+ private final State state;
- /**
- * The attribute index configuration.
- */
+ /** The attribute index configuration. */
private LocalDBIndexCfg indexConfig;
/** The mapping from names to indexes. */
private final Map<String, Index> nameToIndexes;
private final IndexQueryFactory<IndexQuery> indexQueryFactory;
- private int cursorEntryLimit = 100000;
+ private final int cursorEntryLimit = 100000;
/**
* The mapping from extensible index types (e.g. "substring" or "shared") to list of indexes.
@@ -362,33 +354,6 @@
}
/**
- * Update the attribute index for a new entry.
- *
- * @param txn The database transaction to be used for the insertions.
- * @param entryID The entry ID.
- * @param entry The contents of the new entry.
- * @return True if all the index keys for the entry are added. False if the
- * entry ID already exists for some keys.
- * @throws DatabaseException If an error occurs in the JE database.
- * @throws DirectoryException If a Directory Server error occurs.
- */
- public boolean addEntry(Transaction txn, EntryID entryID, Entry entry)
- throws DatabaseException, DirectoryException
- {
- boolean success = true;
-
- final IndexingOptions options = indexQueryFactory.getIndexingOptions();
- for (Index index : nameToIndexes.values())
- {
- if (!index.addEntry(txn, entryID, entry, options))
- {
- success = false;
- }
- }
- return success;
- }
-
- /**
* Update the attribute index for a deleted entry.
*
* @param buffer The index buffer to use to store the deleted keys
@@ -408,51 +373,6 @@
}
/**
- * Update the attribute index for a deleted entry.
- *
- * @param txn The database transaction to be used for the deletions
- * @param entryID The entry ID
- * @param entry The contents of the deleted entry.
- * @throws DatabaseException If an error occurs in the JE database.
- * @throws DirectoryException If a Directory Server error occurs.
- */
- public void removeEntry(Transaction txn, EntryID entryID, Entry entry)
- throws DatabaseException, DirectoryException
- {
- final IndexingOptions options = indexQueryFactory.getIndexingOptions();
- for (Index index : nameToIndexes.values())
- {
- index.removeEntry(txn, entryID, entry, options);
- }
- }
-
- /**
- * Update the index to reflect a sequence of modifications in a Modify
- * operation.
- *
- * @param txn The JE transaction to use for database updates.
- * @param entryID The ID of the entry that was modified.
- * @param oldEntry The entry before the modifications were applied.
- * @param newEntry The entry after the modifications were applied.
- * @param mods The sequence of modifications in the Modify operation.
- * @throws DatabaseException If an error occurs during an operation on a
- * JE database.
- */
- public void modifyEntry(Transaction txn,
- EntryID entryID,
- Entry oldEntry,
- Entry newEntry,
- List<Modification> mods)
- throws DatabaseException
- {
- final IndexingOptions options = indexQueryFactory.getIndexingOptions();
- for (Index index : nameToIndexes.values())
- {
- index.modifyEntry(txn, entryID, oldEntry, newEntry, mods, options);
- }
- }
-
- /**
* Update the index to reflect a sequence of modifications in a Modify
* operation.
*
@@ -704,18 +624,6 @@
}
/**
- * Close cursors related to the attribute indexes.
- *
- * @throws DatabaseException If a database error occurs.
- */
- public void closeCursors() throws DatabaseException {
- for (Index index : nameToIndexes.values())
- {
- index.closeCursor();
- }
- }
-
- /**
* Return the number of values that have exceeded the entry limit since this
* object was created.
*
@@ -1025,22 +933,6 @@
}
/**
- * Set the index truststate.
- * @param txn A database transaction, or null if none is required.
- * @param trusted True if this index should be trusted or false
- * otherwise.
- * @throws DatabaseException If an error occurs in the JE database.
- */
- public synchronized void setTrusted(Transaction txn, boolean trusted)
- throws DatabaseException
- {
- for (Index index : nameToIndexes.values())
- {
- index.setTrusted(txn, trusted);
- }
- }
-
- /**
* Return true iff this index is trusted.
* @return the trusted state of this index
*/
--
Gitblit v1.10.0