Class NoOpIndexMaintainer
- java.lang.Object
-
- com.apple.foundationdb.record.provider.foundationdb.IndexMaintainer
-
- com.apple.foundationdb.record.provider.foundationdb.indexes.NoOpIndexMaintainer
-
@API(UNSTABLE) public class NoOpIndexMaintainer extends IndexMaintainer
An index maintainer that doesn't do anything.
-
-
Field Summary
-
Fields inherited from class com.apple.foundationdb.record.provider.foundationdb.IndexMaintainer
state
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NoOpIndexMaintainer(IndexMaintainerState state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Boolean>
addedRangeWithKey(Tuple primaryKey)
Whether this key has been added to some range within theRangeSet
associated with this index.boolean
canDeleteWhere(QueryToKeyMatcher matcher, Key.Evaluated evaluated)
Get whether this index scan delete records matching a particular key query.boolean
canEvaluateAggregateFunction(IndexAggregateFunction function)
Get whether this index can be used to evaluate the given aggregate function.boolean
canEvaluateRecordFunction(IndexRecordFunction<?> function)
Returntrue
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>
CompletableFuture<T>evaluateRecordFunction(EvaluationContext context, IndexRecordFunction<T> function, FDBRecord<M> record)
Evaluate a record function on the given record.boolean
isIdempotent()
Whether updating or removing a record on this index is idempotent.CompletableFuture<IndexOperationResult>
performOperation(IndexOperation operation)
Perform a type-specific operation on index.RecordCursor<IndexEntry>
scan(IndexScanType scanType, TupleRange range, byte[] continuation, ScanProperties scanProperties)
Scan entries in the index.RecordCursor<IndexEntry>
scanUniquenessViolations(TupleRange range, byte[] continuation, ScanProperties scanProperties)
Scans through the list of uniqueness violations within the database.<M extends Message>
CompletableFuture<Void>update(FDBIndexableRecord<M> oldRecord, FDBIndexableRecord<M> newRecord)
Update associated index for a changed record.RecordCursor<InvalidIndexEntry>
validateEntries(byte[] continuation, ScanProperties scanProperties)
Validates the integrity of the index entries.-
Methods inherited from class com.apple.foundationdb.record.provider.foundationdb.IndexMaintainer
getIndexSubspace, getSecondarySubspace, unsupportedAggregateFunction, unsupportedRecordFunction
-
-
-
-
Constructor Detail
-
NoOpIndexMaintainer
protected NoOpIndexMaintainer(IndexMaintainerState state)
-
-
Method Detail
-
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
-
update
@Nonnull public <M extends Message> CompletableFuture<Void> update(@Nullable FDBIndexableRecord<M> oldRecord, @Nullable FDBIndexableRecord<M> newRecord)
Description copied from class:IndexMaintainer
Update associated index for a changed record.- Specified by:
update
in classIndexMaintainer
- Type Parameters:
M
- type of message- Parameters:
oldRecord
- the previous stored record ornull
if a new record is being creatednewRecord
- the new record ornull
if an old record is being deleted- Returns:
- a future that is complete when the record update is done
-
scanUniquenessViolations
@Nonnull public RecordCursor<IndexEntry> scanUniquenessViolations(@Nonnull TupleRange range, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
Description copied from class:IndexMaintainer
Scans through the list of uniqueness violations within the database. It will return a cursor ofIndexEntry
instances where thegetKey()
will return the primary key of the record causing a problem andgetValue()
will return the index value that is being duplicated.- Specified by:
scanUniquenessViolations
in classIndexMaintainer
- Parameters:
range
- range of tuples to readcontinuation
- any continuation from a previous invocationscanProperties
- row limit and other scan properties- Returns:
- a cursor that will return primary key-index key pairs indicating uniqueness violations
-
validateEntries
@Nonnull public RecordCursor<InvalidIndexEntry> validateEntries(@Nullable byte[] continuation, @Nullable ScanProperties scanProperties)
Description copied from class:IndexMaintainer
Validates the integrity of the index entries. The definition of exactly what validations are performed is up to the implementation of the index. It is not responsible for metadata validation, which is defined inIndexValidator
.- Specified by:
validateEntries
in classIndexMaintainer
- Parameters:
continuation
- any continuation from a previous validation invocationscanProperties
- skip, limit and other properties of the validation (use default values ifnull
)- Returns:
- a cursor over invalid index entries including reasons
-
canEvaluateRecordFunction
public boolean canEvaluateRecordFunction(@Nonnull IndexRecordFunction<?> function)
Description copied from class:IndexMaintainer
Returntrue
if this index be used to evaluate the given record function.- Specified by:
canEvaluateRecordFunction
in classIndexMaintainer
- Parameters:
function
- requested function- Returns:
true
if this index can be used to evaluate the given function
-
evaluateRecordFunction
@Nonnull public <T,M extends Message> CompletableFuture<T> evaluateRecordFunction(@Nonnull EvaluationContext context, @Nonnull IndexRecordFunction<T> function, @Nonnull FDBRecord<M> record)
Description copied from class:IndexMaintainer
Evaluate a record function on the given record.- Specified by:
evaluateRecordFunction
in classIndexMaintainer
- Type Parameters:
T
- the result type of the functionM
- the message type of the record- Parameters:
context
- context for evaluationfunction
- the record function to apply to the given recordrecord
- record against which to evaluate- Returns:
- a future that completes with the result of evaluation
-
canEvaluateAggregateFunction
public boolean canEvaluateAggregateFunction(@Nonnull IndexAggregateFunction function)
Description copied from class:IndexMaintainer
Get whether this index can be used to evaluate the given aggregate function.- Specified by:
canEvaluateAggregateFunction
in classIndexMaintainer
- Parameters:
function
- the requested aggregate function- Returns:
true
if this index be used to evaluate the given aggregate function
-
evaluateAggregateFunction
@Nonnull public CompletableFuture<Tuple> evaluateAggregateFunction(@Nonnull IndexAggregateFunction function, @Nonnull TupleRange range, @Nonnull IsolationLevel isolationLevel)
Description copied from class:IndexMaintainer
Evaluate an aggregate function over the given range using this index.- Specified by:
evaluateAggregateFunction
in classIndexMaintainer
- Parameters:
function
- the aggregate function to evaluaterange
- the range over which to accumulate the aggregateisolationLevel
- the isolation level at which to perform the scan- Returns:
- a future that completes with the aggregate result
-
isIdempotent
public boolean isIdempotent()
Description copied from class:IndexMaintainer
Whether updating or removing a record on this index is idempotent. In principle, all index updates in the normal case are idempotent as long as the index update and the record insertion or deletion is atomic. However, certain indexes (mostly aggregate indexes) have the property that the index update on its own are not idempotent.- Specified by:
isIdempotent
in classIndexMaintainer
- Returns:
- whether updating this index is idempotent
-
addedRangeWithKey
@Nonnull public CompletableFuture<Boolean> addedRangeWithKey(@Nonnull Tuple primaryKey)
Description copied from class:IndexMaintainer
Whether this key has been added to some range within theRangeSet
associated with this index. This is used within the context of seeing if one should update a non-idempotent write-only index with a new key. If the key is in some range, then it means that one should update the index as it is based off of stale data. If the key is not in some range, then it means that one should not update the index, as the rebuild job will handle it later.- Specified by:
addedRangeWithKey
in classIndexMaintainer
- Parameters:
primaryKey
- the record key of the record to check- Returns:
- a future that will be
true
if some range contains the record andfalse
otherwise
-
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.- Specified by:
canDeleteWhere
in classIndexMaintainer
- 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.- Specified by:
deleteWhere
in classIndexMaintainer
- 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
-
performOperation
public CompletableFuture<IndexOperationResult> performOperation(@Nonnull IndexOperation operation)
Description copied from class:IndexMaintainer
Perform a type-specific operation on index. Allowed operations will vary by index type.- Specified by:
performOperation
in classIndexMaintainer
- Parameters:
operation
- the requested operation- Returns:
- a future that completes with the result of the operation
-
-