-
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.
interim changes - integration with Auxiliary Transport
Signed-off-by: Rishabh Maurya <[email protected]>
- Loading branch information
1 parent
69e9a97
commit d300467
Showing
22 changed files
with
1,058 additions
and
160 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
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
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
45 changes: 45 additions & 0 deletions
45
...rrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/api/FlightServerInfoAction.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,45 @@ | ||
/* | ||
* 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.arrow.flight.api; | ||
|
||
import org.opensearch.client.node.NodeClient; | ||
import org.opensearch.rest.BaseRestHandler; | ||
import org.opensearch.rest.RestRequest; | ||
import org.opensearch.rest.action.RestToXContentListener; | ||
|
||
import java.util.List; | ||
|
||
import static org.opensearch.rest.RestRequest.Method.GET; | ||
|
||
public class FlightServerInfoAction extends BaseRestHandler { | ||
|
||
public FlightServerInfoAction() {} | ||
|
||
@Override | ||
public String getName() { | ||
return "flight_server_info_action"; | ||
} | ||
|
||
@Override | ||
public List<Route> routes() { | ||
return List.of(new Route(GET, "/_flight/info"), new Route(GET, "/_flight/info/{nodeId}")); | ||
} | ||
|
||
@Override | ||
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) { | ||
String nodeId = request.param("nodeId"); | ||
if (nodeId != null) { | ||
// Query specific node | ||
NodesFlightInfoRequest nodesRequest = new NodesFlightInfoRequest(nodeId); | ||
return channel -> client.execute(NodesFlightInfoAction.INSTANCE, nodesRequest, new RestToXContentListener<>(channel)); | ||
} else { | ||
NodesFlightInfoRequest nodesRequest = new NodesFlightInfoRequest(); | ||
return channel -> client.execute(NodesFlightInfoAction.INSTANCE, nodesRequest, new RestToXContentListener<>(channel)); | ||
} | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
modules/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/api/NodeFlightInfo.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,70 @@ | ||
/* | ||
* 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.arrow.flight.api; | ||
|
||
import org.opensearch.action.support.nodes.BaseNodeResponse; | ||
import org.opensearch.cluster.node.DiscoveryNode; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
import org.opensearch.core.common.io.stream.StreamOutput; | ||
import org.opensearch.core.common.transport.BoundTransportAddress; | ||
import org.opensearch.core.common.transport.TransportAddress; | ||
import org.opensearch.core.xcontent.ToXContent; | ||
import org.opensearch.core.xcontent.ToXContentObject; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
|
||
public class NodeFlightInfo extends BaseNodeResponse implements ToXContentObject { | ||
private final BoundTransportAddress boundAddress; | ||
|
||
public NodeFlightInfo(StreamInput in) throws IOException { | ||
super(in); | ||
boundAddress = new BoundTransportAddress(in); | ||
} | ||
|
||
public NodeFlightInfo(DiscoveryNode node, BoundTransportAddress boundAddress) { | ||
super(node); | ||
this.boundAddress = boundAddress; | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
boundAddress.writeTo(out); | ||
} | ||
|
||
public BoundTransportAddress getBoundAddress() { | ||
return boundAddress; | ||
} | ||
|
||
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException { | ||
builder.startObject(); | ||
builder.startObject("flight_server"); | ||
|
||
builder.startArray("bound_addresses"); | ||
for (TransportAddress address : boundAddress.boundAddresses()) { | ||
builder.startObject(); | ||
builder.field("host", address.address().getHostString()); | ||
builder.field("port", address.address().getPort()); | ||
builder.endObject(); | ||
} | ||
builder.endArray(); | ||
|
||
TransportAddress publishAddress = boundAddress.publishAddress(); | ||
builder.startObject("publish_address"); | ||
builder.field("host", publishAddress.address().getHostString()); | ||
builder.field("port", publishAddress.address().getPort()); | ||
builder.endObject(); | ||
|
||
builder.endObject(); | ||
builder.endObject(); | ||
return builder; | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/api/NodesFlightInfoAction.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,20 @@ | ||
/* | ||
* 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.arrow.flight.api; | ||
|
||
import org.opensearch.action.ActionType; | ||
|
||
public class NodesFlightInfoAction extends ActionType<NodesFlightInfoResponse> { | ||
public static final NodesFlightInfoAction INSTANCE = new NodesFlightInfoAction(); | ||
public static final String NAME = "cluster:admin/flight/info"; | ||
|
||
private NodesFlightInfoAction() { | ||
super(NAME, NodesFlightInfoResponse::new); | ||
} | ||
} |
Oops, something went wrong.