org.opends.server.backends.jeb
Class IndexBuffer

java.lang.Object
  extended by org.opends.server.backends.jeb.IndexBuffer

public class IndexBuffer
extends java.lang.Object

A buffered index is used to buffer multiple reads or writes to the same index key into a single read or write. It can only be used to buffer multiple reads and writes under the same transaction. The transaction may be null if it is known that there are no other concurrent updates to the index.


Nested Class Summary
static class IndexBuffer.BufferedIndexValues
          A simple class representing a pair of added and deleted indexed IDs.
static class IndexBuffer.BufferedVLVValues
          A simple class representing a pair of added and deleted VLV values.
 
Constructor Summary
IndexBuffer(EntryContainer entryContainer)
          Construct a new empty index buffer object.
 
Method Summary
 void flush(com.sleepycat.je.Transaction txn)
          Flush the buffered index changes until the given transaction to the database.
 java.util.TreeMap<byte[],IndexBuffer.BufferedIndexValues> getBufferedIndex(Index index)
          Get the buffered values for the given index.
 IndexBuffer.BufferedVLVValues getVLVIndex(VLVIndex vlvIndex)
          Get the buffered VLV values for the given VLV index.
 void putBufferedIndex(Index index, java.util.TreeMap<byte[],IndexBuffer.BufferedIndexValues> bufferedValues)
          Put the specified buffered index values for the given index.
 void putBufferedVLVIndex(VLVIndex vlvIndex, IndexBuffer.BufferedVLVValues bufferedVLVValues)
          Put the specified buffered VLV values for the given VLV index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexBuffer

public IndexBuffer(EntryContainer entryContainer)
Construct a new empty index buffer object.

Parameters:
entryContainer - The database entryContainer using this index buffer.
Method Detail

getBufferedIndex

public java.util.TreeMap<byte[],IndexBuffer.BufferedIndexValues> getBufferedIndex(Index index)
Get the buffered values for the given index.

Parameters:
index - The index with the buffered values to retrieve.
Returns:
The buffered values or null if there are no buffered values for the specified index.

putBufferedIndex

public void putBufferedIndex(Index index,
                             java.util.TreeMap<byte[],IndexBuffer.BufferedIndexValues> bufferedValues)
Put the specified buffered index values for the given index.

Parameters:
index - The index affected by the buffered values.
bufferedValues - The buffered values for the index.

getVLVIndex

public IndexBuffer.BufferedVLVValues getVLVIndex(VLVIndex vlvIndex)
Get the buffered VLV values for the given VLV index.

Parameters:
vlvIndex - The VLV index with the buffered values to retrieve.
Returns:
The buffered VLV values or null if there are no buffered VLV values for the specified VLV index.

putBufferedVLVIndex

public void putBufferedVLVIndex(VLVIndex vlvIndex,
                                IndexBuffer.BufferedVLVValues bufferedVLVValues)
Put the specified buffered VLV values for the given VLV index.

Parameters:
vlvIndex - The VLV index affected by the buffered values.
bufferedVLVValues - The buffered values for the VLV index.

flush

public void flush(com.sleepycat.je.Transaction txn)
           throws com.sleepycat.je.DatabaseException,
                  DirectoryException,
                  JebException
Flush the buffered index changes until the given transaction to the database.

Parameters:
txn - The database transaction to be used for the updates.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE database.
DirectoryException - If a Directory Server error occurs.
JebException - If an error occurs in the JE backend.