|
160 | 160 | import org.opensearch.index.recovery.RemoteStoreRestoreService; |
161 | 161 | import org.opensearch.index.remote.RemoteIndexPathUploader; |
162 | 162 | import org.opensearch.index.remote.RemoteStoreStatsTrackerFactory; |
| 163 | +import org.opensearch.index.store.DefaultCompositeDirectoryFactory; |
163 | 164 | import org.opensearch.index.store.IndexStoreListener; |
164 | 165 | import org.opensearch.index.store.RemoteSegmentStoreDirectoryFactory; |
165 | 166 | import org.opensearch.index.store.remote.filecache.FileCache; |
@@ -895,6 +896,22 @@ protected Node( |
895 | 896 | }); |
896 | 897 | directoryFactories.putAll(builtInDirectoryFactories); |
897 | 898 |
|
| 899 | + final Map<String, IndexStorePlugin.CompositeDirectoryFactory> compositeDirectoryFactories = new HashMap<>(); |
| 900 | + pluginsService.filterPlugins(IndexStorePlugin.class) |
| 901 | + .stream() |
| 902 | + .map(IndexStorePlugin::getCompositeDirectoryFactories) |
| 903 | + .flatMap(m -> m.entrySet().stream()) |
| 904 | + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)) |
| 905 | + .forEach((k, v) -> { |
| 906 | + if (k.equals("default")) { |
| 907 | + throw new IllegalStateException( |
| 908 | + "registered composite index store type [" + k + "] conflicts with a built-in default type" |
| 909 | + ); |
| 910 | + } |
| 911 | + compositeDirectoryFactories.put(k, v); |
| 912 | + }); |
| 913 | + compositeDirectoryFactories.put("default", new DefaultCompositeDirectoryFactory()); |
| 914 | + |
898 | 915 | final Map<String, IndexStorePlugin.RecoveryStateFactory> recoveryStateFactories = pluginsService.filterPlugins( |
899 | 916 | IndexStorePlugin.class |
900 | 917 | ) |
@@ -953,6 +970,7 @@ protected Node( |
953 | 970 | metaStateService, |
954 | 971 | engineFactoryProviders, |
955 | 972 | Map.copyOf(directoryFactories), |
| 973 | + Map.copyOf(compositeDirectoryFactories), |
956 | 974 | searchModule.getValuesSourceRegistry(), |
957 | 975 | recoveryStateFactories, |
958 | 976 | remoteDirectoryFactory, |
|
0 commit comments