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 2020import java .util .Set ;
2121
2222/**
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}.
2425 */
2526public class FeatureService {
2627
@@ -36,6 +37,10 @@ public class FeatureService {
3637 private final NavigableMap <Version , Set <String >> historicalFeatures ;
3738 private final Map <String , NodeFeature > nodeFeatures ;
3839
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+ */
3944 public FeatureService (List <? extends FeatureSpecification > specs ) {
4045
4146 var featureData = FeatureData .createFromSpecifications (specs );
@@ -47,6 +52,7 @@ public FeatureService(List<? extends FeatureSpecification> specs) {
4752
4853 /**
4954 * The non-historical features supported by this node.
55+ * @return Map of {@code feature-id} to its declaring {@code NodeFeature} object.
5056 */
5157 public Map <String , NodeFeature > getNodeFeatures () {
5258 return nodeFeatures ;
Original file line number Diff line number Diff line change 1515
1616/**
1717 * 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.
1829 */
1930public interface FeatureSpecification {
2031 /**
@@ -25,7 +36,8 @@ default Set<NodeFeature> getFeatures() {
2536 }
2637
2738 /**
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.
2941 */
3042 default Map <NodeFeature , Version > getHistoricalFeatures () {
3143 return Map .of ();
You can’t perform that action at this time.
0 commit comments