Class IndexValidator
- java.lang.Object
-
- com.apple.foundationdb.record.metadata.IndexValidator
-
@API(MAINTAINED) public class IndexValidator extends Object
Validate an index according to the constraints of the index's type.- See Also:
Index
,IndexMaintainerFactory
-
-
Constructor Summary
Constructors Constructor Description IndexValidator(Index index)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
validate(MetaDataValidator metaDataValidator)
void
validateChangedOptions(Index oldIndex)
Validate any options that have changed.protected void
validateChangedOptions(Index oldIndex, Set<String> changedOptions)
Validate any option changes included in the set of changed options provided.protected void
validateGrouping(int minGrouped)
void
validateIndexForRecordType(RecordType recordType, MetaDataValidator metaDataValidator)
protected void
validateNotGrouping()
protected void
validateNotUnique()
protected void
validateNotVersion()
protected void
validateNoValue()
protected void
validateStoresRecordVersions(RecordMetaDataProvider metaDataProvider)
protected void
validateVersionInGroupedKeys()
protected void
validateVersionKey()
-
-
-
Method Detail
-
validate
public void validate(@Nonnull MetaDataValidator metaDataValidator)
-
validateIndexForRecordType
public void validateIndexForRecordType(@Nonnull RecordType recordType, @Nonnull MetaDataValidator metaDataValidator)
-
validateGrouping
protected void validateGrouping(int minGrouped)
-
validateNotGrouping
protected void validateNotGrouping()
-
validateStoresRecordVersions
protected void validateStoresRecordVersions(@Nonnull RecordMetaDataProvider metaDataProvider)
-
validateVersionKey
protected void validateVersionKey()
-
validateVersionInGroupedKeys
protected void validateVersionInGroupedKeys()
-
validateNotUnique
protected void validateNotUnique()
-
validateNotVersion
protected void validateNotVersion()
-
validateNoValue
protected void validateNoValue()
-
validateChangedOptions
@API(EXPERIMENTAL) protected void validateChangedOptions(@Nonnull Index oldIndex, @Nonnull Set<String> changedOptions)
Validate any option changes included in the set of changed options provided. This is a natural extension point for subclasses which may wish to override how certain options are handled. This function should look at only the options included in thechangedOptions
parameter even if additional options in this validator's index andoldIndex
. ThechangedOptions
parameter is also guaranteed to be safe to mutate. A common pattern for extending subclasses for specific index types might therefore be something like:- Validate that any options specific to this index have been changed responsibly.
- Remove those options from
changedOptions
. - Call
super.validateChangedOptions(oldIndex, changedOptions
to handle common options.
- Parameters:
oldIndex
- an older version of this validator's indexchangedOptions
- the set of changed options to inspect
-
validateChangedOptions
@API(EXPERIMENTAL) public void validateChangedOptions(@Nonnull Index oldIndex)
Validate any options that have changed. This should inspect the options ofoldIndex
, which will be an older version of this index, and determine if all index option changes are valid. In particular, this should validate that none of the changes necessitate any on-disk changes or index rebuilds. For example, it is generally legal to drop a uniqueness constraint from an index, but it is not legal to change the tokenizer of a text index.The default behavior is to allow the index to go from having a uniqueness constraint to not having one as well as allowing any change to the option specifying whether the index may be used for queries, but all other changes are rejected. If an index type would like to different behavior because some options specific to it may be safely changed, the validator for that type should either override this method or
validateChangedOptions(Index, Set)
.- Parameters:
oldIndex
- an older version of this validator's index- See Also:
validateChangedOptions(Index, Set)
-
-