public class BTreeIndex extends Object implements Index
NO_SEARCH_LIMIT
Constructor and Description |
---|
BTreeIndex(File indexLocation,
KeyInfo keyInfo) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the index and all its used resources
|
void |
configure(Configuration configuration)
Configure the index with configuration settings found in global configuration
|
long |
count()
Returns the amount of keys in the index
|
void |
flushIndex()
This persists the changes to the disk backing of the index
|
IndexIterator |
getIndexIterator()
This gets an iterator which allows iterating over the full index collection
|
int |
getIndexType() |
KeyInfo |
getKeyInfo()
This returns all global key information being stored in this index
|
protected LockManager |
getLockManager() |
MemoryAware |
getMemoryManager()
This is the memory manager of the index, this is used to determine vital memory parameters.
|
String |
getName() |
int |
getPageSize() |
protected BlockPersister |
getPersister() |
protected RootBlock |
getRootBlock() |
IndexState |
getState()
Returns the state of the index
|
boolean |
hasUniqueConstraint() |
void |
insertIntoIndex(Key key)
Inserts the given key into the index, the key is to expected to conform to the index key specification as determined
in the keyinfo.
|
int |
match(Set<String> fields)
Determines how close the gives fields match the index descriptor.
|
void |
openIndex()
Opens the index and its resources
|
void |
rebuildIndex(Iterator<IndexableItem> indexableItems)
Do a full rebuild of the index and fully populate it based on provided item iterator
|
void |
removeFromIndex(Key key)
Remove the given key and its values from the index.
|
void |
removeIndex()
Removes the index and all used resources
|
void |
resetIndex() |
IndexScanReport |
scan(ScanIntent intent,
Iterator<IndexableItem> indexableItems)
This performs a scan of the index and reports on the integrity.
|
IndexSearchResultIteratorCollection |
searchIndex(SearchCondition searchCondition,
SearchLimit searchLimit)
Do a search operation of the index given the searchcondition.
|
String |
toString() |
void |
updateKey(Key oldKey,
Key newKey)
Update the key payload inside the index, the key is to expected to conform to the index key specification as determined
in the keyinfo.
|
public void configure(Configuration configuration) throws ConfigurationException
Index
configure
in interface Index
configuration
- The configuration objectConfigurationException
- If unable to configure the indexpublic boolean hasUniqueConstraint()
hasUniqueConstraint
in interface Index
protected RootBlock getRootBlock() throws JasDBStorageException
JasDBStorageException
protected BlockPersister getPersister() throws JasDBStorageException
JasDBStorageException
protected LockManager getLockManager() throws JasDBStorageException
JasDBStorageException
public KeyInfo getKeyInfo()
Index
getKeyInfo
in interface Index
public long count()
Index
public int getPageSize()
getPageSize
in interface Index
public int getIndexType()
getIndexType
in interface Index
public int match(Set<String> fields)
Index
public IndexSearchResultIteratorCollection searchIndex(SearchCondition searchCondition, SearchLimit searchLimit) throws JasDBStorageException
Index
searchIndex
in interface Index
searchCondition
- The searchcondition to apply to only this indexsearchLimit
- The searchlimit to apply whilst searchingJasDBStorageException
- If unable to complete the search in the indexpublic IndexIterator getIndexIterator() throws JasDBStorageException
Index
getIndexIterator
in interface Index
JasDBStorageException
- If unable to open the index iteratorpublic void insertIntoIndex(Key key) throws JasDBStorageException
Index
insertIntoIndex
in interface Index
key
- The key to be persisted to the indexJasDBStorageException
- If unable to persist the key in the indexpublic void removeFromIndex(Key key) throws JasDBStorageException
Index
removeFromIndex
in interface Index
key
- The key to be removed from the indexJasDBStorageException
- If unable to remove the key from the indexpublic void updateKey(Key oldKey, Key newKey) throws JasDBStorageException
Index
updateKey
in interface Index
oldKey
- The previous key present in the indexnewKey
- The new key value to be used insteadJasDBStorageException
- If unable to update the key in the indexpublic void openIndex() throws JasDBStorageException
Index
openIndex
in interface Index
JasDBStorageException
public void close() throws JasDBStorageException
Index
close
in interface AutoCloseable
close
in interface Index
JasDBStorageException
- If unable to cleanly close the indexpublic void removeIndex() throws JasDBStorageException
Index
removeIndex
in interface Index
JasDBStorageException
- If unable to delete the indexpublic void flushIndex() throws JasDBStorageException
Index
flushIndex
in interface Index
JasDBStorageException
- If unable to flush the changespublic IndexScanReport scan(ScanIntent intent, Iterator<IndexableItem> indexableItems) throws JasDBStorageException
Index
scan
in interface Index
intent
- The scanning intent, rescan or reportindexableItems
- The list of items to scan for in the indexJasDBStorageException
- If unable to perform or complete index scanpublic void rebuildIndex(Iterator<IndexableItem> indexableItems) throws JasDBStorageException
Index
rebuildIndex
in interface Index
indexableItems
- The items to be indexedJasDBStorageException
- If unable to rebuild the indexpublic void resetIndex() throws JasDBStorageException
JasDBStorageException
public MemoryAware getMemoryManager() throws JasDBStorageException
Index
getMemoryManager
in interface Index
JasDBStorageException
public IndexState getState()
Index
Copyright © 2015. All rights reserved.