File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
server/src/main/java/org/elasticsearch/features Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 20
20
import java .util .Set ;
21
21
22
22
/**
23
- * Manages information on the features supported by nodes in the cluster
23
+ * Manages information on the features supported by nodes in the cluster.
24
+ * For more information, see {@link FeatureSpecification}.
24
25
*/
25
26
public class FeatureService {
26
27
@@ -36,6 +37,10 @@ public class FeatureService {
36
37
private final NavigableMap <Version , Set <String >> historicalFeatures ;
37
38
private final Map <String , NodeFeature > nodeFeatures ;
38
39
40
+ /**
41
+ * Creates a new {@code FeatureService}, reporting all the features declared in {@code specs}
42
+ * as the local node's supported feature set
43
+ */
39
44
public FeatureService (List <? extends FeatureSpecification > specs ) {
40
45
41
46
var featureData = FeatureData .createFromSpecifications (specs );
@@ -47,6 +52,7 @@ public FeatureService(List<? extends FeatureSpecification> specs) {
47
52
48
53
/**
49
54
* The non-historical features supported by this node.
55
+ * @return Map of {@code feature-id} to its declaring {@code NodeFeature} object.
50
56
*/
51
57
public Map <String , NodeFeature > getNodeFeatures () {
52
58
return nodeFeatures ;
Original file line number Diff line number Diff line change 15
15
16
16
/**
17
17
* Specifies one or more features that are supported by this node.
18
+ * <p>
19
+ * Features are published as part of node information in cluster state.
20
+ * Code can check if all nodes in a cluster support a feature using {@link FeatureService#clusterHasFeature}.
21
+ * Once all nodes in a cluster support a feature, other nodes are blocked from joining that cluster
22
+ * unless they also support that feature (this is known as the 'feature ratchet').
23
+ * So once a feature is supported by a cluster, it will always be supported by that cluster in the future.
24
+ * <p>
25
+ * The feature information in cluster state should not normally be directly accessed.
26
+ * All feature checks should be done through {@code FeatureService} to ensure that Elasticsearch's
27
+ * guarantees on the introduction of new functionality are followed;
28
+ * that is, new functionality is not enabled until all nodes in the cluster support it.
18
29
*/
19
30
public interface FeatureSpecification {
20
31
/**
@@ -25,7 +36,8 @@ default Set<NodeFeature> getFeatures() {
25
36
}
26
37
27
38
/**
28
- * Returns information on historical features that should be added to all nodes at or above the {@link Version} specified.
39
+ * Returns information on historical features that should be deemed to be present on all nodes
40
+ * on or above the {@link Version} specified.
29
41
*/
30
42
default Map <NodeFeature , Version > getHistoricalFeatures () {
31
43
return Map .of ();
You can’t perform that action at this time.
0 commit comments