org.apache.directory.server.xdbm
Interface Index<K,O>

All Known Implementing Classes:
JdbmIndex

public interface Index<K,O>

An index into the master table which returns one or more entry's positions in the master table for those entries which posses an attribute with the specified value. Cursors over indices can also be gotten to traverse the values of the index.

Version:
$Rev: 656489 $
Author:
Apache Directory Project

Field Summary
static int DEFAULT_INDEX_CACHE_SIZE
           
 
Method Summary
 void add(K attrVal, java.lang.Long id)
           
 void close()
           
 int count()
          Gets the total scan count for this index.
 int count(K attrVal)
          Gets the scan count for the occurance of a specific attribute value within the index.
 void drop(K attrVal, java.lang.Long id)
           
 void drop(java.lang.Long id)
           
 boolean forward(K attrVal)
           
 boolean forward(K attrVal, java.lang.Long id)
           
 IndexCursor<K,O> forwardCursor()
           
 IndexCursor<K,O> forwardCursor(K key)
           
 boolean forwardGreaterOrEq(K attrVal)
           
 boolean forwardGreaterOrEq(K attrVal, java.lang.Long id)
           
 boolean forwardLessOrEq(K attrVal)
           
 boolean forwardLessOrEq(K attrVal, java.lang.Long id)
           
 java.lang.Long forwardLookup(K attrVal)
           
 Cursor<java.lang.Long> forwardValueCursor(K key)
           
 org.apache.directory.shared.ldap.schema.AttributeType getAttribute()
          Gets the attribute this Index is built upon.
 java.lang.String getAttributeId()
          Gets the attribute identifier set at configuration time for this index which may not be the OID but an alias name for the attributeType associated with this Index
 int getCacheSize()
          Gets the size of the index cache in terms of the number of index entries to be cached.
 K getNormalized(K attrVal)
          Gets the normalized value for an attribute.
 java.io.File getWkDirPath()
          Gets the working directory path to something other than the default.
 int greaterThanCount(K attrVal)
           
 boolean isCountExact()
          Checks whether or not calls to count the number of keys greater than or less than the key are exact.
 int lessThanCount(K attrVal)
           
 boolean reverse(java.lang.Long id)
           
 boolean reverse(java.lang.Long id, K attrVal)
           
 IndexCursor<K,O> reverseCursor()
           
 IndexCursor<K,O> reverseCursor(java.lang.Long id)
           
 boolean reverseGreaterOrEq(java.lang.Long id)
           
 boolean reverseGreaterOrEq(java.lang.Long id, K attrVal)
           
 boolean reverseLessOrEq(java.lang.Long id)
           
 boolean reverseLessOrEq(java.lang.Long id, K attrVal)
           
 K reverseLookup(java.lang.Long id)
           
 Cursor<K> reverseValueCursor(java.lang.Long id)
           
 void setAttributeId(java.lang.String attributeId)
          Sets the attribute identifier set at configuration time for this index which may not be the OID but an alias name for the attributeType associated with this Index
 void setCacheSize(int cacheSize)
          Sets the size of the index cache in terms of the number of index entries to be cached.
 void setWkDirPath(java.io.File wkDirPath)
          Sets the working directory path to something other than the default.
 void sync()
           
 

Field Detail

DEFAULT_INDEX_CACHE_SIZE

static final int DEFAULT_INDEX_CACHE_SIZE
See Also:
Constant Field Values
Method Detail

getAttributeId

java.lang.String getAttributeId()
Gets the attribute identifier set at configuration time for this index which may not be the OID but an alias name for the attributeType associated with this Index

Returns:
configured attribute oid or alias name

setAttributeId

void setAttributeId(java.lang.String attributeId)
Sets the attribute identifier set at configuration time for this index which may not be the OID but an alias name for the attributeType associated with this Index

Parameters:
attributeId - configured attribute oid or alias name

getCacheSize

int getCacheSize()
Gets the size of the index cache in terms of the number of index entries to be cached.

Returns:
the size of the index cache

setCacheSize

void setCacheSize(int cacheSize)
Sets the size of the index cache in terms of the number of index entries to be cached.

Parameters:
cacheSize - the size of the index cache

setWkDirPath

void setWkDirPath(java.io.File wkDirPath)
Sets the working directory path to something other than the default. Sometimes more performance is gained by locating indices on separate disk spindles.

Parameters:
wkDirPath - optional working directory path

getWkDirPath

java.io.File getWkDirPath()
Gets the working directory path to something other than the default. Sometimes more performance is gained by locating indices on separate disk spindles.

Returns:
optional working directory path

isCountExact

boolean isCountExact()
Checks whether or not calls to count the number of keys greater than or less than the key are exact. Checking to see the number of values greater than or less than some key may be excessively costly. Since this is not a critical function but one that assists in optimizing searches some implementations can just return a worst case (maximum) guess.

Returns:
true if the count is an exact value or a worst case guess

getAttribute

org.apache.directory.shared.ldap.schema.AttributeType getAttribute()
Gets the attribute this Index is built upon.

Returns:
the id of the Index's attribute

getNormalized

K getNormalized(K attrVal)
                throws java.lang.Exception
Gets the normalized value for an attribute.

Parameters:
attrVal - the user provided value to normalize
Returns:
the normalized value.
Throws:
java.lang.Exception - if something goes wrong.

count

int count()
          throws java.lang.Exception
Gets the total scan count for this index.

Returns:
the number of key/value pairs in this index
Throws:
java.lang.Exception - on failure to access index db files

count

int count(K attrVal)
          throws java.lang.Exception
Gets the scan count for the occurance of a specific attribute value within the index.

Parameters:
attrVal - the value of the attribute to get a scan count for
Returns:
the number of key/value pairs in this index with the value value
Throws:
java.lang.Exception - on failure to access index db files

greaterThanCount

int greaterThanCount(K attrVal)
                     throws java.lang.Exception
Throws:
java.lang.Exception

lessThanCount

int lessThanCount(K attrVal)
                  throws java.lang.Exception
Throws:
java.lang.Exception

forwardLookup

java.lang.Long forwardLookup(K attrVal)
                             throws java.lang.Exception
Throws:
java.lang.Exception

reverseLookup

K reverseLookup(java.lang.Long id)
                throws java.lang.Exception
Throws:
java.lang.Exception

add

void add(K attrVal,
         java.lang.Long id)
         throws java.lang.Exception
Throws:
java.lang.Exception

drop

void drop(java.lang.Long id)
          throws java.lang.Exception
Throws:
java.lang.Exception

drop

void drop(K attrVal,
          java.lang.Long id)
          throws java.lang.Exception
Throws:
java.lang.Exception

reverseCursor

IndexCursor<K,O> reverseCursor()
                               throws java.lang.Exception
Throws:
java.lang.Exception

forwardCursor

IndexCursor<K,O> forwardCursor()
                               throws java.lang.Exception
Throws:
java.lang.Exception

reverseCursor

IndexCursor<K,O> reverseCursor(java.lang.Long id)
                               throws java.lang.Exception
Throws:
java.lang.Exception

forwardCursor

IndexCursor<K,O> forwardCursor(K key)
                               throws java.lang.Exception
Throws:
java.lang.Exception

reverseValueCursor

Cursor<K> reverseValueCursor(java.lang.Long id)
                             throws java.lang.Exception
Throws:
java.lang.Exception

forwardValueCursor

Cursor<java.lang.Long> forwardValueCursor(K key)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

forward

boolean forward(K attrVal)
                throws java.lang.Exception
Throws:
java.lang.Exception

forward

boolean forward(K attrVal,
                java.lang.Long id)
                throws java.lang.Exception
Throws:
java.lang.Exception

reverse

boolean reverse(java.lang.Long id)
                throws java.lang.Exception
Throws:
java.lang.Exception

reverse

boolean reverse(java.lang.Long id,
                K attrVal)
                throws java.lang.Exception
Throws:
java.lang.Exception

forwardGreaterOrEq

boolean forwardGreaterOrEq(K attrVal)
                           throws java.lang.Exception
Throws:
java.lang.Exception

forwardGreaterOrEq

boolean forwardGreaterOrEq(K attrVal,
                           java.lang.Long id)
                           throws java.lang.Exception
Throws:
java.lang.Exception

reverseGreaterOrEq

boolean reverseGreaterOrEq(java.lang.Long id)
                           throws java.lang.Exception
Throws:
java.lang.Exception

reverseGreaterOrEq

boolean reverseGreaterOrEq(java.lang.Long id,
                           K attrVal)
                           throws java.lang.Exception
Throws:
java.lang.Exception

forwardLessOrEq

boolean forwardLessOrEq(K attrVal)
                        throws java.lang.Exception
Throws:
java.lang.Exception

forwardLessOrEq

boolean forwardLessOrEq(K attrVal,
                        java.lang.Long id)
                        throws java.lang.Exception
Throws:
java.lang.Exception

reverseLessOrEq

boolean reverseLessOrEq(java.lang.Long id)
                        throws java.lang.Exception
Throws:
java.lang.Exception

reverseLessOrEq

boolean reverseLessOrEq(java.lang.Long id,
                        K attrVal)
                        throws java.lang.Exception
Throws:
java.lang.Exception

close

void close()
           throws java.lang.Exception
Throws:
java.lang.Exception

sync

void sync()
          throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.