Skip to content

Commit 49df3eb

Browse files
committed
Merge AzureStorageService and AzureStorageServiceImpl and clean up tests (#31607)
This pull request merges the AzureStorageService interface and the AzureStorageServiceImpl classes into one single AzureStorageService class. It also removes some tests in the repository-azure plugin that have not been executed for 2+ years.
1 parent c4158e2 commit 49df3eb

File tree

8 files changed

+250
-920
lines changed

8 files changed

+250
-920
lines changed

plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageService.java

Lines changed: 197 additions & 44 deletions
Large diffs are not rendered by default.

plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageServiceImpl.java

Lines changed: 0 additions & 277 deletions
This file was deleted.

plugins/repository-azure/src/main/java/org/elasticsearch/cloud/azure/storage/AzureStorageSettings.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121

2222
import com.microsoft.azure.storage.LocationMode;
2323
import com.microsoft.azure.storage.RetryPolicy;
24-
import org.elasticsearch.cloud.azure.storage.AzureStorageService.Storage;
25-
import org.elasticsearch.common.collect.Tuple;
2624
import org.elasticsearch.common.Strings;
2725
import org.elasticsearch.common.collect.MapBuilder;
26+
import org.elasticsearch.common.collect.Tuple;
2827
import org.elasticsearch.common.settings.SecureSetting;
2928
import org.elasticsearch.common.settings.SecureString;
3029
import org.elasticsearch.common.settings.Setting;
@@ -33,19 +32,18 @@
3332
import org.elasticsearch.common.settings.Settings;
3433
import org.elasticsearch.common.settings.SettingsException;
3534
import org.elasticsearch.common.unit.TimeValue;
35+
3636
import java.net.InetAddress;
3737
import java.net.InetSocketAddress;
3838
import java.net.Proxy;
3939
import java.net.UnknownHostException;
4040
import java.util.ArrayList;
4141
import java.util.Collections;
4242
import java.util.HashMap;
43-
import java.util.Locale;
4443
import java.util.List;
44+
import java.util.Locale;
4545
import java.util.Map;
4646

47-
import static org.elasticsearch.cloud.azure.storage.AzureStorageService.Storage.STORAGE_ACCOUNTS;
48-
4947
public final class AzureStorageSettings {
5048

5149
// prefix for azure client settings
@@ -88,6 +86,22 @@ public final class AzureStorageSettings {
8886
PROXY_HOST_SETTING);
8987

9088

89+
public interface Storage {
90+
@Deprecated
91+
String PREFIX = "cloud.azure.storage.";
92+
93+
@Deprecated
94+
Setting<Settings> STORAGE_ACCOUNTS = Setting.groupSetting(Storage.PREFIX, Setting.Property.NodeScope);
95+
96+
/**
97+
* Azure timeout (defaults to -1 minute)
98+
* @deprecated We don't want to support global timeout settings anymore
99+
*/
100+
@Deprecated
101+
Setting<TimeValue> TIMEOUT_SETTING =
102+
Setting.timeSetting("cloud.azure.storage.timeout", TimeValue.timeValueMinutes(-1), Property.NodeScope, Property.Deprecated);
103+
}
104+
91105
@Deprecated
92106
public static final AffixSetting<TimeValue> DEPRECATED_TIMEOUT_SETTING = Setting.affixKeySetting(Storage.PREFIX, "timeout",
93107
(key) -> Setting.timeSetting(key, Storage.TIMEOUT_SETTING, Property.NodeScope, Property.Deprecated));
@@ -274,7 +288,7 @@ public static Map<String, AzureStorageSettings> load(Settings settings) {
274288
}
275289
return storageSettings;
276290
}
277-
291+
278292
static Map<String, AzureStorageSettings> loadRegular(Settings settings) {
279293
// Get the list of existing named configurations
280294
final Map<String, AzureStorageSettings> storageSettings = new HashMap<>();
@@ -309,7 +323,7 @@ static AzureStorageSettings getClientSettings(Settings settings, String clientNa
309323
@Deprecated
310324
private static List<AzureStorageSettings> createStorageSettingsDeprecated(Settings settings) {
311325
// ignore global timeout which has the same prefix but does not belong to any group
312-
Settings groups = STORAGE_ACCOUNTS.get(settings.filter((k) -> k.equals(Storage.TIMEOUT_SETTING.getKey()) == false));
326+
Settings groups = Storage.STORAGE_ACCOUNTS.get(settings.filter((k) -> k.equals(Storage.TIMEOUT_SETTING.getKey()) == false));
313327
List<AzureStorageSettings> storageSettings = new ArrayList<>();
314328
for (String groupName : groups.getAsGroups().keySet()) {
315329
storageSettings.add(

0 commit comments

Comments
 (0)