-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RemoteIndexClient initial implementation, its accompanying dependencies, and Build Request, Retry Strategy, and test files
- Loading branch information
1 parent
edcbe31
commit 57290c1
Showing
7 changed files
with
557 additions
and
4 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
51 changes: 51 additions & 0 deletions
51
src/main/java/org/opensearch/knn/index/remote/RemoteBuildRequest.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,51 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.knn.index.remote; | ||
|
||
import org.opensearch.common.xcontent.json.JsonXContent; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@Builder | ||
@Getter | ||
public class RemoteBuildRequest { | ||
private final String repositoryType; | ||
private final String containerName; | ||
private final String objectPath; | ||
private final String tenantId; | ||
private final int dimension; | ||
private final int docCount; | ||
private final String dataType; | ||
private final String engine; | ||
private final String algorithm; | ||
@Builder.Default | ||
private final Map<String, Object> indexParameters = new HashMap<>(); | ||
|
||
// TODO: Add type checking to all parameters, add individual methods (e.g. setEfConstruction) to check index params | ||
|
||
public String toJson() throws IOException { | ||
try (XContentBuilder builder = JsonXContent.contentBuilder()) { | ||
builder.startObject(); | ||
builder.field("repository_type", repositoryType); | ||
builder.field("container_name", containerName); | ||
builder.field("object_path", objectPath); | ||
builder.field("tenant_id", tenantId); | ||
builder.field("dimension", dimension); | ||
builder.field("doc_count", docCount); | ||
builder.field("data_type", dataType); | ||
builder.field("engine", engine); | ||
builder.field("index_parameters", indexParameters); | ||
builder.endObject(); | ||
return builder.toString(); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.