Package com.illumon.iris.db.v2.utils
Interface Index
- All Superinterfaces:
AutoCloseable,Iterable<Long>,com.fishlib.base.log.LogOutputAppendable,LongSizedDataStructure,OrderedKeys,ReadOnlyIndex,SafeCloseable
- All Known Implementing Classes:
CurrentOnlyIndex,SortedIndex,TreeIndex
public interface Index
extends ReadOnlyIndex, com.fishlib.base.log.LogOutputAppendable, Iterable<Long>, LongSizedDataStructure
A set of sorted long keys between 0 and Long.MAX_VALUE
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic classstatic interfaceA class for creatingIndexs in various ways.static classstatic interfaceAnIndexBuilderthat accepts key additions in any random order.static interfaceAn builder forIndexs that requires keys to be added in a monotonically increasing fashion.static classNested classes/interfaces inherited from interface com.illumon.iris.db.v2.utils.ReadOnlyIndex
ReadOnlyIndex.Iterator, ReadOnlyIndex.RangeIterator, ReadOnlyIndex.SearchIterator, ReadOnlyIndex.TargetComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final Index.FactoryA Factory that createsIndexs that support only current values.static final Index.FactoryA Factory that createsIndexs that support previous values.static final booleanFields inherited from interface com.illumon.iris.db.v2.utils.OrderedKeys
EMPTYFields inherited from interface com.illumon.iris.db.v2.utils.ReadOnlyIndex
EMPTY_ITERATOR, NULL_KEY -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidcompact()May reclaim some unused memory.default IndexRemoves all the keys from other index that are present in the current set.voidInitializes our previous value from the current value.voidinsert(long key) Add a single key to this index if it's not already present.voidinsert(LongChunk<Attributes.OrderedKeyIndices> keys, int offset, int length) Add all of the (ordered) keys in a slice ofkeysto this index if they are not already present.voidinsert(ReadOnlyIndex added) Add all of the keys inaddedto this index if they are not already present.voidinsertRange(long startKey, long endKey) Add all keys in a closed range to this index if they are not already present.voidinsertWithShift(long shiftAmount, ReadOnlyIndex other) For each key in the provided index, shift it by shiftAmount and insert it in the current index.voidremove(long key) Remove a single key from this index if it's present.voidremove(LongChunk<Attributes.OrderedKeyIndices> keys, int offset, int length) Remove all of the (ordered) keys in a slice ofkeysfrom this index if they are present.voidremove(ReadOnlyIndex removed) Remove all of the keys inremovedthat are present in this index.voidremoveRange(long startKey, long endKey) Remove all keys in a closed range from this index if they are present.voidretain(ReadOnlyIndex indexToIntersect) Modifies the index by removing any keys not in the indexToIntersect argument.voidretainRange(long start, long end) Modifies the index by keeping only keys in the interval [start, end]voidshiftInPlace(long shiftAmount) voidupdate(ReadOnlyIndex added, ReadOnlyIndex removed) Simultaneously adds the keys from the first index and removes the keys from the second one.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface com.fishlib.base.log.LogOutputAppendable
appendMethods inherited from interface com.illumon.iris.db.util.LongSizedDataStructure
intSize, intSizeMethods inherited from interface com.illumon.iris.db.v2.utils.OrderedKeys
asIndex, asKeyIndicesChunk, asKeyRangesChunk, fillKeyIndicesChunk, fillKeyRangesChunk, forAllLongRanges, forEachLongRange, getAverageRunLengthEstimate, getOrderedKeysByKeyRange, getOrderedKeysByPosition, getOrderedKeysIterator, isContiguousMethods inherited from interface com.illumon.iris.db.v2.utils.ReadOnlyIndex
clone, close, containsRange, copyImmutableGroupings, empty, find, findMissing, findPrev, firstKey, firstKeyPrev, forAllLongs, forEachLong, get, getGrouping, getGroupingForKeySet, getKeysForPositions, getPrev, getPrevGrouping, getPrevIndex, getSubIndexForKeySet, hasGrouping, intersect, invert, invert, isEmpty, isFlat, isSorted, iterator, lastKey, lastKeyPrev, minus, nonempty, overlaps, overlapsRange, rangeIterator, refCount, reverseIterator, searchIterator, shift, size, sizePrev, subindexByKey, subindexByPos, subindexByPos, subindexByPos, subIndexForReversePos, subsetOf, toLongArray, toLongArray, union, validate, validate
-
Field Details
-
Method Details
-
insert
void insert(long key) Add a single key to this index if it's not already present.- Parameters:
key- The key to add
-
insertRange
void insertRange(long startKey, long endKey) Add all keys in a closed range to this index if they are not already present.- Parameters:
startKey- The first key to addendKey- The last key to add (inclusive)
-
insert
Add all of the (ordered) keys in a slice ofkeysto this index if they are not already present.- Parameters:
keys- TheLongChunkofAttributes.OrderedKeyIndicesto insertoffset- The offset inkeysto begin inserting keys fromlength- The number of keys to insert
-
insert
Add all of the keys inaddedto this index if they are not already present.- Parameters:
added- The index to add
-
remove
void remove(long key) Remove a single key from this index if it's present.- Parameters:
key- The key to remove
-
removeRange
void removeRange(long startKey, long endKey) Remove all keys in a closed range from this index if they are present.- Parameters:
startKey- The first key to removeendKey- The last key to remove (inclusive)
-
remove
Remove all of the (ordered) keys in a slice ofkeysfrom this index if they are present.- Parameters:
keys- TheLongChunkofAttributes.OrderedKeyIndicesto removeoffset- The offset inkeysto begin removing keys fromlength- The number of keys to remove
-
remove
Remove all of the keys inremovedthat are present in this index.- Parameters:
removed- The index to remove
-
update
Simultaneously adds the keys from the first index and removes the keys from the second one. API assumption: the intersection of added and removed is empty. -
extract
Removes all the keys from other index that are present in the current set.- Returns:
- a new index representing the keys removed
-
retain
Modifies the index by removing any keys not in the indexToIntersect argument.- Parameters:
indexToIntersect- an index with the keys to retain; any other keys not in indexToIntersect will be removed.
-
retainRange
void retainRange(long start, long end) Modifies the index by keeping only keys in the interval [start, end]- Parameters:
start- beginning of interval of keys to keep.end- end of interval of keys to keep (inclusive).
-
clear
void clear() -
shiftInPlace
void shiftInPlace(long shiftAmount) -
insertWithShift
For each key in the provided index, shift it by shiftAmount and insert it in the current index.- Parameters:
shiftAmount- the amount to add to each key in the index argument before insertion.other- the index with the keys to shift and insert.
-
compact
void compact()May reclaim some unused memory. -
initializePreviousValue
void initializePreviousValue()Initializes our previous value from the current value. This call is used by operations that manipulate an Index while constructing it, but need to set the state at the end of the initial operation to the current state. Calling this in other circumstances will yield undefined results.
-