├── .ci
└── scripts
│ ├── upload.sh
│ ├── install-deps.sh
│ └── bump-version.sh
├── docs
├── _config.yml
├── dream11.jpeg
└── index.md
├── .github
├── CODEOWNERS
├── PULL_REQUEST_TEMPLATE.md
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── workflows
│ ├── release-drafter.yml
│ ├── ci.yml
│ └── release.yml
└── release-drafter.yml
├── src
├── test
│ ├── resources
│ │ ├── init.aql
│ │ └── logback-test.xml
│ └── java
│ │ └── io
│ │ └── d11
│ │ └── aerospike
│ │ ├── Constants.java
│ │ ├── AerospikeConnectionTest.java
│ │ ├── AerospikeDeleteTest.java
│ │ ├── AerospikePutTest.java
│ │ ├── Setup.java
│ │ ├── AerospikeQueryTest.java
│ │ ├── AerospikeOperateTest.java
│ │ ├── AerospikeScanTest.java
│ │ ├── AerospikeExistsTest.java
│ │ ├── AerospikeGetHeaderTest.java
│ │ ├── AerospikeAddTest.java
│ │ ├── AerospikeAppendTest.java
│ │ ├── AerospikePrependTest.java
│ │ └── AerospikeGetTest.java
└── main
│ └── java
│ └── io
│ └── d11
│ └── aerospike
│ ├── package-info.java
│ ├── listeners
│ ├── WriteListenerImpl.java
│ ├── DeleteListenerImpl.java
│ ├── ExistsListenerImpl.java
│ ├── ExecuteListenerImpl.java
│ ├── RecordListenerImpl.java
│ ├── BatchListListenerImpl.java
│ ├── ExistsArrayListenerImpl.java
│ ├── RecordArrayListenerImpl.java
│ └── QueryResultListenerImpl.java
│ ├── util
│ └── SharedDataUtils.java
│ └── client
│ ├── AerospikeConnectOptions.java
│ ├── impl
│ └── AerospikeClientImpl.java
│ └── AerospikeClient.java
├── .gitignore
├── LICENSE
├── README.md
├── .editorconfig
└── pom.xml
/.ci/scripts/upload.sh:
--------------------------------------------------------------------------------
1 | # ToDo: Upload to maven central
--------------------------------------------------------------------------------
/.ci/scripts/install-deps.sh:
--------------------------------------------------------------------------------
1 | # Todo: add deps to install
2 |
3 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-minimal
2 | logo: ./dream11.jpeg
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @srijan02420 @dc-dream11 @akshaypatidar1999 @darshanime-d11
--------------------------------------------------------------------------------
/docs/dream11.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dream-horizon-org/vertx-aerospike-client/HEAD/docs/dream11.jpeg
--------------------------------------------------------------------------------
/src/test/resources/init.aql:
--------------------------------------------------------------------------------
1 | INSERT INTO test.testset (PK, bin1, bin2) VALUES ('pkey1', 'Mumbai', 123)
2 | INSERT INTO test.testset (PK, bin1, bin2) VALUES ('pkey2', 'Delhi', 3)
3 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/package-info.java:
--------------------------------------------------------------------------------
1 | @ModuleGen(groupPackage = "io.d11", name = "vertx-aerospike-client")
2 | package io.d11.aerospike;
3 |
4 | import io.vertx.codegen.annotations.ModuleGen;
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Summary
2 |
3 | SUMMARY_GOES_HERE
4 |
5 | ### Full changelog
6 |
7 | * [Implement ...]
8 | * [Add related tests]
9 | * ...
10 |
11 | ### Issues resolved
12 |
13 | Fix #XXX
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea that will improve the library
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### Summary
11 |
12 | SUMMARY_GOES_HERE
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help improve the library
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### Summary
11 |
12 | SUMMARY_GOES_HERE
13 |
14 | ### Steps To Reproduce
15 |
16 | 1.
17 | 2.
18 | 3.
19 |
20 | ### Additional Details & Logs
21 |
22 | -
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 | .DS_Store
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 | .idea/**
18 | */*.iml
19 |
20 | ### NetBeans ###
21 | build/
22 | dist/
23 |
24 | ### generated ###
25 | **/generated/*
26 | **/asciidoc/*
--------------------------------------------------------------------------------
/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | %date %highlight(%+5level) %-26thread %logger{36} [%file:%line] %green(%msg) %n
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.ci/scripts/bump-version.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | release_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
4 | mvn versions:set -DnextSnapshot=true
5 | bump_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
6 |
7 | git config user.name github-actions
8 | git config user.email github-actions@github.com
9 |
10 | git add pom.xml
11 | git commit -m "chore: release version $release_version and bump version to $bump_version"
12 | git push origin HEAD:master
--------------------------------------------------------------------------------
/src/test/java/io/d11/aerospike/Constants.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike;
2 |
3 | public class Constants {
4 | public static final String NAMESPACE = "NAMESPACE";
5 | public static final String TEST_NAMESPACE = "test";
6 | public static final String TEST_SET = "testset";
7 | public static final String AEROSPIKE_HOST = "aerospike.host";
8 | public static final String AEROSPIKE_PORT = "aerospike.port";
9 | public static final String AEROSPIKE_IMAGE_KEY = "aerospike.image";
10 | public static final String DEFAULT_AEROSPIKE_IMAGE = "aerospike/aerospike-server:6.0.0.0";
11 | public static final String INIT_DATA_PATH = "src/test/resources/init.aql";
12 | public static final String INIT_DATA_PATH_IN_CONTAINER = "/aerospike-seed/init.aql";
13 | }
14 |
--------------------------------------------------------------------------------
/.github/workflows/release-drafter.yml:
--------------------------------------------------------------------------------
1 | # This workflow broadly does 3 tasks-
2 | # (1) Create/Update Release drafts
3 | # (2) Auto Label PR's
4 |
5 | # The update_release_draft job handles these tasks, on the basis of event which triggered workflow.
6 | # (1) if push to master by merging PR.
7 | # (2) if pull request opened, reopended, or synchronized (commit push)
8 |
9 | name: Draft and Bump
10 |
11 | on:
12 | push:
13 | branches:
14 | - master
15 | # pull_request event is required only for autolabeler
16 | pull_request:
17 | types: [opened, reopened, synchronize]
18 |
19 | jobs:
20 | update-release-draft:
21 | runs-on: ubuntu-latest
22 |
23 | outputs:
24 | tag-name: ${{ steps.release-drafter.outputs.tag_name }}
25 |
26 | steps:
27 | - id: release-drafter
28 | uses: release-drafter/release-drafter@v5
29 | env:
30 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Sporta Technologies PVT LTD
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/listeners/WriteListenerImpl.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike.listeners;
2 |
3 | import com.aerospike.client.AerospikeException;
4 | import com.aerospike.client.Key;
5 | import com.aerospike.client.listener.WriteListener;
6 | import io.vertx.core.AsyncResult;
7 | import io.vertx.core.Future;
8 | import io.vertx.core.Handler;
9 | import io.vertx.core.impl.ContextInternal;
10 |
11 | import java.util.Objects;
12 |
13 |
14 | public class WriteListenerImpl implements WriteListener {
15 | final ContextInternal context;
16 | final Handler> handler;
17 |
18 | public WriteListenerImpl(ContextInternal context, Handler> handler) {
19 | Objects.requireNonNull(context, "context must not be null");
20 | this.context = context;
21 | this.handler = handler;
22 | }
23 |
24 | public void onSuccess(Key key) {
25 | if (handler != null) {
26 | context.runOnContext((v) -> handler.handle(Future.succeededFuture(key)));
27 | }
28 | }
29 |
30 | public void onFailure(AerospikeException e) {
31 | if (handler != null) {
32 | context.runOnContext((v) -> handler.handle(Future.failedFuture(e)));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/listeners/DeleteListenerImpl.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike.listeners;
2 |
3 | import com.aerospike.client.AerospikeException;
4 | import com.aerospike.client.Key;
5 | import com.aerospike.client.listener.DeleteListener;
6 | import io.vertx.core.AsyncResult;
7 | import io.vertx.core.Future;
8 | import io.vertx.core.Handler;
9 | import io.vertx.core.impl.ContextInternal;
10 |
11 | import java.util.Objects;
12 |
13 | public class DeleteListenerImpl implements DeleteListener {
14 | final ContextInternal context;
15 | final Handler> handler;
16 |
17 | public DeleteListenerImpl(ContextInternal context, Handler> handler) {
18 | Objects.requireNonNull(context, "context must not be null");
19 | this.context = context;
20 | this.handler = handler;
21 | }
22 | public void onSuccess(Key key, boolean b) {
23 | if (handler != null) {
24 | context.runOnContext((v) -> handler.handle(Future.succeededFuture(b)));
25 | }
26 | }
27 |
28 | public void onFailure(AerospikeException e) {
29 | if (handler != null) {
30 | context.runOnContext((v) -> handler.handle(Future.failedFuture(e)));
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/listeners/ExistsListenerImpl.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike.listeners;
2 |
3 | import com.aerospike.client.AerospikeException;
4 | import com.aerospike.client.Key;
5 | import com.aerospike.client.listener.ExistsListener;
6 | import io.vertx.core.AsyncResult;
7 | import io.vertx.core.Future;
8 | import io.vertx.core.Handler;
9 | import io.vertx.core.impl.ContextInternal;
10 |
11 | import java.util.Objects;
12 |
13 | public class ExistsListenerImpl implements ExistsListener {
14 | final ContextInternal context;
15 | final Handler> handler;
16 |
17 | public ExistsListenerImpl(ContextInternal context, Handler> handler) {
18 | Objects.requireNonNull(context, "context must not be null");
19 | this.context = context;
20 | this.handler = handler;
21 | }
22 | public void onSuccess(Key key, boolean b) {
23 | if (handler != null) {
24 | context.runOnContext((v) -> handler.handle(Future.succeededFuture(b)));
25 | }
26 | }
27 |
28 | public void onFailure(AerospikeException e) {
29 | if (handler != null) {
30 | context.runOnContext((v) -> handler.handle(Future.failedFuture(e)));
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/listeners/ExecuteListenerImpl.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike.listeners;
2 |
3 | import com.aerospike.client.AerospikeException;
4 | import com.aerospike.client.Key;
5 | import com.aerospike.client.listener.ExecuteListener;
6 | import io.vertx.core.AsyncResult;
7 | import io.vertx.core.Future;
8 | import io.vertx.core.Handler;
9 | import io.vertx.core.impl.ContextInternal;
10 |
11 | import java.util.Objects;
12 |
13 | public class ExecuteListenerImpl implements ExecuteListener {
14 | final ContextInternal context;
15 | final Handler> handler;
16 |
17 | public ExecuteListenerImpl(ContextInternal context, Handler> handler) {
18 | Objects.requireNonNull(context, "context must not be null");
19 | this.context = context;
20 | this.handler = handler;
21 | }
22 |
23 | public void onSuccess(Key key, Object obj) {
24 | if (handler != null) {
25 | context.runOnContext((v) -> handler.handle(Future.succeededFuture(obj)));
26 | }
27 | }
28 |
29 | public void onFailure(AerospikeException e) {
30 | if (handler != null) {
31 | context.runOnContext((v) -> handler.handle(Future.failedFuture(e)));
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/listeners/RecordListenerImpl.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike.listeners;
2 |
3 | import com.aerospike.client.AerospikeException;
4 | import com.aerospike.client.Key;
5 | import com.aerospike.client.Record;
6 | import com.aerospike.client.listener.RecordListener;
7 | import io.vertx.core.AsyncResult;
8 | import io.vertx.core.Future;
9 | import io.vertx.core.Handler;
10 | import io.vertx.core.impl.ContextInternal;
11 |
12 | import java.util.Objects;
13 |
14 |
15 | public class RecordListenerImpl implements RecordListener {
16 | final ContextInternal context;
17 | final Handler> handler;
18 |
19 | public RecordListenerImpl(ContextInternal context, Handler> handler) {
20 | Objects.requireNonNull(context, "context must not be null");
21 | this.context = context;
22 | this.handler = handler;
23 | }
24 |
25 | public void onSuccess(Key key, Record record) {
26 | if (handler != null) {
27 | context.runOnContext((v) -> handler.handle(Future.succeededFuture(record)));
28 | }
29 | }
30 |
31 | public void onFailure(AerospikeException e) {
32 | if (handler != null) {
33 | context.runOnContext((v) -> handler.handle(Future.failedFuture(e)));
34 | }
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/listeners/BatchListListenerImpl.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike.listeners;
2 |
3 | import com.aerospike.client.AerospikeException;
4 | import com.aerospike.client.BatchRead;
5 | import com.aerospike.client.listener.BatchListListener;
6 | import io.vertx.core.AsyncResult;
7 | import io.vertx.core.Future;
8 | import io.vertx.core.Handler;
9 | import io.vertx.core.impl.ContextInternal;
10 |
11 | import java.util.List;
12 | import java.util.Objects;
13 |
14 | public class BatchListListenerImpl implements BatchListListener {
15 | final ContextInternal context;
16 | final Handler>> handler;
17 |
18 | public BatchListListenerImpl(io.vertx.core.impl.ContextInternal context, Handler>> handler) {
19 | Objects.requireNonNull(context, "context must not be null");
20 | this.context = context;
21 | this.handler = handler;
22 | }
23 |
24 | public void onSuccess(List list) {
25 | if (handler != null) {
26 | context.runOnContext((v) -> handler.handle(Future.succeededFuture(list)));
27 | }
28 | }
29 |
30 | public void onFailure(AerospikeException e) {
31 | if (handler != null) {
32 | context.runOnContext((v) -> handler.handle(Future.failedFuture(e)));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/listeners/ExistsArrayListenerImpl.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike.listeners;
2 |
3 | import com.aerospike.client.AerospikeException;
4 | import com.aerospike.client.Key;
5 | import com.aerospike.client.listener.ExistsArrayListener;
6 | import com.google.common.primitives.Booleans;
7 | import io.vertx.core.AsyncResult;
8 | import io.vertx.core.Future;
9 | import io.vertx.core.Handler;
10 | import io.vertx.core.impl.ContextInternal;
11 |
12 | import java.util.List;
13 | import java.util.Objects;
14 |
15 | public class ExistsArrayListenerImpl implements ExistsArrayListener {
16 | final ContextInternal context;
17 | final Handler>> handler;
18 |
19 | public ExistsArrayListenerImpl(ContextInternal context, Handler>> handler) {
20 | Objects.requireNonNull(context, "context must not be null");
21 | this.context = context;
22 | this.handler = handler;
23 | }
24 | public void onSuccess(Key[] keys, boolean[] b) {
25 | if (handler != null) {
26 | context.runOnContext((v) -> handler.handle(Future.succeededFuture(Booleans.asList(b))));
27 | }
28 | }
29 |
30 | public void onFailure(AerospikeException e) {
31 | if (handler != null) {
32 | context.runOnContext((v) -> handler.handle(Future.failedFuture(e)));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/listeners/RecordArrayListenerImpl.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike.listeners;
2 |
3 | import com.aerospike.client.AerospikeException;
4 | import com.aerospike.client.Key;
5 | import com.aerospike.client.Record;
6 | import com.aerospike.client.listener.RecordArrayListener;
7 | import io.vertx.core.AsyncResult;
8 | import io.vertx.core.Future;
9 | import io.vertx.core.Handler;
10 | import io.vertx.core.impl.ContextInternal;
11 |
12 | import java.util.Arrays;
13 | import java.util.List;
14 | import java.util.Objects;
15 |
16 | public class RecordArrayListenerImpl implements RecordArrayListener {
17 | final ContextInternal context;
18 | final Handler>> handler;
19 |
20 | public RecordArrayListenerImpl(ContextInternal context, Handler>> handler) {
21 | Objects.requireNonNull(context, "context must not be null");
22 | this.context = context;
23 | this.handler = handler;
24 | }
25 |
26 | public void onSuccess(Key[] keys, Record[] records) {
27 | if (handler != null) {
28 | context.runOnContext((v) -> handler.handle(Future.succeededFuture(Arrays.asList(records))));
29 | }
30 | }
31 |
32 | public void onFailure(AerospikeException e) {
33 | if (handler != null) {
34 | context.runOnContext((v) -> handler.handle(Future.failedFuture(e)));
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/io/d11/aerospike/util/SharedDataUtils.java:
--------------------------------------------------------------------------------
1 | package io.d11.aerospike.util;
2 |
3 | import io.vertx.core.shareddata.LocalMap;
4 | import io.vertx.core.shareddata.Shareable;
5 | import io.vertx.core.Vertx;
6 | import lombok.val;
7 | import java.util.function.Supplier;
8 |
9 | public final class SharedDataUtils {
10 | private static final String SHARED_DATA_MAP_NAME = "__vertx.sharedDataUtils";
11 | private static final String SHARED_INSTANCE_FORMAT = "__AerospikeClient.__for.__{}:{}";
12 |
13 | public SharedDataUtils() {
14 | }
15 |
16 | public static String getInstanceName(String host, Integer port) {
17 | return String.format(SHARED_INSTANCE_FORMAT, host, port);
18 | }
19 |
20 | public static T getOrCreate(Vertx vertx, String name, Supplier supplier) {
21 | LocalMap