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(PartitionTxn partitionTxn,
K attrVal,
String id)
Add an entry into the index, associated with the element E.
|
void |
close(PartitionTxn partitionTxn)
Close and index
|
long |
count(PartitionTxn partitionTxn)
Gets the total scan count for this index.
|
long |
count(PartitionTxn partitionTxn,
K attrVal)
Gets the scan count for the occurrence of a specific attribute value
within the index.
|
void |
drop(PartitionTxn partitionTxn,
K attrVal,
String id)
Remove the pair <K,ID> from the index for the given value and id.
|
void |
drop(PartitionTxn partitionTxn,
String id)
Remove all the reference to an entry from the index.
|
boolean |
forward(PartitionTxn partitionTxn,
K attrVal)
Try to move forward in the index
|
boolean |
forward(PartitionTxn partitionTxn,
K attrVal,
String id)
Try to move forward in the index
|
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> |
forwardCursor(PartitionTxn partitionTxn)
Builds a Cursor on the Forward index
|
org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> |
forwardCursor(PartitionTxn partitionTxn,
K key)
Builds a Cursor on the Forward index, starting at a specific key
|
String |
forwardLookup(PartitionTxn partitionTxn,
K attrVal)
Search for a value using the Forward table
|
org.apache.directory.api.ldap.model.cursor.Cursor<String> |
forwardValueCursor(PartitionTxn partitionTxn,
K key)
Builds a Cursor on the Forward index, starting at a specific key
|
URI |
getWkDirPath()
this method always returns null for AvlIndex cause this is a in-memory index.
|
long |
greaterThanCount(PartitionTxn partitionTxn,
K attrVal)
Find the number of element in a tree above a given key
|
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(PartitionTxn partitionTxn,
K attrVal)
Find the number of element in a tree below a given key
|
boolean |
reverse(PartitionTxn partitionTxn,
String id)
Try to move backward in the index
|
boolean |
reverse(PartitionTxn partitionTxn,
String id,
K attrVal)
Try to move backward in the index
|
K |
reverseLookup(PartitionTxn partitionTxn,
String id)
Search for a value using the Reverse table
|
org.apache.directory.api.ldap.model.cursor.Cursor<K> |
reverseValueCursor(PartitionTxn partitionTxn,
String id)
Builds a Cursor on the Reverse index, starting at a specific entry Id
|
void |
setWkDirPath(URI wkDirPath)
throws UnsupportedOperationException cause it is a in-memory index
|
getAttribute, getAttributeId, getCacheSize, hasReverse, protect, setAttributeId, setCacheSize
protected org.apache.directory.api.ldap.model.schema.Normalizer normalizer
public AvlIndex()
public void init(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager, org.apache.directory.api.ldap.model.schema.AttributeType attributeType) throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapException
public void add(PartitionTxn partitionTxn, K attrVal, String id) throws org.apache.directory.api.ldap.model.exception.LdapException
Index
partitionTxn
- The transaction to useattrVal
- The added valueid
- The entry ID pointed by the added valueorg.apache.directory.api.ldap.model.exception.LdapException
- If the addition can't be donepublic void close(PartitionTxn partitionTxn) throws org.apache.directory.api.ldap.model.exception.LdapException, IOException
partitionTxn
- The transaction to useorg.apache.directory.api.ldap.model.exception.LdapException
- If we weren't able to close the indexIOException
- If we had an issue with the index filepublic long count(PartitionTxn partitionTxn) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useorg.apache.directory.api.ldap.model.exception.LdapException
- on failure to access index db filespublic long count(PartitionTxn partitionTxn, K attrVal) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useattrVal
- the value of the attribute to get a scan count fororg.apache.directory.api.ldap.model.exception.LdapException
- on failure to access index db filespublic void drop(PartitionTxn partitionTxn, String id) throws org.apache.directory.api.ldap.model.exception.LdapException
[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.
partitionTxn
- The transaction to useid
- The master table entryId to removeorg.apache.directory.api.ldap.model.exception.LdapException
- if we can't drop the element from the indexpublic void drop(PartitionTxn partitionTxn, K attrVal, String id) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useattrVal
- The value we want to remove from the indexid
- The associated IDorg.apache.directory.api.ldap.model.exception.LdapException
- If the removal can't be donepublic boolean forward(PartitionTxn partitionTxn, K attrVal) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useattrVal
- The key we want to start withorg.apache.directory.api.ldap.model.exception.LdapException
- If we had an issue moving forwardpublic boolean forward(PartitionTxn partitionTxn, K attrVal, String id) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useattrVal
- The key we want to start withid
- The entry ID to start fromorg.apache.directory.api.ldap.model.exception.LdapException
- If we had an issue moving forwardpublic org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> forwardCursor(PartitionTxn partitionTxn) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useorg.apache.directory.api.ldap.model.exception.LdapException
- If the cursor can't be createdpublic org.apache.directory.api.ldap.model.cursor.Cursor<IndexEntry<K,String>> forwardCursor(PartitionTxn partitionTxn, K key) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to usekey
- The key to start fromorg.apache.directory.api.ldap.model.exception.LdapException
- If the cursor can't be createdpublic String forwardLookup(PartitionTxn partitionTxn, K attrVal) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useattrVal
- The key to retrieveorg.apache.directory.api.ldap.model.exception.LdapException
- If the operation failedpublic org.apache.directory.api.ldap.model.cursor.Cursor<String> forwardValueCursor(PartitionTxn partitionTxn, K key) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to usekey
- The key to start fromorg.apache.directory.api.ldap.model.exception.LdapException
- If the cursor can't be createdpublic long greaterThanCount(PartitionTxn partitionTxn, K attrVal) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useattrVal
- The keyorg.apache.directory.api.ldap.model.exception.LdapException
- If the operation failedpublic long lessThanCount(PartitionTxn partitionTxn, K attrVal) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useattrVal
- The keyorg.apache.directory.api.ldap.model.exception.LdapException
- If the operation failedpublic boolean reverse(PartitionTxn partitionTxn, String id) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useid
- The entry we want to start withorg.apache.directory.api.ldap.model.exception.LdapException
- If we had an issue moving backwardpublic boolean reverse(PartitionTxn partitionTxn, String id, K attrVal) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useid
- The entry ID to start fromattrVal
- The key we want to start withorg.apache.directory.api.ldap.model.exception.LdapException
- If we had an issue moving backwardpublic K reverseLookup(PartitionTxn partitionTxn, String id) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useid
- The key to retrieveorg.apache.directory.api.ldap.model.exception.LdapException
- If the operation failedpublic org.apache.directory.api.ldap.model.cursor.Cursor<K> reverseValueCursor(PartitionTxn partitionTxn, String id) throws org.apache.directory.api.ldap.model.exception.LdapException
partitionTxn
- The transaction to useid
- The entry ID to start fromorg.apache.directory.api.ldap.model.exception.LdapException
- If the cursor can't be createdpublic 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 © 2003–2020 The Apache Software Foundation. All rights reserved.