forked from opensearch-project/k-NN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor, add remote build request interface, complete FAISS request …
…parameters, secure setting testing Signed-off-by: owenhalpert <ohalpert@gmail.com>
- Loading branch information
1 parent
e439c84
commit dbddb29
Showing
18 changed files
with
619 additions
and
351 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
15 changes: 15 additions & 0 deletions
15
src/main/java/org/opensearch/knn/index/codec/nativeindex/remote/RemoteStatusResponse.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,15 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.knn.index.codec.nativeindex.remote; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class RemoteStatusResponse { | ||
private String indexPath; | ||
} |
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
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
65 changes: 65 additions & 0 deletions
65
src/main/java/org/opensearch/knn/index/remote/HTTPRemoteBuildRequest.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,65 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.knn.index.remote; | ||
|
||
import lombok.Getter; | ||
import org.opensearch.cluster.metadata.RepositoryMetadata; | ||
import org.opensearch.common.xcontent.json.JsonXContent; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
import org.opensearch.index.IndexSettings; | ||
import org.opensearch.knn.index.KNNSettings; | ||
import org.opensearch.knn.index.codec.nativeindex.model.BuildIndexParams; | ||
|
||
import java.io.IOException; | ||
import java.net.URI; | ||
|
||
import static org.opensearch.knn.common.KNNConstants.CONTAINER_NAME; | ||
import static org.opensearch.knn.common.KNNConstants.DIMENSION; | ||
import static org.opensearch.knn.common.KNNConstants.DOC_COUNT; | ||
import static org.opensearch.knn.common.KNNConstants.VECTOR_PATH; | ||
import static org.opensearch.knn.common.KNNConstants.DOC_ID_PATH; | ||
import static org.opensearch.knn.common.KNNConstants.INDEX_PARAMETERS; | ||
import static org.opensearch.knn.common.KNNConstants.KNN_ENGINE; | ||
import static org.opensearch.knn.common.KNNConstants.REPOSITORY_TYPE; | ||
import static org.opensearch.knn.common.KNNConstants.TENANT_ID; | ||
import static org.opensearch.knn.common.KNNConstants.VECTOR_DATA_TYPE_FIELD; | ||
import static org.opensearch.knn.index.KNNSettings.KNN_REMOTE_BUILD_SERVICE_ENDPOINT_SETTING; | ||
|
||
/** | ||
* RemoteBuildRequest implementation for HTTP clients that sets the endpoint and offers a JSON conversion. | ||
*/ | ||
@Getter | ||
public class HTTPRemoteBuildRequest extends RemoteBuildRequest { | ||
private final URI endpoint; | ||
|
||
public HTTPRemoteBuildRequest( | ||
IndexSettings indexSettings, | ||
BuildIndexParams indexInfo, | ||
RepositoryMetadata repositoryMetadata, | ||
String blobName | ||
) throws IOException { | ||
super(indexSettings, indexInfo, repositoryMetadata, blobName); | ||
this.endpoint = URI.create(KNNSettings.state().getSettingValue(KNN_REMOTE_BUILD_SERVICE_ENDPOINT_SETTING.getKey())); | ||
} | ||
|
||
public String toJson() throws IOException { | ||
try (XContentBuilder builder = JsonXContent.contentBuilder()) { | ||
builder.startObject(); | ||
builder.field(REPOSITORY_TYPE, repositoryType); | ||
builder.field(CONTAINER_NAME, containerName); | ||
builder.field(VECTOR_PATH, vectorPath); | ||
builder.field(DOC_ID_PATH, docIdPath); | ||
builder.field(TENANT_ID, tenantId); | ||
builder.field(DIMENSION, dimension); | ||
builder.field(DOC_COUNT, docCount); | ||
builder.field(VECTOR_DATA_TYPE_FIELD, dataType); | ||
builder.field(KNN_ENGINE, engine); | ||
builder.field(INDEX_PARAMETERS, indexParameters); | ||
builder.endObject(); | ||
return builder.toString(); | ||
} | ||
} | ||
} |
Oops, something went wrong.