public class AvlIndex<K> extends AbstractIndex<K,String>
Modifier and Type | Field and Description |
---|---|
protected AvlTable<K,String> |
forward |
protected org.apache.directory.api.ldap.model.schema.Normalizer |
normalizer |
protected AvlTable<String,K> |
reverse |
attributeId, attributeType, cacheSize, commitNumber, initialized, withReverse
DEFAULT_INDEX_CACHE_SIZE
Constructor and Description |
---|
AvlIndex() |
AvlIndex(String attributeId) |
AvlIndex(String attributeId,
boolean withReverse) |
Modifier and Type | Method and Description |
---|---|
void |
add(K attrVal,
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,
String id)
Remove the pair
|
void |
drop(String id)
Remove all the reference to an entry from the index.
|
boolean |
forward(K attrVal) |
boolean |
forward(K attrVal,
String id) |
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> |
forwardCursor() |
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> |
forwardCursor(K key) |
String |
forwardLookup(K attrVal) |
org.apache.directory.api.ldap.model.cursor.Cursor<String> |
forwardValueCursor(K key) |
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(String id) |
boolean |
reverse(String id,
K attrVal) |
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> |
reverseCursor() |
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> |
reverseCursor(String id) |
K |
reverseLookup(String id) |
org.apache.directory.api.ldap.model.cursor.Cursor<K> |
reverseValueCursor(String id) |
void |
setWkDirPath(URI wkDirPath)
throws UnsupportedOperationException cause it is a in-memory index
|
void |
sync() |
getAttribute, getAttributeId, getCacheSize, hasReverse, protect, setAttributeId, setCacheSize
public AvlIndex()
public AvlIndex(String attributeId)
public AvlIndex(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 Exception
Exception
public void add(K attrVal, String id) throws Exception
Index
attrVal
- The added valueid
- The element ID pointed by the added valueException
- If the addition can't be donepublic long count() throws Exception
Exception
- on failure to access index db filespublic long count(K attrVal) throws Exception
attrVal
- the value of the attribute to get a scan count forException
- on failure to access index db filespublic void drop(String id) throws 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 removeException
public void drop(K attrVal, String id) throws Exception
attrVal
- The value we want to remove from the indexid
- The associated IDException
- If the removal can't be donepublic boolean forward(K attrVal, String id) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
public org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> forwardCursor() throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
public org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> forwardCursor(K key) throws Exception
Exception
public org.apache.directory.api.ldap.model.cursor.Cursor<String> forwardValueCursor(K key) throws Exception
Exception
public org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> reverseCursor() throws Exception
Exception
public org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> reverseCursor(String id) throws Exception
Exception
public K reverseLookup(String id) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
public org.apache.directory.api.ldap.model.cursor.Cursor<K> reverseValueCursor(String id) throws Exception
Exception
public void setWkDirPath(URI wkDirPath)
wkDirPath
- optional working directory pathpublic URI getWkDirPath()
public boolean isDupsEnabled()
isDupsEnabled
in interface Index<K,String>
isDupsEnabled
in class AbstractIndex<K,String>
Copyright © 2017. All rights reserved.