Class OSBTreeRidBag
java.lang.Object
com.orientechnologies.orient.core.storage.ridbag.sbtree.OSBTreeRidBag
- All Implemented Interfaces:
OSizeable,OAutoConvertToRecord,ODetachable,ORecordElement,ORecordLazyMultiValue,OTrackedMultiValue<OIdentifiable,,OIdentifiable> ORidBagDelegate,Iterable<OIdentifiable>
Persistent Set implementation that uses the SBTree to handle entries in persistent
way.
- Author:
- Artem Orobets (enisher-at-gmail.com)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.db.record.ORecordElement
ORecordElement.STATUS -
Constructor Summary
ConstructorsConstructorDescriptionOSBTreeRidBag(OBonsaiCollectionPointer pointer, Map<OIdentifiable, Change> changes) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(OIdentifiable identifiable) voidaddAll(Collection<OIdentifiable> values) booleanvoidvoidvoidbooleancontains(OIdentifiable identifiable) THIS IS VERY EXPENSIVE METHOD AND CAN NOT BE CALLED IN REMOTE STORAGE.voidBrowse all the set to convert all the items into records.booleanBrowse all the set to convert all the items into links.voiddebugPrint(PrintStream writer) intdeserialize(byte[] stream, int offset) booleandetach()Detaches the object.voiddisableTracking(ORecordElement document) voidenableTracking(ORecordElement parent) Class<?> getOwner()intintgetSerializedSize(byte[] stream, int offset) voidhandleContextSBTree(ORecordSerializationContext context, OBonsaiCollectionPointer pointer) booleanbooleanisEmpty()booleanbooleaniterator()voidmergeChanges(OSBTreeRidBag treeRidBag) voidremove(OIdentifiable identifiable) voidreplace(OMultiValueChangeEvent<Object, Object> event, Object newValue) voidreturnOriginalState(List<OMultiValueChangeEvent<OIdentifiable, OIdentifiable>> multiValueChangeEvents) Reverts all operations that were performed on collection and return original collection state.intserialize(byte[] stream, int offset, UUID ownerUuid, OSerializationContext ctx) Writes content of bag to stream.voidsetAutoConvertToRecord(boolean convertToRecord) voidsetCollectionPointer(OBonsaiCollectionPointer collectionPointer) <RET> RETsetDirty()Marks the instance as dirty.voidvoidsetOwner(ORecordElement owner) voidsetSize(int size) voidvoidsetTransactionModified(boolean transactionDirty) intsize()toString()voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
OSBTreeRidBag
-
OSBTreeRidBag
public OSBTreeRidBag()
-
-
Method Details
-
setSize
public void setSize(int size) - Specified by:
setSizein interfaceORidBagDelegate
-
getOwner
- Specified by:
getOwnerin interfaceORecordElement- Specified by:
getOwnerin interfaceORidBagDelegate- Returns:
- Returns record element which contains given one.
-
setOwner
- Specified by:
setOwnerin interfaceORidBagDelegate
-
iterator
- Specified by:
iteratorin interfaceIterable<OIdentifiable>
-
rawIterator
- Specified by:
rawIteratorin interfaceORecordLazyMultiValue
-
convertLinks2Records
public void convertLinks2Records()Description copied from interface:ORecordLazyMultiValueBrowse all the set to convert all the items into records.It converts only items that already loaded into memory from storage. To convert records that will be fetched from disk later use
OAutoConvertToRecord.setAutoConvertToRecord(boolean)- Specified by:
convertLinks2Recordsin interfaceORecordLazyMultiValue
-
convertRecords2Links
public boolean convertRecords2Links()Description copied from interface:ORecordLazyMultiValueBrowse all the set to convert all the items into links.- Specified by:
convertRecords2Linksin interfaceORecordLazyMultiValue- Returns:
-
mergeChanges
-
isAutoConvertToRecord
public boolean isAutoConvertToRecord()- Specified by:
isAutoConvertToRecordin interfaceOAutoConvertToRecord
-
setAutoConvertToRecord
public void setAutoConvertToRecord(boolean convertToRecord) - Specified by:
setAutoConvertToRecordin interfaceOAutoConvertToRecord
-
detach
public boolean detach()Description copied from interface:ODetachableDetaches the object.- Specified by:
detachin interfaceODetachable- Returns:
- true if the object has been fully detached, otherwise false
-
addAll
- Specified by:
addAllin interfaceORidBagDelegate
-
addInternal
- Specified by:
addInternalin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
add
- Specified by:
addin interfaceORidBagDelegate
-
remove
- Specified by:
removein interfaceORidBagDelegate
-
contains
Description copied from interface:ORidBagDelegateTHIS IS VERY EXPENSIVE METHOD AND CAN NOT BE CALLED IN REMOTE STORAGE.- Specified by:
containsin interfaceORidBagDelegate- Parameters:
identifiable- Object to check.- Returns:
- true if ridbag contains at leas one instance with the same rid as passed in identifiable.
-
size
public int size() -
toString
- Specified by:
toStringin interfaceORidBagDelegate- Overrides:
toStringin classObject
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceORidBagDelegate
-
getGenericClass
- Specified by:
getGenericClassin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
returnOriginalState
public Object returnOriginalState(List<OMultiValueChangeEvent<OIdentifiable, OIdentifiable>> multiValueChangeEvents) Description copied from interface:OTrackedMultiValueReverts all operations that were performed on collection and return original collection state.- Specified by:
returnOriginalStatein interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable> - Parameters:
multiValueChangeEvents- List of operations that were performed on collection.- Returns:
- Original collection state.
-
getSerializedSize
public int getSerializedSize()- Specified by:
getSerializedSizein interfaceORidBagDelegate
-
getSerializedSize
public int getSerializedSize(byte[] stream, int offset) - Specified by:
getSerializedSizein interfaceORidBagDelegate
-
handleContextSBTree
public void handleContextSBTree(ORecordSerializationContext context, OBonsaiCollectionPointer pointer) -
serialize
Description copied from interface:ORidBagDelegateWrites content of bag to stream.OwnerUuid is needed to notify db about changes of collection pointer if some happens during serialization.
- Specified by:
serializein interfaceORidBagDelegate- Parameters:
stream- to write contentoffset- in stream where start to write contentownerUuid- id of delegate ownerctx-- Returns:
- offset where content of stream is ended
-
applyNewEntries
public void applyNewEntries() -
clearChanges
public void clearChanges() -
requestDelete
public void requestDelete()- Specified by:
requestDeletein interfaceORidBagDelegate
-
confirmDelete
public void confirmDelete() -
deserialize
public int deserialize(byte[] stream, int offset) - Specified by:
deserializein interfaceORidBagDelegate
-
getCollectionPointer
-
setCollectionPointer
-
debugPrint
- Throws:
IOException
-
getChanges
- Specified by:
getChangesin interfaceORidBagDelegate
-
replace
- Specified by:
replacein interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
enableTracking
- Specified by:
enableTrackingin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
disableTracking
- Specified by:
disableTrackingin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
transactionClear
public void transactionClear()- Specified by:
transactionClearin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
isModified
public boolean isModified()- Specified by:
isModifiedin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
isTransactionModified
public boolean isTransactionModified()- Specified by:
isTransactionModifiedin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
getTimeLine
- Specified by:
getTimeLinein interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
setDirty
public <RET> RET setDirty()Description copied from interface:ORecordElementMarks the instance as dirty. The dirty status could be propagated up if the implementation supports ownership concept.- Specified by:
setDirtyin interfaceORecordElement- Returns:
- The object it self. Useful to call methods in chain.
-
setTransactionModified
public void setTransactionModified(boolean transactionDirty) - Specified by:
setTransactionModifiedin interfaceORidBagDelegate
-
setDirtyNoChanged
public void setDirtyNoChanged()- Specified by:
setDirtyNoChangedin interfaceORecordElement
-
getTracker
- Specified by:
getTrackerin interfaceORidBagDelegate
-
setTracker
- Specified by:
setTrackerin interfaceORidBagDelegate
-
getTransactionTimeLine
- Specified by:
getTransactionTimeLinein interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-