public class AvlIndex<K> extends AbstractIndex<K,java.lang.String>
| Modifier and Type | Field and Description |
|---|---|
protected AvlTable<K,java.lang.String> |
forward |
protected org.apache.directory.api.ldap.model.schema.Normalizer |
normalizer |
protected AvlTable<java.lang.String,K> |
reverse |
attributeId, attributeType, cacheSize, commitNumber, initialized, withReverseDEFAULT_INDEX_CACHE_SIZE| Constructor and Description |
|---|
AvlIndex() |
AvlIndex(java.lang.String attributeId) |
AvlIndex(java.lang.String attributeId,
boolean withReverse) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(K attrVal,
java.lang.String id)
Add an entry into the index, associated with the element ID.
|
void |
close() |
long |
count()
Gets the total scan count for this index.
|
long |
count(K attrVal)
Gets the scan count for the occurrence of a specific attribute value
within the index.
|
void |
drop(K attrVal,
java.lang.String id)
Remove the pair
|
void |
drop(java.lang.String id)
Remove all the reference to an entry from the index.
|
boolean |
forward(K attrVal) |
boolean |
forward(K attrVal,
java.lang.String id) |
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,java.lang.String>> |
forwardCursor() |
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,java.lang.String>> |
forwardCursor(K key) |
java.lang.String |
forwardLookup(K attrVal) |
org.apache.directory.api.ldap.model.cursor.Cursor<java.lang.String> |
forwardValueCursor(K key) |
java.net.URI |
getWkDirPath()
this method always returns null for AvlIndex cause this is a in-memory index.
|
long |
greaterThanCount(K attrVal) |
void |
init(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
org.apache.directory.api.ldap.model.schema.AttributeType attributeType) |
boolean |
isDupsEnabled()
tells whether the Index implementation supports storing duplicate keys
|
long |
lessThanCount(K attrVal) |
boolean |
reverse(java.lang.String id) |
boolean |
reverse(java.lang.String id,
K attrVal) |
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,java.lang.String>> |
reverseCursor() |
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,java.lang.String>> |
reverseCursor(java.lang.String id) |
K |
reverseLookup(java.lang.String id) |
org.apache.directory.api.ldap.model.cursor.Cursor<K> |
reverseValueCursor(java.lang.String id) |
void |
setWkDirPath(java.net.URI wkDirPath)
throws UnsupportedOperationException cause it is a in-memory index
|
void |
sync() |
getAttribute, getAttributeId, getCacheSize, hasReverse, protect, setAttributeId, setCacheSizepublic AvlIndex()
public AvlIndex(java.lang.String attributeId)
public AvlIndex(java.lang.String attributeId,
boolean withReverse)
public void init(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
org.apache.directory.api.ldap.model.schema.AttributeType attributeType)
throws java.lang.Exception
java.lang.Exceptionpublic void add(K attrVal, java.lang.String id) throws java.lang.Exception
IndexattrVal - The added valueid - The element ID pointed by the added valuejava.lang.Exception - If the addition can't be donepublic void close()
throws java.lang.Exception
java.lang.Exceptionpublic long count()
throws java.lang.Exception
java.lang.Exception - on failure to access index db filespublic long count(K attrVal) throws java.lang.Exception
attrVal - the value of the attribute to get a scan count forjava.lang.Exception - on failure to access index db filespublic void drop(java.lang.String id)
throws java.lang.Exception
[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.
id - The master table entry ID to removejava.lang.Exceptionpublic void drop(K attrVal, java.lang.String id) throws java.lang.Exception
attrVal - The value we want to remove from the indexid - The associated IDjava.lang.Exception - If the removal can't be donepublic boolean forward(K attrVal) throws java.lang.Exception
java.lang.Exceptionpublic boolean forward(K attrVal, java.lang.String id) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionpublic org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,java.lang.String>> forwardCursor() throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionpublic org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,java.lang.String>> forwardCursor(K key) throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String forwardLookup(K attrVal) throws java.lang.Exception
java.lang.Exceptionpublic org.apache.directory.api.ldap.model.cursor.Cursor<java.lang.String> forwardValueCursor(K key) throws java.lang.Exception
java.lang.Exceptionpublic long greaterThanCount(K attrVal) throws java.lang.Exception
java.lang.Exceptionpublic long lessThanCount(K attrVal) throws java.lang.Exception
java.lang.Exceptionpublic boolean reverse(java.lang.String id)
throws java.lang.Exception
java.lang.Exceptionpublic boolean reverse(java.lang.String id,
K attrVal)
throws java.lang.Exception
java.lang.Exceptionpublic org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,java.lang.String>> reverseCursor() throws java.lang.Exception
java.lang.Exceptionpublic org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,java.lang.String>> reverseCursor(java.lang.String id) throws java.lang.Exception
java.lang.Exceptionpublic K reverseLookup(java.lang.String id) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionpublic org.apache.directory.api.ldap.model.cursor.Cursor<K> reverseValueCursor(java.lang.String id) throws java.lang.Exception
java.lang.Exceptionpublic void setWkDirPath(java.net.URI wkDirPath)
wkDirPath - optional working directory pathpublic java.net.URI getWkDirPath()
public boolean isDupsEnabled()
isDupsEnabled in interface Index<K,java.lang.String>isDupsEnabled in class AbstractIndex<K,java.lang.String>public void sync()
throws java.lang.Exception
java.lang.Exception