Package com.illumon.iris.db.v2.utils.rsp
Class RspBitmap
- All Implemented Interfaces:
TreeIndexImpl
- Direct Known Subclasses:
DisposableRspBitmap
See header comment on RspArray for explanation on space partitioning.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.illumon.iris.db.v2.utils.rsp.RspArray
RspArray.ArraysBuf, RspArray.SpanCursor, RspArray.SpanCursorForward, RspArray.SpanView
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.utils.TreeIndexImpl
TreeIndexImpl.SequentialBuilder
-
Field Summary
Fields inherited from class com.illumon.iris.db.v2.utils.rsp.RspArray
BITS_PER_BLOCK, BLOCK_LAST, BLOCK_SIZE, debug, FULL_BLOCK_SPAN_MARKER, spanInfos, spans, workDataPerThread
Fields inherited from interface com.illumon.iris.db.v2.utils.TreeIndexImpl
EMPTY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(long val) addRange
(long start, long end) addRangeExclusiveEnd
(long start, long end) void
addRangeUnsafe
(long start, long end) int
addRangeUnsafeNoWriteCheck
(int fromIdx, long start, long end) void
addRangeUnsafeNoWriteCheck
(long first, long last) addUnsafe
(long val) void
addUnsafeNoWriteCheck
(long val) addValuesUnsafe
(LongChunk<Attributes.OrderedKeyIndices> values, int offset, int length) void
addValuesUnsafeNoWriteCheck
(LongChunk<Attributes.OrderedKeyIndices> values, int offset, int length) static RspBitmap
Return the logical and of two bitmaps as a new bitmap.Removes every element from this bitmap that is not in the other bitmap.andEqualsUnsafe
(RspBitmap other) static RspBitmap
Return the logical result of r1 and not r2 as a new bitmap.andNotEquals
(RspBitmap other) andNotEqualsUnsafe
(RspBitmap other) Remove every element in other from this bitmap.static RspBitmap
andNotImpl
(RspBitmap r1, RspBitmap r2) Return the logical result of r1 and not r2 as a new RspArray.append
(long v) void
appendContainerUnsafeNoWriteCheck
(long k, Container c) void
appendFullBlockSpanUnsafeNoWriteCheck
(long k, long slen) appendRange
(long start, long end) appendRangeUnsafe
(long start, long end) void
appendRangeUnsafeNoWriteCheck
(long start, long end) void
appendRangeUnsafeNoWriteCheck
(long sHigh, long start, long end) void
appendShiftedUnsafeNoWriteCheck
(long shiftAmount, RspArray other, boolean acquire) appendUnsafe
(long v) void
appendUnsafeNoWriteCheck
(long v) applyOffset
(long offset) Apply an offset to every value in this bitmap, mutating it.applyOffsetImpl
(long offset, Supplier<RspBitmap> onZeroOffset, Supplier<RspBitmap> onAlignedOffset) applyOffsetNoWriteCheck
(long offset) applyOffsetOnNew
(long offset) Apply an offset to every value in this bitmap, returning a new bitmap (original is not changed).static Container
containerForLowValueAndRange
(int val, int start, int end) boolean
contains
(long val) deepCopy()
Get a deep copy of the current object, not shared with anybody.boolean
void
void
long
first()
int
hashCode()
void
void
void
void
invert
(LongRangeConsumer builder, ReadOnlyIndex.RangeIterator it, long maxPos) ixAppendRange
(long startKey, long endKey) long
boolean
ixContainsRange
(long start, long end) ixCowRef()
long
ixFind
(long key) long
boolean
boolean
long
ixGet
(long pos) long
void
ixGetKeysForPositions
(PrimitiveIterator.OfLong inputPositions, LongConsumer outputKeys) ixGetOrderedKeysByKeyRange
(long startKeyInclusive, long endKeyInclusive) ixGetOrderedKeysByPosition
(long startPositionInclusive, long length) ixInsert
(long key) ixInsert
(TreeIndexImpl other) ixInsertRange
(long startKey, long endKey) final TreeIndexImpl
ixInsertSecondHalf
(LongChunk<Attributes.OrderedKeyIndices> values, int offset, int length) ixInsertWithShift
(long shiftAmount, SortedRanges sr) ixInsertWithShift
(long shiftAmount, TreeIndexImpl other) ixIntersectOnNew
(TreeIndexImpl other) ixInvertOnNew
(TreeIndexImpl keys, long maximumPosition) Invert the given index.boolean
long
ixMinusOnNew
(TreeIndexImpl other) boolean
ixOverlaps
(TreeIndexImpl other) boolean
ixOverlapsRange
(long start, long end) long
int
void
ixRemove
(long key) ixRemove
(TreeIndexImpl other) ixRemoveRange
(long startKey, long endKey) final TreeIndexImpl
ixRemoveSecondHalf
(LongChunk<Attributes.OrderedKeyIndices> values, int offset, int length) ixRetain
(TreeIndexImpl other) ixRetainRange
(long start, long end) ixRetainRangeNoWriteCheck
(long start, long end) ixShiftInPlace
(long shiftAmount) ixShiftOnNew
(long shiftAmount) ixSubindexByKeyOnNew
(long startKey, long endKey) ixSubindexByPosOnNew
(long startPos, long endPosExclusive) boolean
ixSubsetOf
(TreeIndexImpl other) ixUnionOnNew
(TreeIndexImpl other) ixUpdate
(TreeIndexImpl added, TreeIndexImpl removed) ixUpdateNoWriteCheck
(TreeIndexImpl added, TreeIndexImpl removed) void
ixValidate
(String failMsg) long
last()
protected final RspBitmap
make()
protected final RspBitmap
static RspBitmap
static RspBitmap
makeSingle
(long v) static RspBitmap
makeSingleRange
(long start, long end) static RspBitmap
Return the logical or of two bitmaps as a new bitmap.Add every element on other to this bitmap.orEqualsShifted
(long shiftAmount, RspBitmap other) For every key on other, add (key + shiftAmount) to this bitmap.orEqualsShiftedUnsafe
(long shiftAmount, RspBitmap other) For every key on other, add (key + shiftAmount) to this bitmap.orEqualsUnsafe
(RspBitmap other) Add every element on other to this bitmap.remove
(long val) removeRange
(long start, long end) removeRangeUnsafe
(long start, long end) removeUnsafe
(long val) removeUnsafeNoWriteCheck
(long val) void
removeUnsafeNoWriteCheck
(long val, long blockKey, int i) protected RspBitmap
self()
Derived classes should implement self() by simply "return this" of the right type.subrangeByPos
(long firstPos, long lastPos) subrangeByPos
(long firstPos, long lastPos, boolean returnNullIfEmptyResult) subrangeByValue
(long start, long end) subrangeByValue
(long start, long end, boolean returnNullIfEmptyResult) boolean
subsetOf
(SortedRanges sr) toString()
Updates the bitmap by adding and removing the bitmaps given as parameter.updateUnsafe
(RspBitmap added, RspBitmap removed) void
updateUnsafeNoWriteCheck
(RspBitmap added, RspBitmap removed) Methods inherited from class com.illumon.iris.db.v2.utils.rsp.RspArray
andEqualsUnsafeNoWriteCheck, andNotEqualsUnsafeNoWriteCheck, appendContainer, appendFullBlockSpan, appendSharedContainer, appendSharedContainerMaybePacked, appendSingletonSpan, applyKeyOffset, applyKeyOffset, asOrderedKeys, binarySearchKeys, collectRemovedIndicesIfAny, containerOverhead, containsRange, copyKeyAndSpanMaybeSharing, copyKeyAndSpanMaybeSharing, copyKeyAndSpanStealingContainers, distanceInBlocks, divBlockSize, ensureSizeCanGrowBy, find, firstValue, firstValueAtIndex, forEachLong, forEachLongRange, forEachLongRangeInSpanWithOffsetAndMaxCardinality, get, getAverageRunLengthEstimate, getAverageRunLengthEstimate, getCardinality, getFullBlockSpanLen, getIterator, getKey, getKeysForPositions, getOrderedKeysByKeyRange, getOrderedKeysByPosition, getOrderedKeysIterator, getPackedInfoLowBits, getRangeBatchIterator, getRangeIterator, getReverseIterator, getSingletonSpanValue, getSpanCardinalityAtIndex, getSpanCardinalityAtIndex, getSpanCardinalityAtIndexMaybeAcc, getSpanIndex, getSpanIndex, getSpanIndex, getSpanInfo, getWorkSortedRangesMutableObject, highBits, insertContainerAtIndex, insertFullBlockSpanAtIndex, insertSharedContainer, insertSingletonAtIndex, isContainer, isEmpty, isFullBlockSpan, isSingletonSpan, keyForFirstBlock, keyForLastBlock, keySearch, keySearch, lastValue, lowBits, lowBitsAsInt, markIndexAsRemoved, markIndexRangeAsRemoved, modBlockSize, nextKey, orEqualsShiftedUnsafeNoWriteCheck, orEqualsUnsafeNoWriteCheck, overlaps, overlapsRange, overlapsRange, paste, rangesCountUpperBound, rangesCountUpperBound, removeRangesUnsafeNoWriteCheck, removeRangeUnsafeNoWriteCheck, removeSpanAtIndex, replaceSpanAtIndex, sampleMetrics, searchSpanIndex, setContainerSpan, setContainerSpan, setContainerSpanRaw, setContainerSpanRaw, setFullBlockSpan, setFullBlockSpanRaw, setFullBlockSpanRaw, setLastFullBlockSpan, setOrInsertFullBlockSpanAtIndex, setSharedContainerMaybePackedRaw, setSharedContainerRaw, setSingletonSpan, setSingletonSpanRaw, shareContainers, size, spanInfoToKey, spanInfoToSingletonSpanValue, subrangeByKeyInternal, subrangeByPosInternal, subsetOf, tryCompact, tryCompact, tryCompactUnsafe, uGreater, uGreaterOrEqual, uLess, uLessOrEqual, uMax, uMin, unsignedShortToInt, unsignedShortToLong, valuesToString
Methods inherited from class com.illumon.iris.db.v2.utils.RefCountedCow
acquire, canWrite, cowRef, getWriteRef, notifyAfterRelease, notifyBeforeAcquire, refCount, release
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.v2.utils.TreeIndexImpl
ixInsert, ixRemove, ixValidate
-
Constructor Details
-
RspBitmap
public RspBitmap() -
RspBitmap
public RspBitmap(long start, long end) -
RspBitmap
-
-
Method Details
-
makeEmpty
-
makeSingleRange
-
makeSingle
-
make
-
make
-
self
Description copied from class:RefCountedCow
Derived classes should implement self() by simply "return this" of the right type. This method exists only as an implementation artifact for a type safe implementation of the curiously recurring generic pattern.- Specified by:
self
in classRefCountedCow<RspBitmap>
- Returns:
- this object, with the right, most derived type.
-
deepCopy
Description copied from class:RefCountedCow
Get a deep copy of the current object, not shared with anybody. Note this is not thread safe.- Specified by:
deepCopy
in classRefCountedCow<RspBitmap>
- Returns:
- A full, deep copy of this object with a reference count of 1 (not shared).
-
writeCheck
-
first
public long first() -
last
public long last() -
addValuesUnsafe
public RspBitmap addValuesUnsafe(LongChunk<Attributes.OrderedKeyIndices> values, int offset, int length) -
addValuesUnsafeNoWriteCheck
public void addValuesUnsafeNoWriteCheck(LongChunk<Attributes.OrderedKeyIndices> values, int offset, int length) -
add
-
addUnsafe
-
addUnsafeNoWriteCheck
public void addUnsafeNoWriteCheck(long val) -
appendRangeUnsafeNoWriteCheck
public void appendRangeUnsafeNoWriteCheck(long sHigh, long start, long end) -
appendRange
-
appendRangeUnsafe
-
appendRangeUnsafeNoWriteCheck
public void appendRangeUnsafeNoWriteCheck(long start, long end) -
appendContainerUnsafeNoWriteCheck
-
appendFullBlockSpanUnsafeNoWriteCheck
public void appendFullBlockSpanUnsafeNoWriteCheck(long k, long slen) -
append
-
appendUnsafe
-
appendUnsafeNoWriteCheck
public void appendUnsafeNoWriteCheck(long v) -
containerForLowValueAndRange
-
addRangeExclusiveEnd
-
addRange
-
addRangeUnsafe
-
addRangeUnsafeNoWriteCheck
public void addRangeUnsafeNoWriteCheck(long first, long last) -
addRangeUnsafeNoWriteCheck
public int addRangeUnsafeNoWriteCheck(int fromIdx, long start, long end) -
addRangesUnsafeNoWriteCheck
-
contains
public boolean contains(long val) -
remove
-
removeUnsafe
-
removeUnsafeNoWriteCheck
-
removeUnsafeNoWriteCheck
public void removeUnsafeNoWriteCheck(long val, long blockKey, int i) -
removeRange
-
removeRangeUnsafe
-
or
Return the logical or of two bitmaps as a new bitmap. This is equivalent to the union of the two bitmaps as sets. The arguments won't be modified.- Parameters:
b1
- a bitmapb2
- a bitmap- Returns:
- b1 or b2 as a new bitmap.
-
orEquals
Add every element on other to this bitmap. -
orEqualsShifted
For every key on other, add (key + shiftAmount) to this bitmap. -
orEqualsUnsafe
Add every element on other to this bitmap. Does not update cardinality cache. Caller must ensure finishMutations() is called before any operation depending on the cardinality cache being up to date are called. -
orEqualsShiftedUnsafe
For every key on other, add (key + shiftAmount) to this bitmap. Note shiftAmount is assumed to be a multiple of BLOCK_SIZE. Does not update cardinality cache. Caller must ensure finishMutations() is called before any operation depending on the cardinality cache being up to date are called. -
appendShiftedUnsafeNoWriteCheck
-
and
Return the logical and of two bitmaps as a new bitmap. This is equivalent to the intersection of the two bitmaps as sets.- Parameters:
b1
- a bitmapb2
- a bitmap- Returns:
- b1 and b2 as a new bitmap.
-
andEquals
Removes every element from this bitmap that is not in the other bitmap. -
andEqualsUnsafe
-
andNotImpl
Return the logical result of r1 and not r2 as a new RspArray. The arguments won't be modified.- Parameters:
r1
- an RspArrayr2
- an RspArray- Returns:
- r1 and not r2 as a new RspArray.
-
andNot
Return the logical result of r1 and not r2 as a new bitmap. This is equivalent to removing every element in b2 from b1. The arguments won't be modified.- Parameters:
b1
- a bitmapb2
- a bitmap- Returns:
- b1 and not b2 as a new bitmap.
-
update
Updates the bitmap by adding and removing the bitmaps given as parameter.- Parameters:
added
- Elements to add. Assumed disjoint with removed.removed
- Elements to remove. Assumed disjoint with added.
-
updateUnsafe
-
updateUnsafeNoWriteCheck
-
andNotEquals
-
andNotEqualsUnsafe
Remove every element in other from this bitmap. -
applyOffset
Apply an offset to every value in this bitmap, mutating it.- Parameters:
offset
- The offset to apply.
-
applyOffsetNoWriteCheck
-
applyOffsetOnNew
Apply an offset to every value in this bitmap, returning a new bitmap (original is not changed).- Parameters:
offset
- The offset to apply.
-
applyOffsetImpl
-
subrangeByPos
-
subrangeByPos
-
subrangeByValue
-
subrangeByValue
-
invert
-
hashCode
public int hashCode() -
equals
-
finishMutations
public void finishMutations() -
finishMutationsAndOptimize
public void finishMutationsAndOptimize() -
ixCowRef
- Specified by:
ixCowRef
in interfaceTreeIndexImpl
-
ixInsert
- Specified by:
ixInsert
in interfaceTreeIndexImpl
-
ixRelease
public void ixRelease()- Specified by:
ixRelease
in interfaceTreeIndexImpl
-
ixRefCount
- Specified by:
ixRefCount
in interfaceTreeIndexImpl
-
ixInsertRange
- Specified by:
ixInsertRange
in interfaceTreeIndexImpl
-
ixInsertSecondHalf
public final TreeIndexImpl ixInsertSecondHalf(LongChunk<Attributes.OrderedKeyIndices> values, int offset, int length) - Specified by:
ixInsertSecondHalf
in interfaceTreeIndexImpl
-
ixRemoveSecondHalf
public final TreeIndexImpl ixRemoveSecondHalf(LongChunk<Attributes.OrderedKeyIndices> values, int offset, int length) - Specified by:
ixRemoveSecondHalf
in interfaceTreeIndexImpl
-
ixAppendRange
- Specified by:
ixAppendRange
in interfaceTreeIndexImpl
-
ixRemove
- Specified by:
ixRemove
in interfaceTreeIndexImpl
-
ixLastKey
public long ixLastKey()- Specified by:
ixLastKey
in interfaceTreeIndexImpl
-
ixFirstKey
public long ixFirstKey()- Specified by:
ixFirstKey
in interfaceTreeIndexImpl
-
ixGet
public long ixGet(long pos) - Specified by:
ixGet
in interfaceTreeIndexImpl
-
ixGetKeysForPositions
- Specified by:
ixGetKeysForPositions
in interfaceTreeIndexImpl
-
ixFind
public long ixFind(long key) - Specified by:
ixFind
in interfaceTreeIndexImpl
-
ixCardinality
public long ixCardinality()- Specified by:
ixCardinality
in interfaceTreeIndexImpl
-
ixIsEmpty
public boolean ixIsEmpty()- Specified by:
ixIsEmpty
in interfaceTreeIndexImpl
-
ixInvertOnNew
Description copied from interface:TreeIndexImpl
Invert the given index.- Specified by:
ixInvertOnNew
in interfaceTreeIndexImpl
- Parameters:
keys
- Index of keys to invertmaximumPosition
- the largest position to add to indexBuilder, inclusive- Returns:
- the inverse of index
-
ixForEachLong
- Specified by:
ixForEachLong
in interfaceTreeIndexImpl
-
ixForEachLongRange
- Specified by:
ixForEachLongRange
in interfaceTreeIndexImpl
-
ixSubindexByPosOnNew
- Specified by:
ixSubindexByPosOnNew
in interfaceTreeIndexImpl
-
ixSubindexByKeyOnNew
- Specified by:
ixSubindexByKeyOnNew
in interfaceTreeIndexImpl
-
ixUpdate
- Specified by:
ixUpdate
in interfaceTreeIndexImpl
-
ixUpdateNoWriteCheck
-
ixInsert
- Specified by:
ixInsert
in interfaceTreeIndexImpl
-
ixInsertNoWriteCheck
-
insertTreeIndexUnsafeNoWriteCheck
-
insertTreeIndexUnsafeNoWriteCheck
-
insertTreeIndexUnsafeNoWriteCheck
-
ixRemove
- Specified by:
ixRemove
in interfaceTreeIndexImpl
-
ixRemoveNoWriteCheck
-
ixRetain
- Specified by:
ixRetain
in interfaceTreeIndexImpl
-
ixRetainNoWriteCheck
-
ixRetainRange
- Specified by:
ixRetainRange
in interfaceTreeIndexImpl
-
ixRetainRangeNoWriteCheck
-
ixRemoveRange
- Specified by:
ixRemoveRange
in interfaceTreeIndexImpl
-
ixIntersectOnNew
- Specified by:
ixIntersectOnNew
in interfaceTreeIndexImpl
-
ixContainsRange
public boolean ixContainsRange(long start, long end) - Specified by:
ixContainsRange
in interfaceTreeIndexImpl
-
ixOverlaps
- Specified by:
ixOverlaps
in interfaceTreeIndexImpl
-
ixOverlapsRange
public boolean ixOverlapsRange(long start, long end) - Specified by:
ixOverlapsRange
in interfaceTreeIndexImpl
-
subsetOf
-
ixSubsetOf
- Specified by:
ixSubsetOf
in interfaceTreeIndexImpl
-
ixMinusOnNew
- Specified by:
ixMinusOnNew
in interfaceTreeIndexImpl
-
ixUnionOnNew
- Specified by:
ixUnionOnNew
in interfaceTreeIndexImpl
-
ixShiftOnNew
- Specified by:
ixShiftOnNew
in interfaceTreeIndexImpl
-
ixShiftInPlace
- Specified by:
ixShiftInPlace
in interfaceTreeIndexImpl
-
ixInsertWithShift
-
ixInsertWithShift
- Specified by:
ixInsertWithShift
in interfaceTreeIndexImpl
-
ixSearchIterator
- Specified by:
ixSearchIterator
in interfaceTreeIndexImpl
-
ixIterator
- Specified by:
ixIterator
in interfaceTreeIndexImpl
-
ixReverseIterator
- Specified by:
ixReverseIterator
in interfaceTreeIndexImpl
-
ixRangeIterator
- Specified by:
ixRangeIterator
in interfaceTreeIndexImpl
-
ixCompact
- Specified by:
ixCompact
in interfaceTreeIndexImpl
-
ixValidate
- Specified by:
ixValidate
in interfaceTreeIndexImpl
-
ixGetOrderedKeysByPosition
- Specified by:
ixGetOrderedKeysByPosition
in interfaceTreeIndexImpl
-
ixGetOrderedKeysByKeyRange
- Specified by:
ixGetOrderedKeysByKeyRange
in interfaceTreeIndexImpl
-
ixGetOrderedKeysIterator
- Specified by:
ixGetOrderedKeysIterator
in interfaceTreeIndexImpl
-
ixRangesCountUpperBound
public long ixRangesCountUpperBound()- Specified by:
ixRangesCountUpperBound
in interfaceTreeIndexImpl
-
ixGetAverageRunLengthEstimate
public long ixGetAverageRunLengthEstimate()- Specified by:
ixGetAverageRunLengthEstimate
in interfaceTreeIndexImpl
-
ixToRspOnNew
- Specified by:
ixToRspOnNew
in interfaceTreeIndexImpl
-
toString
-