Skip to content

Commit c8728c9

Browse files
authored
Remove XPackFeatureSet interface (#115679) (#115776)
XPackFeatureSet hasn't been used for many years. But the inner "Usage" class is still used. This commit moves the Usage class up to its own file as XPackFeatureUsage, and removes the defunct XPackFeatureSet interface. closes #29736
1 parent b88e9a6 commit c8728c9

File tree

57 files changed

+348
-367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+348
-367
lines changed

x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/action/AnalyticsInfoTransportActionTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.elasticsearch.test.MockUtils;
2121
import org.elasticsearch.threadpool.ThreadPool;
2222
import org.elasticsearch.transport.TransportService;
23-
import org.elasticsearch.xpack.core.XPackFeatureSet;
23+
import org.elasticsearch.xpack.core.XPackFeatureUsage;
2424
import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse;
2525
import org.elasticsearch.xpack.core.analytics.AnalyticsFeatureSetUsage;
2626
import org.elasticsearch.xpack.core.analytics.action.AnalyticsStatsAction;
@@ -75,12 +75,12 @@ public void testAvailable() throws Exception {
7575
);
7676
PlainActionFuture<XPackUsageFeatureResponse> future = new PlainActionFuture<>();
7777
usageAction.masterOperation(task, null, clusterState, future);
78-
XPackFeatureSet.Usage usage = future.get().getUsage();
78+
XPackFeatureUsage usage = future.get().getUsage();
7979
assertThat(usage.available(), is(true));
8080

8181
BytesStreamOutput out = new BytesStreamOutput();
8282
usage.writeTo(out);
83-
XPackFeatureSet.Usage serializedUsage = new AnalyticsFeatureSetUsage(out.bytes().streamInput());
83+
XPackFeatureUsage serializedUsage = new AnalyticsFeatureSetUsage(out.bytes().streamInput());
8484
assertThat(serializedUsage.available(), is(true));
8585
verify(client, times(1)).execute(any(), any(), any());
8686
verifyNoMoreInteractions(client);
@@ -103,12 +103,12 @@ public void testEnabled() throws Exception {
103103
);
104104
PlainActionFuture<XPackUsageFeatureResponse> future = new PlainActionFuture<>();
105105
usageAction.masterOperation(task, null, clusterState, future);
106-
XPackFeatureSet.Usage usage = future.get().getUsage();
106+
XPackFeatureUsage usage = future.get().getUsage();
107107
assertTrue(usage.enabled());
108108

109109
BytesStreamOutput out = new BytesStreamOutput();
110110
usage.writeTo(out);
111-
XPackFeatureSet.Usage serializedUsage = new AnalyticsFeatureSetUsage(out.bytes().streamInput());
111+
XPackFeatureUsage serializedUsage = new AnalyticsFeatureSetUsage(out.bytes().streamInput());
112112
assertTrue(serializedUsage.enabled());
113113
verify(client, times(1)).execute(any(), any(), any());
114114
verifyNoMoreInteractions(client);

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/CCRInfoTransportAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.elasticsearch.license.XPackLicenseState;
1717
import org.elasticsearch.transport.TransportService;
1818
import org.elasticsearch.xcontent.XContentBuilder;
19-
import org.elasticsearch.xpack.core.XPackFeatureSet;
19+
import org.elasticsearch.xpack.core.XPackFeatureUsage;
2020
import org.elasticsearch.xpack.core.XPackField;
2121
import org.elasticsearch.xpack.core.XPackSettings;
2222
import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction;
@@ -58,7 +58,7 @@ public boolean enabled() {
5858
return enabled;
5959
}
6060

61-
public static class Usage extends XPackFeatureSet.Usage {
61+
public static class Usage extends XPackFeatureUsage {
6262

6363
private final int numberOfFollowerIndices;
6464
private final int numberOfAutoFollowPatterns;

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
import org.elasticsearch.xpack.ccr.rest.RestResumeAutoFollowPatternAction;
9393
import org.elasticsearch.xpack.ccr.rest.RestResumeFollowAction;
9494
import org.elasticsearch.xpack.ccr.rest.RestUnfollowAction;
95-
import org.elasticsearch.xpack.core.XPackFeatureSet;
95+
import org.elasticsearch.xpack.core.XPackFeatureUsage;
9696
import org.elasticsearch.xpack.core.XPackField;
9797
import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction;
9898
import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
@@ -306,7 +306,7 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
306306
),
307307

308308
// usage api
309-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.CCR, CCRInfoTransportAction.Usage::new)
309+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.CCR, CCRInfoTransportAction.Usage::new)
310310
);
311311
}
312312

x-pack/plugin/core/src/internalClusterTest/java/org/elasticsearch/xpack/core/rest/action/XPackUsageRestCancellationIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.elasticsearch.transport.TransportService;
3535
import org.elasticsearch.transport.netty4.Netty4Plugin;
3636
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
37-
import org.elasticsearch.xpack.core.XPackFeatureSet;
37+
import org.elasticsearch.xpack.core.XPackFeatureUsage;
3838
import org.elasticsearch.xpack.core.action.TransportXPackUsageAction;
3939
import org.elasticsearch.xpack.core.action.XPackUsageAction;
4040
import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse;
@@ -168,7 +168,7 @@ protected void masterOperation(
168168
) throws Exception {
169169
blockingXPackUsageActionExecuting.countDown();
170170
blockActionLatch.await();
171-
listener.onResponse(new XPackUsageFeatureResponse(new XPackFeatureSet.Usage("test", false, false) {
171+
listener.onResponse(new XPackUsageFeatureResponse(new XPackFeatureUsage("test", false, false) {
172172
@Override
173173
public TransportVersion getMinimalSupportedVersion() {
174174
return TransportVersion.current();

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/HealthApiFeatureSetUsage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
* "enabled": true
7272
* }
7373
*/
74-
public class HealthApiFeatureSetUsage extends XPackFeatureSet.Usage {
74+
public class HealthApiFeatureSetUsage extends XPackFeatureUsage {
7575

7676
private final Map<String, Object> usageStats;
7777

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/RemoteClusterFeatureSetUsage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import java.io.IOException;
1818
import java.util.List;
1919

20-
public class RemoteClusterFeatureSetUsage extends XPackFeatureSet.Usage {
20+
public class RemoteClusterFeatureSetUsage extends XPackFeatureUsage {
2121

2222
private final List<RemoteConnectionInfo> remoteConnectionInfos;
2323

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackClientPlugin.java

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,19 @@ public List<Setting<?>> getSettings() {
136136
public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
137137
return Stream.of(
138138
// graph
139-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.GRAPH, GraphFeatureSetUsage::new),
139+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.GRAPH, GraphFeatureSetUsage::new),
140140
// logstash
141-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.LOGSTASH, LogstashFeatureSetUsage::new),
141+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.LOGSTASH, LogstashFeatureSetUsage::new),
142142
// ML
143-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.MACHINE_LEARNING, MachineLearningFeatureSetUsage::new),
143+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.MACHINE_LEARNING, MachineLearningFeatureSetUsage::new),
144144
// inference
145-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.INFERENCE, InferenceFeatureSetUsage::new),
145+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.INFERENCE, InferenceFeatureSetUsage::new),
146146
// monitoring
147-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.MONITORING, MonitoringFeatureSetUsage::new),
147+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.MONITORING, MonitoringFeatureSetUsage::new),
148148
// security
149149
new NamedWriteableRegistry.Entry(ClusterState.Custom.class, TokenMetadata.TYPE, TokenMetadata::new),
150150
new NamedWriteableRegistry.Entry(NamedDiff.class, TokenMetadata.TYPE, TokenMetadata::readDiffFrom),
151-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.SECURITY, SecurityFeatureSetUsage::new),
151+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.SECURITY, SecurityFeatureSetUsage::new),
152152
// security : configurable cluster privileges
153153
new NamedWriteableRegistry.Entry(
154154
ConfigurableClusterPrivilege.class,
@@ -180,20 +180,20 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
180180
RemoteClusterPermissionGroup::new
181181
),
182182
// eql
183-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.EQL, EqlFeatureSetUsage::new),
183+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.EQL, EqlFeatureSetUsage::new),
184184
// esql
185-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.ESQL, EsqlFeatureSetUsage::new),
185+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.ESQL, EsqlFeatureSetUsage::new),
186186
// sql
187-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.SQL, SqlFeatureSetUsage::new),
187+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.SQL, SqlFeatureSetUsage::new),
188188
// watcher
189189
new NamedWriteableRegistry.Entry(Metadata.Custom.class, WatcherMetadata.TYPE, WatcherMetadata::new),
190190
new NamedWriteableRegistry.Entry(NamedDiff.class, WatcherMetadata.TYPE, WatcherMetadata::readDiffFrom),
191-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.WATCHER, WatcherFeatureSetUsage::new),
191+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.WATCHER, WatcherFeatureSetUsage::new),
192192
// licensing
193193
new NamedWriteableRegistry.Entry(Metadata.Custom.class, LicensesMetadata.TYPE, LicensesMetadata::new),
194194
new NamedWriteableRegistry.Entry(NamedDiff.class, LicensesMetadata.TYPE, LicensesMetadata::readDiffFrom),
195195
// rollup
196-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.ROLLUP, RollupFeatureSetUsage::new),
196+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.ROLLUP, RollupFeatureSetUsage::new),
197197
new NamedWriteableRegistry.Entry(PersistentTaskParams.class, RollupJob.NAME, RollupJob::new),
198198
new NamedWriteableRegistry.Entry(Task.Status.class, RollupJobStatus.NAME, RollupJobStatus::new),
199199
new NamedWriteableRegistry.Entry(PersistentTaskState.class, RollupJobStatus.NAME, RollupJobStatus::new),
@@ -207,9 +207,9 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
207207
in -> AutoFollowMetadata.readDiffFrom(Metadata.Custom.class, AutoFollowMetadata.TYPE, in)
208208
),
209209
// ILM
210-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.INDEX_LIFECYCLE, IndexLifecycleFeatureSetUsage::new),
210+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.INDEX_LIFECYCLE, IndexLifecycleFeatureSetUsage::new),
211211
// SLM
212-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.SNAPSHOT_LIFECYCLE, SLMFeatureSetUsage::new),
212+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.SNAPSHOT_LIFECYCLE, SLMFeatureSetUsage::new),
213213
// ILM - Custom Metadata
214214
new NamedWriteableRegistry.Entry(Metadata.Custom.class, IndexLifecycleMetadata.TYPE, IndexLifecycleMetadata::new),
215215
new NamedWriteableRegistry.Entry(
@@ -247,7 +247,7 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
247247
// Transforms
248248
new NamedWriteableRegistry.Entry(Metadata.Custom.class, TransformMetadata.TYPE, TransformMetadata::new),
249249
new NamedWriteableRegistry.Entry(NamedDiff.class, TransformMetadata.TYPE, TransformMetadata.TransformMetadataDiff::new),
250-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.TRANSFORM, TransformFeatureSetUsage::new),
250+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.TRANSFORM, TransformFeatureSetUsage::new),
251251
new NamedWriteableRegistry.Entry(PersistentTaskParams.class, TransformField.TASK_NAME, TransformTaskParams::new),
252252
new NamedWriteableRegistry.Entry(Task.Status.class, TransformField.TASK_NAME, TransformState::new),
253253
new NamedWriteableRegistry.Entry(PersistentTaskState.class, TransformField.TASK_NAME, TransformState::new),
@@ -263,48 +263,44 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
263263
i -> NullRetentionPolicyConfig.INSTANCE
264264
),
265265
// Voting Only Node
266-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.VOTING_ONLY, VotingOnlyNodeFeatureSetUsage::new),
266+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.VOTING_ONLY, VotingOnlyNodeFeatureSetUsage::new),
267267
// Frozen indices
268-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.FROZEN_INDICES, FrozenIndicesFeatureSetUsage::new),
268+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.FROZEN_INDICES, FrozenIndicesFeatureSetUsage::new),
269269
// Spatial
270-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.SPATIAL, SpatialFeatureSetUsage::new),
270+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.SPATIAL, SpatialFeatureSetUsage::new),
271271
// Analytics
272-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.ANALYTICS, AnalyticsFeatureSetUsage::new),
272+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.ANALYTICS, AnalyticsFeatureSetUsage::new),
273273
// Aggregate metric field type
274-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.AGGREGATE_METRIC, AggregateMetricFeatureSetUsage::new),
274+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.AGGREGATE_METRIC, AggregateMetricFeatureSetUsage::new),
275275
// Enrich
276-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.ENRICH, EnrichFeatureSetUsage::new),
276+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.ENRICH, EnrichFeatureSetUsage::new),
277277
new NamedWriteableRegistry.Entry(Task.Status.class, ExecuteEnrichPolicyStatus.NAME, ExecuteEnrichPolicyStatus::new),
278278
// Searchable snapshots
279279
new NamedWriteableRegistry.Entry(
280-
XPackFeatureSet.Usage.class,
280+
XPackFeatureUsage.class,
281281
XPackField.SEARCHABLE_SNAPSHOTS,
282282
SearchableSnapshotFeatureSetUsage::new
283283
),
284284
// Data Streams
285-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.DATA_STREAMS, DataStreamFeatureSetUsage::new),
285+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.DATA_STREAMS, DataStreamFeatureSetUsage::new),
286286
new NamedWriteableRegistry.Entry(
287-
XPackFeatureSet.Usage.class,
287+
XPackFeatureUsage.class,
288288
XPackField.DATA_STREAM_LIFECYCLE,
289289
DataStreamLifecycleFeatureSetUsage::new
290290
),
291291
// Data Tiers
292-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.DATA_TIERS, DataTiersFeatureSetUsage::new),
292+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.DATA_TIERS, DataTiersFeatureSetUsage::new),
293293
// Archive
294-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.ARCHIVE, ArchiveFeatureSetUsage::new),
294+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.ARCHIVE, ArchiveFeatureSetUsage::new),
295295
// TSDB Downsampling
296296
new NamedWriteableRegistry.Entry(LifecycleAction.class, DownsampleAction.NAME, DownsampleAction::new),
297297
// Health API usage
298-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.HEALTH_API, HealthApiFeatureSetUsage::new),
298+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.HEALTH_API, HealthApiFeatureSetUsage::new),
299299
// Remote cluster usage
300-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.REMOTE_CLUSTERS, RemoteClusterFeatureSetUsage::new),
300+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.REMOTE_CLUSTERS, RemoteClusterFeatureSetUsage::new),
301301
// Enterprise Search
302-
new NamedWriteableRegistry.Entry(
303-
XPackFeatureSet.Usage.class,
304-
XPackField.ENTERPRISE_SEARCH,
305-
EnterpriseSearchFeatureSetUsage::new
306-
),
307-
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.UNIVERSAL_PROFILING, ProfilingUsage::new),
302+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.ENTERPRISE_SEARCH, EnterpriseSearchFeatureSetUsage::new),
303+
new NamedWriteableRegistry.Entry(XPackFeatureUsage.class, XPackField.UNIVERSAL_PROFILING, ProfilingUsage::new),
308304
new NamedWriteableRegistry.Entry(
309305
PersistentTaskParams.class,
310306
SecurityMigrationTaskParams.TASK_NAME,

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackFeatureSet.java

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

0 commit comments

Comments
 (0)