Skip to content

Commit 1de3dca

Browse files
authored
Merge pull request #7 from reugn/develop
v0.6.0
2 parents 186b90c + 9283f89 commit 1de3dca

File tree

11 files changed

+91
-40
lines changed

11 files changed

+91
-40
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Build
22
on:
33
push:
4+
branches:
5+
- '**'
46
pull_request:
57
branches:
68
- main
@@ -11,10 +13,10 @@ jobs:
1113

1214
steps:
1315
- name: Checkout
14-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1517

1618
- name: Set up JDK 1.8
17-
uses: actions/setup-java@v3
19+
uses: actions/setup-java@v4
1820
with:
1921
distribution: 'temurin'
2022
java-version: 8
@@ -23,7 +25,7 @@ jobs:
2325
uses: reugn/github-action-aerospike@v1
2426

2527
- name: Cache Gradle packages
26-
uses: actions/cache@v3
28+
uses: actions/cache@v4
2729
with:
2830
path: |
2931
~/.gradle/caches

build.gradle.kts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
23

34
plugins {
4-
kotlin("jvm") version "1.9.10"
5+
kotlin("jvm") version "2.1.0"
56
`maven-publish`
67
signing
78
}
@@ -17,12 +18,12 @@ java {
1718
withSourcesJar()
1819
}
1920

20-
extra["aerospikeClientVersion"] = "7.1.0"
21-
extra["kotlinxCoroutinesVersion"] = "1.7.3"
22-
extra["nettyVersion"] = "4.1.97.Final"
21+
extra["aerospikeClientVersion"] = "9.0.2"
22+
extra["kotlinxCoroutinesVersion"] = "1.10.1"
23+
extra["nettyVersion"] = "4.1.116.Final"
2324

2425
dependencies {
25-
implementation("com.aerospike:aerospike-client:${project.extra["aerospikeClientVersion"]}")
26+
implementation("com.aerospike:aerospike-client-jdk8:${project.extra["aerospikeClientVersion"]}")
2627
implementation("io.netty:netty-transport:${project.extra["nettyVersion"]}")
2728
implementation("io.netty:netty-transport-native-epoll:${project.extra["nettyVersion"]}")
2829
implementation("io.netty:netty-transport-native-kqueue:${project.extra["nettyVersion"]}")
@@ -36,8 +37,10 @@ tasks.test {
3637
useJUnitPlatform()
3738
}
3839

39-
tasks.withType<KotlinCompile> {
40-
kotlinOptions.jvmTarget = "1.8"
40+
tasks.withType<KotlinJvmCompile>().configureEach {
41+
compilerOptions {
42+
jvmTarget.set(JvmTarget.JVM_1_8)
43+
}
4144
}
4245

4346
tasks.withType<JavaCompile> {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
kotlin.code.style=official
2-
version=0.5.0
2+
version=0.6.0

gradle/wrapper/gradle-wrapper.jar

-16.9 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

gradlew

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,11 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
9088

9189
# Use the maximum available, or set MAX_FD != -1 to use that value.
9290
MAX_FD=maximum
@@ -133,22 +131,29 @@ location of your Java installation."
133131
fi
134132
else
135133
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137137
138138
Please set the JAVA_HOME variable in your environment to match the
139139
location of your Java installation."
140+
fi
140141
fi
141142

142143
# Increase the maximum file descriptors if we can.
143144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
147+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148+
# shellcheck disable=SC2039,SC3045
146149
MAX_FD=$( ulimit -H -n ) ||
147150
warn "Could not query maximum file descriptor limit"
148151
esac
149152
case $MAX_FD in #(
150153
'' | soft) :;; #(
151154
*)
155+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156+
# shellcheck disable=SC2039,SC3045
152157
ulimit -n "$MAX_FD" ||
153158
warn "Could not set maximum file descriptor limit to $MAX_FD"
154159
esac
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
193198
done
194199
fi
195200

196-
# Collect all arguments for the java command;
197-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198-
# shell script including quotes and variable substitutions, so put them in
199-
# double quotes to make sure that they get re-expanded; and
200-
# * put everything else in single quotes, so that it's not re-expanded.
201+
202+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204+
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
201210

202211
set -- \
203212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

gradlew.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
2828
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

src/main/kotlin/io/github/reugn/aerospike/kotlin/AerospikeAsyncClient.kt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
package io.github.reugn.aerospike.kotlin
22

3-
import com.aerospike.client.BatchRecord
4-
import com.aerospike.client.BatchResults
5-
import com.aerospike.client.Bin
6-
import com.aerospike.client.IAerospikeClient
7-
import com.aerospike.client.Key
8-
import com.aerospike.client.Operation
9-
import com.aerospike.client.Record
3+
import com.aerospike.client.*
104
import com.aerospike.client.cluster.Node
115
import com.aerospike.client.policy.*
126
import com.aerospike.client.query.KeyRecord
@@ -96,6 +90,7 @@ class AerospikeAsyncClient(
9690
return listener.await()!!
9791
}
9892

93+
@Suppress("kotlin:S6518")
9994
override suspend fun get(policy: Policy?, key: Key, vararg binNames: String): Record? {
10095
val listener = KotlinRecordListener()
10196
if (binNames.isNotEmpty()) {
@@ -169,6 +164,18 @@ class AerospikeAsyncClient(
169164
return listener.await()!!
170165
}
171166

167+
override suspend fun commit(txn: Txn): CommitStatus {
168+
val listener = KotlinCommitListener()
169+
client.commit(null, listener, txn)
170+
return listener.await()!!
171+
}
172+
173+
override suspend fun abort(txn: Txn): AbortStatus {
174+
val listener = KotlinAbortListener()
175+
client.abort(null, listener, txn)
176+
return listener.await()!!
177+
}
178+
172179
override suspend fun scanNodeName(
173180
policy: ScanPolicy?,
174181
nodeName: String,

src/main/kotlin/io/github/reugn/aerospike/kotlin/IAerospikeAsyncClient.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
package io.github.reugn.aerospike.kotlin
22

3-
import com.aerospike.client.BatchRecord
4-
import com.aerospike.client.BatchResults
5-
import com.aerospike.client.Bin
6-
import com.aerospike.client.IAerospikeClient
7-
import com.aerospike.client.Key
8-
import com.aerospike.client.Operation
9-
import com.aerospike.client.Record
3+
import com.aerospike.client.*
104
import com.aerospike.client.cluster.Node
115
import com.aerospike.client.policy.*
126
import com.aerospike.client.query.KeyRecord
@@ -99,6 +93,14 @@ interface IAerospikeAsyncClient : Closeable {
9993

10094
suspend fun operateBatchRecord(policy: BatchPolicy?, records: Collection<BatchRecord>): Boolean
10195

96+
//-------------------------------------------------------
97+
// Multi-Record Transactions
98+
//-------------------------------------------------------
99+
100+
suspend fun commit(txn: Txn): CommitStatus
101+
102+
suspend fun abort(txn: Txn): AbortStatus
103+
102104
//-------------------------------------------------------
103105
// Scan/Query Operations
104106
//-------------------------------------------------------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package io.github.reugn.aerospike.kotlin.listener
2+
3+
import com.aerospike.client.AbortStatus
4+
import com.aerospike.client.listener.AbortListener
5+
6+
class KotlinAbortListener : BaseListener<AbortStatus>(), AbortListener {
7+
override fun onSuccess(status: AbortStatus?) {
8+
success(status)
9+
}
10+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.github.reugn.aerospike.kotlin.listener
2+
3+
import com.aerospike.client.AerospikeException
4+
import com.aerospike.client.CommitStatus
5+
import com.aerospike.client.listener.CommitListener
6+
7+
class KotlinCommitListener : BaseListener<CommitStatus>(), CommitListener {
8+
override fun onSuccess(status: CommitStatus?) {
9+
success(status)
10+
}
11+
12+
override fun onFailure(exception: AerospikeException.Commit?) {
13+
failure(exception)
14+
}
15+
}

0 commit comments

Comments
 (0)