-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge first batch of feature/extensions into main (#5347)
* Merge first batch of feature/extensions into main Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Fixed CHANGELOG Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Fixed newline errors Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Renaming and CHANGELOG fixes Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Refactor extension loading into private method Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Removed skipValidation and added connectToExtensionNode method Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Remove unnecessary feature flag calls Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Renaming and exception handling Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Change latches to CompletableFuture Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Removed unnecessary validateSettingKey call Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Fix azure-core dependency Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Update SHAs Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Remove unintended dependency changes Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Removed dynamic settings regitration, removed info() method, and added NoopExtensionsManager Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Add javadoc Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Fixed spotless failure Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Removed NoopExtensionsManager Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Added functioning NoopExtensionsManager Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Added missing javadoc Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Remove forbiddenAPI Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Fix spotless Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Change logger.info to logger.error in handleException Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Fix ExtensionsManagerTests Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Removing unrelated change Signed-off-by: Ryan Bogan <rbogan@amazon.com> * Update SHAs Signed-off-by: Ryan Bogan <rbogan@amazon.com> Signed-off-by: Ryan Bogan <rbogan@amazon.com>
- Loading branch information
Showing
29 changed files
with
2,070 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
server/src/main/java/org/opensearch/cluster/ClusterSettingsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.cluster; | ||
|
||
import org.opensearch.cluster.service.ClusterService; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.transport.TransportResponse; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
/** | ||
* PluginSettings Response for Extensibility | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class ClusterSettingsResponse extends TransportResponse { | ||
private final Settings clusterSettings; | ||
|
||
public ClusterSettingsResponse(ClusterService clusterService) { | ||
this.clusterSettings = clusterService.getSettings(); | ||
} | ||
|
||
public ClusterSettingsResponse(StreamInput in) throws IOException { | ||
super(in); | ||
this.clusterSettings = Settings.readSettingsFromStream(in); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
Settings.writeSettingsToStream(clusterSettings, out); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ClusterSettingsResponse{" + "clusterSettings=" + clusterSettings + '}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ClusterSettingsResponse that = (ClusterSettingsResponse) o; | ||
return Objects.equals(clusterSettings, that.clusterSettings); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(clusterSettings); | ||
} | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
server/src/main/java/org/opensearch/cluster/LocalNodeResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.cluster; | ||
|
||
import org.opensearch.cluster.node.DiscoveryNode; | ||
import org.opensearch.cluster.service.ClusterService; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.transport.TransportResponse; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
/** | ||
* LocalNode Response for Extensibility | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class LocalNodeResponse extends TransportResponse { | ||
private final DiscoveryNode localNode; | ||
|
||
public LocalNodeResponse(ClusterService clusterService) { | ||
this.localNode = clusterService.localNode(); | ||
} | ||
|
||
public LocalNodeResponse(StreamInput in) throws IOException { | ||
super(in); | ||
this.localNode = new DiscoveryNode(in); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
this.localNode.writeTo(out); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "LocalNodeResponse{" + "localNode=" + localNode + '}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
LocalNodeResponse that = (LocalNodeResponse) o; | ||
return Objects.equals(localNode, that.localNode); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(localNode); | ||
} | ||
|
||
} |
76 changes: 76 additions & 0 deletions
76
server/src/main/java/org/opensearch/discovery/PluginRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.discovery; | ||
|
||
import org.opensearch.cluster.node.DiscoveryNode; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.extensions.DiscoveryExtensionNode; | ||
import org.opensearch.transport.TransportRequest; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* PluginRequest to intialize plugin | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class PluginRequest extends TransportRequest { | ||
private final DiscoveryNode sourceNode; | ||
/* | ||
* TODO change DiscoveryNode to Extension information | ||
*/ | ||
private final List<DiscoveryExtensionNode> extensions; | ||
|
||
public PluginRequest(DiscoveryNode sourceNode, List<DiscoveryExtensionNode> extensions) { | ||
this.sourceNode = sourceNode; | ||
this.extensions = extensions; | ||
} | ||
|
||
public PluginRequest(StreamInput in) throws IOException { | ||
super(in); | ||
sourceNode = new DiscoveryNode(in); | ||
extensions = in.readList(DiscoveryExtensionNode::new); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
sourceNode.writeTo(out); | ||
out.writeList(extensions); | ||
} | ||
|
||
public List<DiscoveryExtensionNode> getExtensions() { | ||
return extensions; | ||
} | ||
|
||
public DiscoveryNode getSourceNode() { | ||
return sourceNode; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "PluginRequest{" + "sourceNode=" + sourceNode + ", extensions=" + extensions + '}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
PluginRequest that = (PluginRequest) o; | ||
return Objects.equals(sourceNode, that.sourceNode) && Objects.equals(extensions, that.extensions); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(sourceNode, extensions); | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
server/src/main/java/org/opensearch/discovery/PluginResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
package org.opensearch.discovery; | ||
|
||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.transport.TransportResponse; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
/** | ||
* PluginResponse to intialize plugin | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class PluginResponse extends TransportResponse { | ||
private String name; | ||
|
||
public PluginResponse(String name) { | ||
this.name = name; | ||
} | ||
|
||
public PluginResponse(StreamInput in) throws IOException { | ||
name = in.readString(); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
out.writeString(name); | ||
} | ||
|
||
/** | ||
* @return the node that is currently leading, according to the responding node. | ||
*/ | ||
|
||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "PluginResponse{" + "name" + name + "}"; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
PluginResponse that = (PluginResponse) o; | ||
return Objects.equals(name, that.name); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.