Class PermutedMinMaxIndexMaintainer
- java.lang.Object
-
- com.apple.foundationdb.record.provider.foundationdb.IndexMaintainer
-
- com.apple.foundationdb.record.provider.foundationdb.indexes.StandardIndexMaintainer
-
- com.apple.foundationdb.record.provider.foundationdb.indexes.PermutedMinMaxIndexMaintainer
-
@API(EXPERIMENTAL) public class PermutedMinMaxIndexMaintainer extends StandardIndexMaintainer
An index that maintains an extremum value in a way that can be enumerated by that value rather than by group. This is done by specifying a number of grouping fields that are permuted to after the value. This number is specified by theIndexOptions.PERMUTED_SIZE_OPTION
index option. For example, anPERMUTED_MAX
index onfield(val).groupBy(concatenateFields(group, subgroup))
with a permuted size of1
can, for an ordered range ofgroup
value(s) (including just a single group), list the maximumvalue
for eachsubgroup
, ordered by that maximum.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
PermutedMinMaxIndexMaintainer.Type
-
Field Summary
-
Fields inherited from class com.apple.foundationdb.record.provider.foundationdb.indexes.StandardIndexMaintainer
TOO_LARGE_VALUE_MESSAGE_LIMIT
-
Fields inherited from class com.apple.foundationdb.record.provider.foundationdb.IndexMaintainer
state
-
-
Constructor Summary
Constructors Constructor Description PermutedMinMaxIndexMaintainer(IndexMaintainerState state)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canDeleteWhere(QueryToKeyMatcher matcher, Key.Evaluated evaluated)
Get whether this index scan delete records matching a particular key query.CompletableFuture<Void>
deleteWhere(Transaction tr, Tuple prefix)
Clear index storage associated with the given key prefix.protected static int
getPermutedSize(Index index)
protected static PermutedMinMaxIndexMaintainer.Type
getType(Index index)
RecordCursor<IndexEntry>
scan(IndexScanType scanType, TupleRange range, byte[] continuation, ScanProperties scanProperties)
Scan entries in the index.protected <M extends Message>
CompletableFuture<Void>updateIndexKeys(FDBIndexableRecord<M> savedRecord, boolean remove, List<IndexEntry> indexEntries)
Update index according to record keys.-
Methods inherited from class com.apple.foundationdb.record.provider.foundationdb.indexes.StandardIndexMaintainer
addedRangeWithKey, addUniquenessViolation, canDeleteWhere, canEvaluateAggregateFunction, canEvaluateRecordFunction, checkKeyValueSizes, checkUniqueness, commonKeys, decodeValue, evaluateAggregateFunction, evaluateIndex, evaluateRecordFunction, filteredIndexEntries, getExecutor, getGroupedCount, getGroupingCount, getTimer, indexEntryKey, isIdempotent, makeMutable, performOperation, removeUniquenessViolationsAsync, saveIndexEntryAsKeyValue, scan, scanUniquenessViolations, skipUpdateForUnchangedKeys, trimTooLargeTuple, unpackKeyValue, unpackKeyValue, update, updateIndexKeysFunction, updateOneKeyAsync, validateEntries, validateMissingEntries, validateOrphanEntries
-
Methods inherited from class com.apple.foundationdb.record.provider.foundationdb.IndexMaintainer
getIndexSubspace, getSecondarySubspace, unsupportedAggregateFunction, unsupportedRecordFunction
-
-
-
-
Constructor Detail
-
PermutedMinMaxIndexMaintainer
public PermutedMinMaxIndexMaintainer(@Nonnull IndexMaintainerState state)
-
-
Method Detail
-
getType
protected static PermutedMinMaxIndexMaintainer.Type getType(@Nonnull Index index)
-
scan
@Nonnull public RecordCursor<IndexEntry> scan(@Nonnull IndexScanType scanType, @Nonnull TupleRange range, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
Description copied from class:IndexMaintainer
Scan entries in the index.- Specified by:
scan
in classIndexMaintainer
- Parameters:
scanType
- thetype
of scan to performrange
- the range to scancontinuation
- any continuation from a previous scan invocationscanProperties
- skip, limit and other properties of the scan- Returns:
- a cursor over index entries in the given range
-
updateIndexKeys
protected <M extends Message> CompletableFuture<Void> updateIndexKeys(@Nonnull FDBIndexableRecord<M> savedRecord, boolean remove, @Nonnull List<IndexEntry> indexEntries)
Description copied from class:StandardIndexMaintainer
Update index according to record keys. Often this operation returns an already completed future because there is no asynchronous work to be done.- Overrides:
updateIndexKeys
in classStandardIndexMaintainer
- Type Parameters:
M
- the message type of the record- Parameters:
savedRecord
- the record being indexedremove
-true
if removing from indexindexEntries
- the result ofStandardIndexMaintainer.evaluateIndex(FDBRecord)
- Returns:
- a future completed when update is done
-
canDeleteWhere
public boolean canDeleteWhere(@Nonnull QueryToKeyMatcher matcher, @Nonnull Key.Evaluated evaluated)
Description copied from class:IndexMaintainer
Get whether this index scan delete records matching a particular key query.- Overrides:
canDeleteWhere
in classStandardIndexMaintainer
- Parameters:
matcher
- the key queryevaluated
- parameters to the key query- Returns:
true
if this index accommodate awhereRecordsWhere
-
deleteWhere
public CompletableFuture<Void> deleteWhere(Transaction tr, @Nonnull Tuple prefix)
Description copied from class:IndexMaintainer
Clear index storage associated with the given key prefix.- Overrides:
deleteWhere
in classStandardIndexMaintainer
- Parameters:
tr
- transaction in which to access the databaseprefix
- prefix of primary key to clear- Returns:
- a future that is complete when the given prefix has been cleared from this index
-
-