From 2d6cff5b69af56004de813be87f4f182c346ffce Mon Sep 17 00:00:00 2001 From: Yury Fridlyand Date: Tue, 9 Aug 2022 11:36:48 -0700 Subject: [PATCH] Recover `MasterEligible`, but mark it is obsolete. Signed-off-by: Yury Fridlyand --- src/OpenSearch.Net.VirtualizedCluster/VirtualCluster.cs | 6 ++++++ src/OpenSearch.Net/ConnectionPool/Node.cs | 7 +++++++ src/OpenSearch.Net/Responses/Sniff/SniffResponse.cs | 2 ++ 3 files changed, 15 insertions(+) diff --git a/src/OpenSearch.Net.VirtualizedCluster/VirtualCluster.cs b/src/OpenSearch.Net.VirtualizedCluster/VirtualCluster.cs index 57166877b5..29805afa4d 100644 --- a/src/OpenSearch.Net.VirtualizedCluster/VirtualCluster.cs +++ b/src/OpenSearch.Net.VirtualizedCluster/VirtualCluster.cs @@ -76,6 +76,12 @@ public VirtualCluster ClusterManagerEligible(params int[] ports) return this; } + [Obsolete("Use ClusterManagerEligible instead", false)] + public VirtualCluster MasterEligible(params int[] ports) + { + return ClusterManagerEligible(ports); + } + public VirtualCluster StoresNoData(params int[] ports) { foreach (var node in _nodes.Where(n => ports.Contains(n.Uri.Port))) diff --git a/src/OpenSearch.Net/ConnectionPool/Node.cs b/src/OpenSearch.Net/ConnectionPool/Node.cs index d14bd0040f..2d6ca18eb5 100644 --- a/src/OpenSearch.Net/ConnectionPool/Node.cs +++ b/src/OpenSearch.Net/ConnectionPool/Node.cs @@ -77,8 +77,15 @@ public Node(Uri uri) /// Indicates whether this node is cluster_manager eligible, defaults to true when unknown/unspecified public bool ClusterManagerEligible { get; set; } + /// Renamed to as of OpenSearch 2.0 + [Obsolete("Use ClusterManagerEligible instead", false)] + public bool MasterEligible { get => ClusterManagerEligible; set => ClusterManagerEligible = value; } + public bool ClusterManagerOnlyNode => ClusterManagerEligible && !HoldsData; + [Obsolete("Use ClusterManagerOnlyNode instead", false)] + public bool MasterOnlyNode => ClusterManagerOnlyNode; + /// The name of the node, defaults to null when unknown/unspecified public string Name { get; set; } diff --git a/src/OpenSearch.Net/Responses/Sniff/SniffResponse.cs b/src/OpenSearch.Net/Responses/Sniff/SniffResponse.cs index 093b035128..903717b492 100644 --- a/src/OpenSearch.Net/Responses/Sniff/SniffResponse.cs +++ b/src/OpenSearch.Net/Responses/Sniff/SniffResponse.cs @@ -116,6 +116,8 @@ internal bool HttpEnabled internal bool IngestEnabled => roles?.Contains("ingest") ?? false; internal bool ClusterManagerEligible => (roles == null ? false : roles.Contains("master") || roles.Contains("cluster_manager")); + [Obsolete("Use ClusterManagerEligible instead", false)] + internal bool MasterEligible => ClusterManagerEligible; } internal class NodeInfoHttp