-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
1,471 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<!-- | ||
~ Copyright (c) 2022-2023 nosqlbench | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>adapter-aws-opensearch</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<parent> | ||
<artifactId>mvn-defaults</artifactId> | ||
<groupId>io.nosqlbench</groupId> | ||
<version>${revision}</version> | ||
<relativePath>../mvn-defaults</relativePath> | ||
</parent> | ||
|
||
<name>${project.artifactId}</name> | ||
<description> | ||
A nosqlbench adapter for using AWS's SDK to manage opensearch services | ||
</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.nosqlbench</groupId> | ||
<artifactId>adapters-api</artifactId> | ||
<version>${revision}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
<!-- For managing AWS Open Search Services--> | ||
<!-- <dependency>--> | ||
<!-- <groupId>software.amazon.awssdk</groupId>--> | ||
<!-- <artifactId>opensearch</artifactId>--> | ||
<!-- <version>2.23.18</version>--> | ||
<!-- </dependency>--> | ||
<dependency> | ||
<groupId>io.nosqlbench</groupId> | ||
<artifactId>nb-annotations</artifactId> | ||
<version>${revision}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.opensearch.client</groupId> | ||
<artifactId>opensearch-java</artifactId> | ||
<version>2.8.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents.client5</groupId> | ||
<artifactId>httpclient5</artifactId> | ||
<version>5.2.1</version> | ||
</dependency> | ||
<!-- <dependency>--> | ||
<!-- <groupId>software.amazon.awssdk</groupId>--> | ||
<!-- <artifactId>http-client-spi</artifactId>--> | ||
<!-- <version>2.23.18</version>--> | ||
<!-- </dependency>--> | ||
<!-- <dependency>--> | ||
<!-- <groupId>software.amazon.awssdk</groupId>--> | ||
<!-- <artifactId>aws-sdk-java-pom</artifactId>--> | ||
<!-- <version>2.20.109</version>--> | ||
<!-- </dependency>--> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>http-client-spi</artifactId> | ||
<version>2.23.18</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>aws-crt-client</artifactId> | ||
<version>2.20.109</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>regions</artifactId> | ||
<version>2.23.18</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>software.amazon.awssdk</groupId> | ||
<artifactId>auth</artifactId> | ||
<version>2.23.19</version> | ||
</dependency> | ||
|
||
|
||
</dependencies> | ||
|
||
</project> | ||
|
22 changes: 22 additions & 0 deletions
22
adapter-aws-opensearch/src/main/java/io/nosqlbench/adapter/opensearch/AwsOsServiceType.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,22 @@ | ||
/* | ||
* Copyright (c) 2024 nosqlbench | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.nosqlbench.adapter.opensearch; | ||
|
||
public enum AwsOsServiceType { | ||
aoss, | ||
es | ||
} |
52 changes: 52 additions & 0 deletions
52
adapter-aws-opensearch/src/main/java/io/nosqlbench/adapter/opensearch/OpenSearchAdapter.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,52 @@ | ||
/* | ||
* Copyright (c) 2024 nosqlbench | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.nosqlbench.adapter.opensearch; | ||
|
||
import io.nosqlbench.adapters.api.activityimpl.OpMapper; | ||
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter; | ||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter; | ||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache; | ||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op; | ||
import io.nosqlbench.nb.annotations.Service; | ||
import io.nosqlbench.nb.api.components.core.NBComponent; | ||
import io.nosqlbench.nb.api.config.standard.NBConfigModel; | ||
import io.nosqlbench.nb.api.config.standard.NBConfiguration; | ||
import io.nosqlbench.nb.api.labels.NBLabels; | ||
|
||
import java.util.function.Function; | ||
|
||
@Service(value= DriverAdapter.class, selector = "opensearch") | ||
public class OpenSearchAdapter extends BaseDriverAdapter<Op,OpenSearchSpace> { | ||
public OpenSearchAdapter(NBComponent parentComponent, NBLabels labels) { | ||
super(parentComponent, labels); | ||
} | ||
|
||
@Override | ||
public Function<String, ? extends OpenSearchSpace> getSpaceInitializer(NBConfiguration cfg) { | ||
return (String spaceName) -> new OpenSearchSpace(cfg); | ||
} | ||
|
||
@Override | ||
public OpMapper<Op> getOpMapper() { | ||
return new OpenSearchOpMapper(this); | ||
} | ||
|
||
@Override | ||
public NBConfigModel getConfigModel() { | ||
return super.getConfigModel().add(OpenSearchSpace.getConfigModel()); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ws-opensearch/src/main/java/io/nosqlbench/adapter/opensearch/OpenSearchAdapterLoader.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,30 @@ | ||
/* | ||
* Copyright (c) 2024 nosqlbench | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.nosqlbench.adapter.opensearch; | ||
|
||
import io.nosqlbench.adapter.diag.DriverAdapterLoader; | ||
import io.nosqlbench.nb.annotations.Service; | ||
import io.nosqlbench.nb.api.components.core.NBComponent; | ||
import io.nosqlbench.nb.api.labels.NBLabels; | ||
|
||
@Service(value = DriverAdapterLoader.class,selector = "opensearch") | ||
public class OpenSearchAdapterLoader implements DriverAdapterLoader { | ||
@Override | ||
public OpenSearchAdapter load(NBComponent parent, NBLabels childLabels) { | ||
return new OpenSearchAdapter(parent, childLabels); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...ter-aws-opensearch/src/main/java/io/nosqlbench/adapter/opensearch/OpenSearchOpMapper.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,52 @@ | ||
/* | ||
* Copyright (c) 2024 nosqlbench | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.nosqlbench.adapter.opensearch; | ||
|
||
import io.nosqlbench.adapter.opensearch.dispensers.*; | ||
import io.nosqlbench.adapter.opensearch.ops.UpdateOp; | ||
import io.nosqlbench.adapters.api.activityimpl.OpDispenser; | ||
import io.nosqlbench.adapters.api.activityimpl.OpMapper; | ||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverSpaceCache; | ||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op; | ||
import io.nosqlbench.adapters.api.templating.ParsedOp; | ||
import io.nosqlbench.engine.api.templating.TypeAndTarget; | ||
import io.nosqlbench.nb.api.config.standard.NBConfiguration; | ||
import org.opensearch.client.opensearch.OpenSearchClient; | ||
|
||
public class OpenSearchOpMapper implements OpMapper<Op> { | ||
private final OpenSearchAdapter adapter; | ||
|
||
public OpenSearchOpMapper(OpenSearchAdapter openSearchAdapter) { | ||
this.adapter = openSearchAdapter; | ||
} | ||
|
||
@Override | ||
public OpDispenser<? extends Op> apply(ParsedOp op) { | ||
TypeAndTarget<OpenSearchOpTypes, String> typeAndTarget = | ||
op.getTypeAndTarget(OpenSearchOpTypes.class, String.class, "verb", "index"); | ||
return switch (typeAndTarget.enumId) { | ||
case create_index -> new CreateIndexOpDispenser(adapter, op, typeAndTarget.targetFunction); | ||
case delete_index -> new DeleteIndexOpDispenser(adapter, op, typeAndTarget.targetFunction); | ||
case index -> new IndexOpDispenser(adapter,op, typeAndTarget.targetFunction); | ||
case update -> new UpdateOpDispenser(adapter,op, typeAndTarget.targetFunction); | ||
case delete -> new DeleteOpDispenser(adapter,op, typeAndTarget.targetFunction); | ||
case knn_search -> new KnnSearchOpDispenser(adapter,op, typeAndTarget.targetFunction); | ||
default -> throw new RuntimeException("Unrecognized op type '" + typeAndTarget.enumId.name() + "' while " + | ||
"mapping parsed op " + op); | ||
}; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
adapter-aws-opensearch/src/main/java/io/nosqlbench/adapter/opensearch/OpenSearchOpTypes.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,26 @@ | ||
/* | ||
* Copyright (c) 2024 nosqlbench | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.nosqlbench.adapter.opensearch; | ||
|
||
public enum OpenSearchOpTypes { | ||
create_index, | ||
delete_index, | ||
index, | ||
update, | ||
delete, | ||
knn_search | ||
} |
Oops, something went wrong.