Class OSBTreeBonsaiLocal<K,V>
java.lang.Object
com.orientechnologies.common.concur.resource.OSharedResourceAbstract
com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurableComponent
com.orientechnologies.orient.core.storage.index.sbtreebonsai.local.OSBTreeBonsaiLocal<K,V>
- All Implemented Interfaces:
OTreeInternal<K,,V> OSBTreeBonsai<K,V>
Tree-based dictionary algorithm. Similar to
OSBTreeV1 but uses subpages of disk cache
that is more efficient for small data structures. Oriented for usage of several instances inside
of one file. Creation of several instances that represent the same collection is not allowed.- Since:
- 1.6.0
- Author:
- Andrey Lomakin (a.lomakin-at-orientdb.com), Artem Orobets
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.storage.index.sbtree.OTreeInternal
OTreeInternal.AccumulativeListener<K,V>, OTreeInternal.RangeResultListener<K, V> -
Field Summary
Fields inherited from class com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurableComponent
atomicOperationsManager, readCache, storage, writeCacheFields inherited from class com.orientechnologies.common.concur.resource.OSharedResourceAbstract
lock -
Constructor Summary
ConstructorsConstructorDescriptionOSBTreeBonsaiLocal(String name, String dataFileExtension, OAbstractPaginatedStorage storage) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear(OAtomicOperation atomicOperation) Removes all entries from bonsai tree.voidclose()voidclose(boolean flush) voidcreate(OAtomicOperation atomicOperation, OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer) voidcreate(OAtomicOperation atomicOperation, OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer, int pageIndex, int pageOffset) longcreateComponent(OAtomicOperation atomicOperation) voiddebugPrintBucket(PrintStream writer) voiddelete(OAtomicOperation atomicOperation) Deletes a whole tree.voiddeleteComponent(OAtomicOperation atomicOperation) firstKey()voidflush()voidforEachItem(OBonsaiBucketPointer rootBucketPointer, Consumer<ORawPair<K, V>> consumer) Search for entry with specific key and return its value.longGets id of file where this bonsai tree is stored.intgetRealBagSize(Map<K, Change> changes) Hardcoded method for Bag to avoid creation of extra layer.getValuesBetween(K keyFrom, boolean fromInclusive, K keyTo, boolean toInclusive, int maxValuesToFetch) getValuesMajor(K key, boolean inclusive, int maxValuesToFetch) getValuesMinor(K key, boolean inclusive, int maxValuesToFetch) booleanisEmpty()lastKey()final voidload(OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer) booleanload(OBonsaiBucketPointer rootBucketPointer) voidloadEntriesBetween(K keyFrom, boolean fromInclusive, K keyTo, boolean toInclusive, OTreeInternal.RangeResultListener<K, V> listener) voidloadEntriesMajor(K key, boolean inclusive, boolean ascSortOrder, OTreeInternal.RangeResultListener<K, V> listener) Load all entries with key greater then specified key.voidloadEntriesMinor(K key, boolean inclusive, OTreeInternal.RangeResultListener<K, V> listener) voidmarkToDelete(OAtomicOperation atomicOperation) booleanput(OAtomicOperation atomicOperation, K key, V value) remove(OAtomicOperation atomicOperation, K key) longsize()Methods inherited from class com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurableComponent
addFile, addPage, calculateInsideComponentOperation, deleteFile, executeInsideComponentOperation, getExtension, getFilledUpTo, getFullName, getLockName, getName, isFileExists, loadOrAddPageForWrite, loadPageForRead, loadPageForWrite, openFile, releasePageFromRead, releasePageFromWrite, setName, truncateFile, tryExecuteInsideComponentOperationMethods inherited from class com.orientechnologies.common.concur.resource.OSharedResourceAbstract
acquireExclusiveLock, acquireSharedLock, releaseExclusiveLock, releaseSharedLock
-
Constructor Details
-
OSBTreeBonsaiLocal
-
-
Method Details
-
createComponent
-
create
public void create(OAtomicOperation atomicOperation, OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer) throws IOException - Throws:
IOException
-
create
public void create(OAtomicOperation atomicOperation, OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer, int pageIndex, int pageOffset) throws IOException - Throws:
IOException
-
getFileId
public long getFileId()Description copied from interface:OSBTreeBonsaiGets id of file where this bonsai tree is stored.- Specified by:
getFileIdin interfaceOSBTreeBonsai<K,V> - Returns:
- id of file in
OReadCache
-
getRootBucketPointer
- Specified by:
getRootBucketPointerin interfaceOSBTreeBonsai<K,V> - Returns:
- the pointer to the root bucket in tree.
-
getCollectionPointer
- Specified by:
getCollectionPointerin interfaceOSBTreeBonsai<K,V> - Returns:
- pointer to a collection.
-
get
Description copied from interface:OSBTreeBonsaiSearch for entry with specific key and return its value.- Specified by:
getin interfaceOSBTreeBonsai<K,V> - Returns:
- value associated with given key, NULL if no value is associated.
-
put
- Specified by:
putin interfaceOSBTreeBonsai<K,V>
-
loadRoots
- Throws:
IOException
-
forEachItem
public void forEachItem(OBonsaiBucketPointer rootBucketPointer, Consumer<ORawPair<K, V>> consumer) throws IOException- Throws:
IOException
-
close
public void close(boolean flush) -
close
public void close() -
clear
Removes all entries from bonsai tree. Put all but the root page to free list for further reuse.- Specified by:
clearin interfaceOSBTreeBonsai<K,V>
-
delete
Deletes a whole tree. Puts all its pages to free list for further reusage.- Specified by:
deletein interfaceOSBTreeBonsai<K,V>
-
deleteComponent
-
load
-
load
public final void load(OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer) throws IOException - Throws:
IOException
-
size
public long size() -
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceOSBTreeBonsai<K,V> - Specified by:
isEmptyin interfaceOTreeInternal<K,V>
-
remove
- Specified by:
removein interfaceOSBTreeBonsai<K,V> - Specified by:
removein interfaceOTreeInternal<K,V>
-
getValuesMinor
- Specified by:
getValuesMinorin interfaceOSBTreeBonsai<K,V>
-
loadEntriesMinor
public void loadEntriesMinor(K key, boolean inclusive, OTreeInternal.RangeResultListener<K, V> listener) - Specified by:
loadEntriesMinorin interfaceOSBTreeBonsai<K,V>
-
getValuesMajor
- Specified by:
getValuesMajorin interfaceOSBTreeBonsai<K,V>
-
loadEntriesMajor
public void loadEntriesMajor(K key, boolean inclusive, boolean ascSortOrder, OTreeInternal.RangeResultListener<K, V> listener) Load all entries with key greater then specified key.- Specified by:
loadEntriesMajorin interfaceOSBTreeBonsai<K,V> - Specified by:
loadEntriesMajorin interfaceOTreeInternal<K,V> - Parameters:
key- definesinclusive- if true entry with given key is included
-
getValuesBetween
public Collection<V> getValuesBetween(K keyFrom, boolean fromInclusive, K keyTo, boolean toInclusive, int maxValuesToFetch) - Specified by:
getValuesBetweenin interfaceOSBTreeBonsai<K,V>
-
firstKey
- Specified by:
firstKeyin interfaceOSBTreeBonsai<K,V> - Specified by:
firstKeyin interfaceOTreeInternal<K,V>
-
lastKey
- Specified by:
lastKeyin interfaceOSBTreeBonsai<K,V>
-
loadEntriesBetween
public void loadEntriesBetween(K keyFrom, boolean fromInclusive, K keyTo, boolean toInclusive, OTreeInternal.RangeResultListener<K, V> listener) - Specified by:
loadEntriesBetweenin interfaceOSBTreeBonsai<K,V>
-
flush
public void flush() -
getRealBagSize
Description copied from interface:OSBTreeBonsaiHardcoded method for Bag to avoid creation of extra layer.Don't make any changes to tree.
- Specified by:
getRealBagSizein interfaceOSBTreeBonsai<K,V> - Parameters:
changes- Bag changes- Returns:
- real bag size
-
getKeySerializer
- Specified by:
getKeySerializerin interfaceOSBTreeBonsai<K,V>
-
getValueSerializer
- Specified by:
getValueSerializerin interfaceOSBTreeBonsai<K,V>
-
debugPrintBucket
- Throws:
IOException
-
markToDelete
-