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 class
static class
static interface
A class for creatingIndex
s in various ways.static class
static interface
AnIndexBuilder
that accepts key additions in any random order.static interface
An builder forIndex
s that requires keys to be added in a monotonically increasing fashion.static class
Nested 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 boolean
static final Index.Factory
A Factory that createsIndex
s that support only current values.static final Index.Factory
A Factory that createsIndex
s that support previous values.static final boolean
Fields inherited from interface com.illumon.iris.db.v2.utils.OrderedKeys
EMPTY
Fields inherited from interface com.illumon.iris.db.v2.utils.ReadOnlyIndex
EMPTY_ITERATOR, NULL_KEY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
void
compact()
May reclaim some unused memory.default Index
Removes all the keys from other index that are present in the current set.void
Initializes our previous value from the current value.void
insert
(long key) Add a single key to this index if it's not already present.void
insert
(LongChunk<Attributes.OrderedKeyIndices> keys, int offset, int length) Add all of the (ordered) keys in a slice ofkeys
to this index if they are not already present.void
insert
(ReadOnlyIndex added) Add all of the keys inadded
to this index if they are not already present.void
insertRange
(long startKey, long endKey) Add all keys in a closed range to this index if they are not already present.void
insertWithShift
(long shiftAmount, ReadOnlyIndex other) For each key in the provided index, shift it by shiftAmount and insert it in the current index.void
remove
(long key) Remove a single key from this index if it's present.void
remove
(LongChunk<Attributes.OrderedKeyIndices> keys, int offset, int length) Remove all of the (ordered) keys in a slice ofkeys
from this index if they are present.void
remove
(ReadOnlyIndex removed) Remove all of the keys inremoved
that are present in this index.void
removeRange
(long startKey, long endKey) Remove all keys in a closed range from this index if they are present.void
retain
(ReadOnlyIndex indexToIntersect) Modifies the index by removing any keys not in the indexToIntersect argument.void
retainRange
(long start, long end) Modifies the index by keeping only keys in the interval [start, end]void
shiftInPlace
(long shiftAmount) void
update
(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, spliterator
Methods inherited from interface com.fishlib.base.log.LogOutputAppendable
append
Methods inherited from interface com.illumon.iris.db.util.LongSizedDataStructure
intSize, intSize
Methods inherited from interface com.illumon.iris.db.v2.utils.OrderedKeys
asIndex, asKeyIndicesChunk, asKeyRangesChunk, fillKeyIndicesChunk, fillKeyRangesChunk, forAllLongRanges, forEachLongRange, getAverageRunLengthEstimate, getOrderedKeysByKeyRange, getOrderedKeysByPosition, getOrderedKeysIterator, isContiguous
Methods 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 ofkeys
to this index if they are not already present.- Parameters:
keys
- TheLongChunk
ofAttributes.OrderedKeyIndices
to insertoffset
- The offset inkeys
to begin inserting keys fromlength
- The number of keys to insert
-
insert
Add all of the keys inadded
to 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 ofkeys
from this index if they are present.- Parameters:
keys
- TheLongChunk
ofAttributes.OrderedKeyIndices
to removeoffset
- The offset inkeys
to begin removing keys fromlength
- The number of keys to remove
-
remove
Remove all of the keys inremoved
that 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.
-