Skip to content

Commit

Permalink
Rename ExtensionBooleanResponse to AcknowledgedResponse
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Bogan <rbogan@amazon.com>
  • Loading branch information
ryanbogan committed Dec 16, 2022
1 parent e5ed171 commit 563f760
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
*
* @opensearch.internal
*/
public class ExtensionBooleanResponse extends TransportResponse {
public class AcknowledgedResponse extends TransportResponse {

private final boolean status;

/**
* @param status Boolean indicating the status of the parse request sent to the SDK
*/
public ExtensionBooleanResponse(boolean status) {
public AcknowledgedResponse(boolean status) {
this.status = status;
}

public ExtensionBooleanResponse(StreamInput in) throws IOException {
public AcknowledgedResponse(StreamInput in) throws IOException {
super(in);
this.status = in.readBoolean();
}
Expand All @@ -42,14 +42,14 @@ public void writeTo(StreamOutput out) throws IOException {

@Override
public String toString() {
return "ExtensionBooleanResponse{" + "status=" + this.status + "}";
return "AcknowledgedResponse{" + "status=" + this.status + "}";
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ExtensionBooleanResponse that = (ExtensionBooleanResponse) o;
AcknowledgedResponse that = (AcknowledgedResponse) o;
return Objects.equals(this.status, that.status);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public String executor() {
* Handles a {@link RegisterTransportActionsRequest}.
*
* @param transportActionsRequest The request to handle.
* @return A {@link ExtensionBooleanResponse} indicating success.
* @return A {@link AcknowledgedResponse} indicating success.
* @throws Exception if the request is not handled properly.
*/
TransportResponse handleRegisterTransportActionsRequest(RegisterTransportActionsRequest transportActionsRequest) throws Exception {
Expand All @@ -338,7 +338,7 @@ TransportResponse handleRegisterTransportActionsRequest(RegisterTransportActions
* Register these new Transport Actions with ActionModule
* and add support for NodeClient to recognise these actions when making transport calls.
*/
return new ExtensionBooleanResponse(true);
return new AcknowledgedResponse(true);
}

/**
Expand Down Expand Up @@ -370,11 +370,11 @@ public void onIndexModule(IndexModule indexModule) throws UnknownHostException {
private void onIndexModule(IndexModule indexModule, DiscoveryNode extensionNode) throws UnknownHostException {
logger.info("onIndexModule index:" + indexModule.getIndex());
final CompletableFuture<IndicesModuleResponse> inProgressFuture = new CompletableFuture<>();
final CompletableFuture<ExtensionBooleanResponse> inProgressIndexNameFuture = new CompletableFuture<>();
final TransportResponseHandler<ExtensionBooleanResponse> extensionBooleanResponseHandler = new TransportResponseHandler<
ExtensionBooleanResponse>() {
final CompletableFuture<AcknowledgedResponse> inProgressIndexNameFuture = new CompletableFuture<>();
final TransportResponseHandler<AcknowledgedResponse> acknowledgedResponseHandler = new TransportResponseHandler<
AcknowledgedResponse>() {
@Override
public void handleResponse(ExtensionBooleanResponse response) {
public void handleResponse(AcknowledgedResponse response) {
logger.info("ACK Response" + response);
inProgressIndexNameFuture.complete(response);
}
Expand All @@ -390,8 +390,8 @@ public String executor() {
}

@Override
public ExtensionBooleanResponse read(StreamInput in) throws IOException {
return new ExtensionBooleanResponse(in);
public AcknowledgedResponse read(StreamInput in) throws IOException {
return new AcknowledgedResponse(in);
}

};
Expand Down Expand Up @@ -423,7 +423,7 @@ public void beforeIndexRemoved(
extensionNode,
INDICES_EXTENSION_NAME_ACTION_NAME,
new IndicesModuleRequest(indexModule),
extensionBooleanResponseHandler
acknowledgedResponseHandler
);
// TODO: make asynchronous
inProgressIndexNameFuture.get(100, TimeUnit.SECONDS);
Expand Down

0 comments on commit 563f760

Please sign in to comment.