Skip to content

Commit

Permalink
Remove BaseShardResponse as it'll be pushed later
Browse files Browse the repository at this point in the history
Signed-off-by: Aman Khare <[email protected]>
  • Loading branch information
Aman Khare committed Mar 14, 2024
1 parent 85faccc commit 776f625
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 63 deletions.
51 changes: 0 additions & 51 deletions server/src/main/java/org/opensearch/gateway/BaseShardResponse.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.opensearch.core.index.shard.ShardId;
import org.opensearch.env.NodeEnvironment;
import org.opensearch.gateway.AsyncShardFetch;
import org.opensearch.gateway.BaseShardResponse;
import org.opensearch.index.store.Store;
import org.opensearch.indices.IndicesService;
import org.opensearch.indices.store.TransportNodesListShardStoreMetadataHelper.StoreFilesMetadata;
Expand Down Expand Up @@ -239,43 +238,48 @@ protected void writeNodesTo(StreamOutput out, List<NodeStoreFilesMetadataBatch>
*
* @opensearch.internal
*/
public static class NodeStoreFilesMetadata extends BaseShardResponse {
public static class NodeStoreFilesMetadata {

private StoreFilesMetadata storeFilesMetadata;
private Exception storeFileFetchException;

@Override
public boolean isEmpty() {
return storeFilesMetadata == null || storeFilesMetadata().isEmpty() && getException() == null;
public NodeStoreFilesMetadata(StoreFilesMetadata storeFilesMetadata) {
this.storeFilesMetadata = storeFilesMetadata;
this.storeFileFetchException = null;
}

public NodeStoreFilesMetadata(StreamInput in) throws IOException {
super(in);
storeFilesMetadata = new StoreFilesMetadata(in);
if (in.readBoolean()) {
this.storeFilesMetadata = new StoreFilesMetadata(in);
this.storeFileFetchException = in.readException();
} else {
this.storeFilesMetadata = null;
this.storeFileFetchException = null;
}
}

public NodeStoreFilesMetadata(StoreFilesMetadata storeFilesMetadata, Exception storeFileFetchException) {
super(storeFileFetchException);
this.storeFilesMetadata = storeFilesMetadata;
this.storeFileFetchException = storeFileFetchException;
}

public StoreFilesMetadata storeFilesMetadata() {
return storeFilesMetadata;
}

public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (storeFilesMetadata != null) {
storeFilesMetadata.writeTo(out);
if (storeFileFetchException != null) {
out.writeBoolean(true);
storeFilesMetadata.writeTo(out);
out.writeException(storeFileFetchException);
} else {
out.writeBoolean(false);
}
}

public Exception getStoreFileFetchException() {
return storeFileFetchException;
}

@Override
public String toString() {
return "[[" + storeFilesMetadata + "]]";
Expand Down

0 comments on commit 776f625

Please sign in to comment.