Fix after merge
This commit is contained in:
parent
c11cf3bf1f
commit
76719341dc
|
@ -165,11 +165,10 @@ public class Setting<T> extends ToXContentToBytes {
|
||||||
* @param key the settings key for this setting.
|
* @param key the settings key for this setting.
|
||||||
* @param defaultValue a default value function that returns the default values string representation.
|
* @param defaultValue a default value function that returns the default values string representation.
|
||||||
* @param parser a parser that parses the string rep into a complex datatype.
|
* @param parser a parser that parses the string rep into a complex datatype.
|
||||||
* @param dynamic true iff this setting can be dynamically updateable
|
* @param properties properties for this setting like scope, filtering...
|
||||||
* @param scope the scope of this setting
|
|
||||||
*/
|
*/
|
||||||
public Setting(String key, Function<Settings, String> defaultValue, Function<String, T> parser, boolean dynamic, Scope scope) {
|
public Setting(String key, Function<Settings, String> defaultValue, Function<String, T> parser, SettingsProperty... properties) {
|
||||||
this(new SimpleKey(key), defaultValue, parser, dynamic, scope);
|
this(new SimpleKey(key), defaultValue, parser, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -722,8 +721,9 @@ public class Setting<T> extends ToXContentToBytes {
|
||||||
* can easily be added with this setting. Yet, prefix key settings don't support updaters out of the box unless
|
* can easily be added with this setting. Yet, prefix key settings don't support updaters out of the box unless
|
||||||
* {@link #getConcreteSetting(String)} is used to pull the updater.
|
* {@link #getConcreteSetting(String)} is used to pull the updater.
|
||||||
*/
|
*/
|
||||||
public static <T> Setting<T> prefixKeySetting(String prefix, String defaultValue, Function<String, T> parser, boolean dynamic, Scope scope) {
|
public static <T> Setting<T> prefixKeySetting(String prefix, String defaultValue, Function<String, T> parser,
|
||||||
return affixKeySetting(AffixKey.withPrefix(prefix), (s) -> defaultValue, parser, dynamic, scope);
|
SettingsProperty... properties) {
|
||||||
|
return affixKeySetting(AffixKey.withPrefix(prefix), (s) -> defaultValue, parser, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -731,12 +731,14 @@ public class Setting<T> extends ToXContentToBytes {
|
||||||
* storage.${backend}.enable=[true|false] can easily be added with this setting. Yet, adfix key settings don't support updaters
|
* storage.${backend}.enable=[true|false] can easily be added with this setting. Yet, adfix key settings don't support updaters
|
||||||
* out of the box unless {@link #getConcreteSetting(String)} is used to pull the updater.
|
* out of the box unless {@link #getConcreteSetting(String)} is used to pull the updater.
|
||||||
*/
|
*/
|
||||||
public static <T> Setting<T> adfixKeySetting(String prefix, String suffix, Function<Settings, String> defaultValue, Function<String, T> parser, boolean dynamic, Scope scope) {
|
public static <T> Setting<T> adfixKeySetting(String prefix, String suffix, Function<Settings, String> defaultValue,
|
||||||
return affixKeySetting(AffixKey.withAdfix(prefix, suffix), defaultValue, parser, dynamic, scope);
|
Function<String, T> parser, SettingsProperty... properties) {
|
||||||
|
return affixKeySetting(AffixKey.withAdfix(prefix, suffix), defaultValue, parser, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Setting<T> adfixKeySetting(String prefix, String suffix, String defaultValue, Function<String, T> parser, boolean dynamic, Scope scope) {
|
public static <T> Setting<T> adfixKeySetting(String prefix, String suffix, String defaultValue, Function<String, T> parser,
|
||||||
return adfixKeySetting(prefix, suffix, (s) -> defaultValue, parser, dynamic, scope);
|
SettingsProperty... properties) {
|
||||||
|
return adfixKeySetting(prefix, suffix, (s) -> defaultValue, parser, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Setting<T> affixKeySetting(AffixKey key, Function<Settings, String> defaultValue, Function<String, T> parser,
|
public static <T> Setting<T> affixKeySetting(AffixKey key, Function<Settings, String> defaultValue, Function<String, T> parser,
|
||||||
|
|
|
@ -384,7 +384,8 @@ public class SettingTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAdfixKeySetting() {
|
public void testAdfixKeySetting() {
|
||||||
Setting<Boolean> setting = Setting.adfixKeySetting("foo", "enable", "false", Boolean::parseBoolean, false, Setting.Scope.CLUSTER);
|
Setting<Boolean> setting =
|
||||||
|
Setting.adfixKeySetting("foo", "enable", "false", Boolean::parseBoolean, Setting.SettingsProperty.ClusterScope);
|
||||||
assertTrue(setting.hasComplexMatcher());
|
assertTrue(setting.hasComplexMatcher());
|
||||||
assertTrue(setting.match("foo.bar.enable"));
|
assertTrue(setting.match("foo.bar.enable"));
|
||||||
assertTrue(setting.match("foo.baz.enable"));
|
assertTrue(setting.match("foo.baz.enable"));
|
||||||
|
|
|
@ -46,11 +46,13 @@ public final class AzureStorageSettings {
|
||||||
TIMEOUT_KEY,
|
TIMEOUT_KEY,
|
||||||
(s) -> Storage.TIMEOUT_SETTING.get(s).toString(),
|
(s) -> Storage.TIMEOUT_SETTING.get(s).toString(),
|
||||||
(s) -> Setting.parseTimeValue(s, TimeValue.timeValueSeconds(-1), TIMEOUT_KEY.toString()),
|
(s) -> Setting.parseTimeValue(s, TimeValue.timeValueSeconds(-1), TIMEOUT_KEY.toString()),
|
||||||
false,
|
Setting.SettingsProperty.ClusterScope);
|
||||||
Setting.Scope.CLUSTER);
|
private static final Setting<String> ACCOUNT_SETTING =
|
||||||
private static final Setting<String> ACCOUNT_SETTING = Setting.adfixKeySetting(Storage.PREFIX, ACCOUNT_SUFFIX, "", Function.identity(), false, Setting.Scope.CLUSTER);
|
Setting.adfixKeySetting(Storage.PREFIX, ACCOUNT_SUFFIX, "", Function.identity(), Setting.SettingsProperty.ClusterScope);
|
||||||
private static final Setting<String> KEY_SETTING = Setting.adfixKeySetting(Storage.PREFIX, KEY_SUFFIX, "", Function.identity(), false, Setting.Scope.CLUSTER);
|
private static final Setting<String> KEY_SETTING =
|
||||||
private static final Setting<Boolean> DEFAULT_SETTING = Setting.adfixKeySetting(Storage.PREFIX, DEFAULT_SUFFIX, "false", Boolean::valueOf, false, Setting.Scope.CLUSTER);
|
Setting.adfixKeySetting(Storage.PREFIX, KEY_SUFFIX, "", Function.identity(), Setting.SettingsProperty.ClusterScope);
|
||||||
|
private static final Setting<Boolean> DEFAULT_SETTING =
|
||||||
|
Setting.adfixKeySetting(Storage.PREFIX, DEFAULT_SUFFIX, "false", Boolean::valueOf, Setting.SettingsProperty.ClusterScope);
|
||||||
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
@ -110,7 +112,7 @@ public final class AzureStorageSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<AzureStorageSettings> createStorageSettings(Settings settings) {
|
private static List<AzureStorageSettings> createStorageSettings(Settings settings) {
|
||||||
Setting<Settings> storageGroupSetting = Setting.groupSetting(Storage.PREFIX, false, Setting.Scope.CLUSTER);
|
Setting<Settings> storageGroupSetting = Setting.groupSetting(Storage.PREFIX, Setting.SettingsProperty.ClusterScope);
|
||||||
// ignore global timeout which has the same prefix but does not belong to any group
|
// ignore global timeout which has the same prefix but does not belong to any group
|
||||||
Settings groups = storageGroupSetting.get(settings.filter((k) -> k.equals(Storage.TIMEOUT_SETTING.getKey()) == false));
|
Settings groups = storageGroupSetting.get(settings.filter((k) -> k.equals(Storage.TIMEOUT_SETTING.getKey()) == false));
|
||||||
List<AzureStorageSettings> storageSettings = new ArrayList<>();
|
List<AzureStorageSettings> storageSettings = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue