@API(value=MAINTAINED) public class RankIndexMaintainer extends StandardIndexMaintainer
RankedSet
of record field values.
A rank index is used to implement these operations in queries:
Any number of fields in the index can optionally separate records into non-overlapping groups. Each group, determined by the values of those fields, has separate ranking.
Physical layout:
[group, ..., score, ...]
.TOO_LARGE_VALUE_MESSAGE_LIMIT
state
Constructor and Description |
---|
RankIndexMaintainer(IndexMaintainerState state) |
Modifier and Type | Method and Description |
---|---|
boolean |
canEvaluateAggregateFunction(IndexAggregateFunction function)
Get whether this index can be used to evaluate the given aggregate function.
|
boolean |
canEvaluateRecordFunction(IndexRecordFunction<?> function)
Return
true if this index be used to evaluate the given record function. |
CompletableFuture<Void> |
deleteWhere(Transaction tr,
Tuple prefix)
Clear index storage associated with the given key prefix.
|
CompletableFuture<Tuple> |
evaluateAggregateFunction(IndexAggregateFunction function,
TupleRange range,
IsolationLevel isolationLevel)
Evaluate an aggregate function over the given range using this index.
|
<T,M extends Message> |
evaluateRecordFunction(EvaluationContext context,
IndexRecordFunction<T> function,
FDBRecord<M> record)
Evaluate a record function on the given record.
|
<M extends Message> |
rank(FDBRecord<M> record) |
RecordCursor<IndexEntry> |
scan(IndexScanType scanType,
TupleRange rankRange,
byte[] continuation,
ScanProperties scanProperties)
Scan entries in the index.
|
protected <M extends Message> |
updateIndexKeys(FDBIndexableRecord<M> savedRecord,
boolean remove,
List<IndexEntry> indexEntries)
Update index according to record keys.
|
addedRangeWithKey, canDeleteWhere, canDeleteWhere, checkKeyValueSizes, commonKeys, decodeValue, evaluateIndex, filteredIndexEntries, getExecutor, getGroupedCount, getGroupingCount, getTimer, indexEntryKey, isIdempotent, makeMutable, performOperation, saveIndexEntryAsKeyValue, scan, scanUniquenessViolations, skipUpdateForUnchangedKeys, trimTooLargeTuple, unpackKeyValue, unpackKeyValue, update, updateIndexKeysFunction, updateOneKey, updateUniquenessViolations, validateEntries, validateMissingEntries, validateOrphanEntries
getIndexSubspace, getSecondarySubspace, unsupportedAggregateFunction, unsupportedRecordFunction
public RankIndexMaintainer(IndexMaintainerState state)
@Nonnull public RecordCursor<IndexEntry> scan(@Nonnull IndexScanType scanType, @Nonnull TupleRange rankRange, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
IndexMaintainer
scan
in class IndexMaintainer
scanType
- the type
of scan to performrankRange
- the range to scancontinuation
- any continuation from a previous scan invocationscanProperties
- skip, limit and other properties of the scanprotected <M extends Message> CompletableFuture<Void> updateIndexKeys(@Nonnull FDBIndexableRecord<M> savedRecord, boolean remove, @Nonnull List<IndexEntry> indexEntries)
StandardIndexMaintainer
updateIndexKeys
in class StandardIndexMaintainer
M
- the message type of the recordsavedRecord
- the record being indexedremove
- true
if removing from indexindexEntries
- the result of StandardIndexMaintainer.evaluateIndex(FDBRecord)
public boolean canEvaluateRecordFunction(@Nonnull IndexRecordFunction<?> function)
IndexMaintainer
true
if this index be used to evaluate the given record function.canEvaluateRecordFunction
in class StandardIndexMaintainer
function
- requested functiontrue
if this index can be used to evaluate the given function@Nonnull public <T,M extends Message> CompletableFuture<T> evaluateRecordFunction(@Nonnull EvaluationContext context, @Nonnull IndexRecordFunction<T> function, @Nonnull FDBRecord<M> record)
IndexMaintainer
evaluateRecordFunction
in class StandardIndexMaintainer
T
- the result type of the functionM
- the message type of the recordcontext
- context for evaluationfunction
- the record function to apply to the given recordrecord
- record against which to evaluatepublic <M extends Message> CompletableFuture<Long> rank(@Nonnull FDBRecord<M> record)
public CompletableFuture<Void> deleteWhere(Transaction tr, @Nonnull Tuple prefix)
IndexMaintainer
deleteWhere
in class StandardIndexMaintainer
tr
- transaction in which to access the databaseprefix
- prefix of primary key to clearpublic boolean canEvaluateAggregateFunction(@Nonnull IndexAggregateFunction function)
IndexMaintainer
canEvaluateAggregateFunction
in class StandardIndexMaintainer
function
- the requested aggregate functiontrue
if this index be used to evaluate the given aggregate function@Nonnull public CompletableFuture<Tuple> evaluateAggregateFunction(@Nonnull IndexAggregateFunction function, @Nonnull TupleRange range, @Nonnull IsolationLevel isolationLevel)
IndexMaintainer
evaluateAggregateFunction
in class StandardIndexMaintainer
function
- the aggregate function to evaluaterange
- the range over which to accumulate the aggregateisolationLevel
- the isolation level at which to perform the scan