@API(value=MAINTAINED) public class AtomicMutationIndexMaintainer extends StandardIndexMaintainer
Normally, when two transactions read, modify, and write the same location, they conflict. This makes a straightforward implementation of most aggregate indexes inefficient. Ones that use the atomic mutation feature of FDB avoid this problem.
Modifier and Type | Field and Description |
---|---|
protected AtomicMutation |
mutation |
TOO_LARGE_VALUE_MESSAGE_LIMIT
state
Modifier | Constructor and Description |
---|---|
|
AtomicMutationIndexMaintainer(IndexMaintainerState state) |
protected |
AtomicMutationIndexMaintainer(IndexMaintainerState state,
AtomicMutation mutation) |
Modifier and Type | Method and Description |
---|---|
boolean |
canEvaluateAggregateFunction(IndexAggregateFunction function)
Get whether this index can be used to evaluate the given aggregate function.
|
protected Tuple |
decodeValue(byte[] value)
Decode value portion of key value pair.
|
CompletableFuture<Tuple> |
evaluateAggregateFunction(IndexAggregateFunction function,
TupleRange range,
IsolationLevel isolationveLevel)
Evaluate an aggregate function over the given range using this index.
|
protected static AtomicMutation |
getAtomicMutation(Index index) |
boolean |
isIdempotent()
Whether updating or removing a record on this index is idempotent.
|
protected boolean |
matchesAggregateFunction(IndexAggregateFunction function) |
RecordCursor<IndexEntry> |
scan(IndexScanType scanType,
TupleRange range,
byte[] continuation,
ScanProperties scanProperties)
Scan entries in the index.
|
boolean |
skipUpdateForUnchangedKeys() |
protected <M extends Message> |
updateIndexKeys(FDBIndexableRecord<M> savedRecord,
boolean remove,
List<IndexEntry> indexEntries)
Update index according to record keys.
|
addedRangeWithKey, canDeleteWhere, canDeleteWhere, canEvaluateRecordFunction, checkKeyValueSizes, commonKeys, deleteWhere, evaluateIndex, evaluateRecordFunction, filteredIndexEntries, getExecutor, getGroupedCount, getGroupingCount, getTimer, indexEntryKey, makeMutable, performOperation, saveIndexEntryAsKeyValue, scan, scanUniquenessViolations, trimTooLargeTuple, unpackKeyValue, unpackKeyValue, update, updateIndexKeysFunction, updateOneKey, updateUniquenessViolations, validateEntries, validateOrphanEntries
getIndexSubspace, getSecondarySubspace, unsupportedAggregateFunction, unsupportedRecordFunction
protected final AtomicMutation mutation
public AtomicMutationIndexMaintainer(IndexMaintainerState state)
protected AtomicMutationIndexMaintainer(IndexMaintainerState state, AtomicMutation mutation)
protected static AtomicMutation getAtomicMutation(@Nonnull Index index)
@Nonnull public RecordCursor<IndexEntry> scan(@Nonnull IndexScanType scanType, @Nonnull TupleRange range, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
IndexMaintainer
scan
in class IndexMaintainer
scanType
- the type
of scan to performrange
- 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)
protected Tuple decodeValue(@Nonnull byte[] value)
StandardIndexMaintainer
decodeValue
in class StandardIndexMaintainer
value
- the raw value portion of a key value pairpublic 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 isolationveLevel)
IndexMaintainer
evaluateAggregateFunction
in class StandardIndexMaintainer
function
- the aggregate function to evaluaterange
- the range over which to accumulate the aggregateisolationveLevel
- the isolation level at which to perform the scanprotected boolean matchesAggregateFunction(@Nonnull IndexAggregateFunction function)
public boolean isIdempotent()
IndexMaintainer
isIdempotent
in class StandardIndexMaintainer
public boolean skipUpdateForUnchangedKeys()
skipUpdateForUnchangedKeys
in class StandardIndexMaintainer