ClusterSettings, IndexScopedSettingspublic abstract class AbstractScopedSettings extends AbstractComponent
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
AbstractScopedSettings.SettingUpdater<T> |
Transactional interface to update settings.
|
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
ARCHIVED_SETTINGS_PREFIX |
deprecationLogger, logger, settings| Modifier | Constructor | Description |
|---|---|---|
protected |
AbstractScopedSettings(Settings settings,
java.util.Set<Setting<?>> settingsSet,
Setting.Property scope) |
|
protected |
AbstractScopedSettings(Settings nodeSettings,
Settings scopeSettings,
AbstractScopedSettings other) |
| Modifier and Type | Method | Description |
|---|---|---|
<T> void |
addAffixMapUpdateConsumer(Setting.AffixSetting<T> setting,
java.util.function.Consumer<java.util.Map<java.lang.String,T>> consumer,
java.util.function.BiConsumer<java.lang.String,T> validator,
boolean omitDefaults) |
Adds a settings consumer for affix settings.
|
<T> void |
addAffixUpdateConsumer(Setting.AffixSetting<T> setting,
java.util.function.BiConsumer<java.lang.String,T> consumer,
java.util.function.BiConsumer<java.lang.String,T> validator) |
Adds a settings consumer for affix settings.
|
void |
addSettingsUpdateConsumer(java.util.function.Consumer<Settings> consumer,
java.util.List<? extends Setting<?>> settings) |
Adds a settings consumer that is only executed if any setting in the supplied list of settings is changed.
|
<A,B> void |
addSettingsUpdateConsumer(Setting<A> a,
Setting<B> b,
java.util.function.BiConsumer<A,B> consumer) |
Adds a settings consumer that accepts the values for two settings.
|
<A,B> void |
addSettingsUpdateConsumer(Setting<A> a,
Setting<B> b,
java.util.function.BiConsumer<A,B> consumer,
java.util.function.BiConsumer<A,B> validator) |
Adds a settings consumer that accepts the values for two settings.
|
<T> void |
addSettingsUpdateConsumer(Setting<T> setting,
java.util.function.Consumer<T> consumer) |
Adds a settings consumer.
|
<T> void |
addSettingsUpdateConsumer(Setting<T> setting,
java.util.function.Consumer<T> consumer,
java.util.function.Consumer<T> validator) |
Adds a settings consumer with a predicate that is only evaluated at update time.
|
Settings |
applySettings(Settings newSettings) |
Applies the given settings to all the settings consumers or to none of them.
|
Settings |
archiveUnknownOrInvalidSettings(Settings settings,
java.util.function.Consumer<java.util.Map.Entry<java.lang.String,java.lang.String>> unknownConsumer,
java.util.function.BiConsumer<java.util.Map.Entry<java.lang.String,java.lang.String>,java.lang.IllegalArgumentException> invalidConsumer) |
Archives invalid or unknown settings.
|
Settings |
diff(Settings source,
Settings defaultSettings) |
Returns a settings object that contains all settings that are not
already set in the given source.
|
Setting<?> |
get(java.lang.String key) |
Returns the
Setting for the given key or null if the setting can not be found. |
<T> T |
get(Setting<T> setting) |
Returns the value for the given setting.
|
Setting.Property |
getScope() |
|
boolean |
isDynamicSetting(java.lang.String key) |
Returns
true if the setting for the given key is dynamically updateable. |
boolean |
isFinalSetting(java.lang.String key) |
Returns
true if the setting for the given key is final. |
boolean |
isPrivateSetting(java.lang.String key) |
Returns
true iff the setting is a private setting ie. |
static boolean |
isValidKey(java.lang.String key) |
Returns
true iff the given key is a valid settings key otherwise false |
boolean |
updateDynamicSettings(Settings toApply,
Settings.Builder target,
Settings.Builder updates,
java.lang.String type) |
Updates a target settings builder with new, updated or deleted settings from a given settings builder.
|
boolean |
updateSettings(Settings toApply,
Settings.Builder target,
Settings.Builder updates,
java.lang.String type) |
Updates a target settings builder with new, updated or deleted settings from a given settings builder.
|
void |
validate(Settings settings,
boolean validateDependencies) |
Validates that all settings are registered and valid.
|
void |
validate(Settings settings,
boolean validateDependencies,
boolean ignorePrivateSettings,
boolean ignoreArchivedSettings) |
Validates that all settings are registered and valid.
|
protected void |
validateSettingKey(Setting setting) |
|
Settings |
validateUpdate(Settings settings) |
Validates the given settings by running it through all update listeners without applying it.
|
logDeprecatedSetting, logRemovedSetting, nodeNamepublic static final java.lang.String ARCHIVED_SETTINGS_PREFIX
protected AbstractScopedSettings(Settings settings, java.util.Set<Setting<?>> settingsSet, Setting.Property scope)
protected AbstractScopedSettings(Settings nodeSettings, Settings scopeSettings, AbstractScopedSettings other)
protected void validateSettingKey(Setting setting)
public static boolean isValidKey(java.lang.String key)
true iff the given key is a valid settings key otherwise falsepublic Setting.Property getScope()
public Settings validateUpdate(Settings settings)
public Settings applySettings(Settings newSettings)
newSettings - the settings to applypublic <T> void addSettingsUpdateConsumer(Setting<T> setting, java.util.function.Consumer<T> consumer, java.util.function.Consumer<T> validator)
Note: Only settings registered in SettingsModule can be changed dynamically.
validator - an additional validator that is only applied to updates of this setting.
This is useful to add additional validation to settings at runtime compared to at startup time.public void addSettingsUpdateConsumer(java.util.function.Consumer<Settings> consumer, java.util.List<? extends Setting<?>> settings)
public <T> void addAffixUpdateConsumer(Setting.AffixSetting<T> setting, java.util.function.BiConsumer<java.lang.String,T> consumer, java.util.function.BiConsumer<java.lang.String,T> validator)
public <T> void addAffixMapUpdateConsumer(Setting.AffixSetting<T> setting, java.util.function.Consumer<java.util.Map<java.lang.String,T>> consumer, java.util.function.BiConsumer<java.lang.String,T> validator, boolean omitDefaults)
addAffixUpdateConsumer(Setting.AffixSetting, BiConsumer, BiConsumer)public <A,B> void addSettingsUpdateConsumer(Setting<A> a, Setting<B> b, java.util.function.BiConsumer<A,B> consumer)
addSettingsUpdateConsumer(Setting, Setting, BiConsumer, BiConsumer) for details.public <A,B> void addSettingsUpdateConsumer(Setting<A> a, Setting<B> b, java.util.function.BiConsumer<A,B> consumer, java.util.function.BiConsumer<A,B> validator)
Note: Only settings registered in SettingsModule can be changed dynamically.
public <T> void addSettingsUpdateConsumer(Setting<T> setting, java.util.function.Consumer<T> consumer)
Note: Only settings registered in ClusterModule can be changed dynamically.
public final void validate(Settings settings, boolean validateDependencies)
settings - the settings to validatevalidateDependencies - true if dependent settings should be validatedSetting.getSettingsDependencies(String)public final void validate(Settings settings, boolean validateDependencies, boolean ignorePrivateSettings, boolean ignoreArchivedSettings)
settings - the settingsvalidateDependencies - true if dependent settings should be validatedignorePrivateSettings - true if private settings should be ignored during validationignoreArchivedSettings - true if archived settings should be ignored during validationSetting.getSettingsDependencies(String)public final Setting<?> get(java.lang.String key)
Setting for the given key or null if the setting can not be found.public boolean isDynamicSetting(java.lang.String key)
true if the setting for the given key is dynamically updateable. Otherwise false.public boolean isFinalSetting(java.lang.String key)
true if the setting for the given key is final. Otherwise false.public Settings diff(Settings source, Settings defaultSettings)
public <T> T get(Setting<T> setting)
public boolean updateDynamicSettings(Settings toApply, Settings.Builder target, Settings.Builder updates, java.lang.String type)
Note: This method will only allow updates to dynamic settings. if a non-dynamic setting is updated an
IllegalArgumentException is thrown instead.
toApply - the new settings to applytarget - the target settings builder that the updates are applied to. All keys that have explicit null value in toApply will be
removed from this builderupdates - a settings builder that holds all updates applied to targettype - a free text string to allow better exceptions messagestrue if the target has changed otherwise falsepublic boolean updateSettings(Settings toApply, Settings.Builder target, Settings.Builder updates, java.lang.String type)
toApply - the new settings to applytarget - the target settings builder that the updates are applied to. All keys that have explicit null value in toApply will be
removed from this builderupdates - a settings builder that holds all updates applied to targettype - a free text string to allow better exceptions messagestrue if the target has changed otherwise falsepublic Settings archiveUnknownOrInvalidSettings(Settings settings, java.util.function.Consumer<java.util.Map.Entry<java.lang.String,java.lang.String>> unknownConsumer, java.util.function.BiConsumer<java.util.Map.Entry<java.lang.String,java.lang.String>,java.lang.IllegalArgumentException> invalidConsumer)
settings - the Settings instance to scan for unknown or invalid settingsunknownConsumer - callback on unknown settings (consumer receives unknown key and its
associated value)invalidConsumer - callback on invalid settings (consumer receives invalid key, its
associated value and an exception)Settings instance with the unknown or invalid settings archivedpublic boolean isPrivateSetting(java.lang.String key)
true iff the setting is a private setting ie. it should be treated as valid even though it has no internal
representation. Otherwise false