Skip to content

Commit

Permalink
Merge pull request #11 from reugn/develop
Browse files Browse the repository at this point in the history
v0.7.0
  • Loading branch information
reugn authored Dec 28, 2024
2 parents 8fe366e + 08ff17f commit 861cdf5
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v12
uses: olafurpg/setup-scala@v14
with:
java-version: ${{ matrix.java }}

- name: Set up Aerospike Database
uses: reugn/github-action-aerospike@v1

- name: Cache SBT
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.ivy2/cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ class AerospikeHandler(protected val client: IAerospikeClient)(implicit ec: Exec
listener.future
}

override def commit(txn: Txn): Future[CommitStatus] = {
val listener = new ScalaCommitListener
client.commit(null, listener, txn)
listener.future
}

override def abort(txn: Txn): Future[AbortStatus] = {
val listener = new ScalaAbortListener
client.abort(null, listener, txn)
listener.future
}

override def execute(statement: Statement, operations: Operation*)
(implicit policy: WritePolicy): Future[ExecuteTask] = {
Future(client.execute(policy, statement, operations: _*))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ trait AsyncHandler[F[_]] {
def operateBatchRecord(records: Seq[BatchRecord])
(implicit policy: BatchPolicy = null): F[Boolean]

//-------------------------------------------------------
// Multi-Record Transactions
//-------------------------------------------------------

def commit(txn: Txn): F[CommitStatus]

def abort(txn: Txn): F[AbortStatus]

//-------------------------------------------------------
// Scan Operations
//-------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.github.reugn.aerospike.scala.listener

import com.aerospike.client.AbortStatus
import com.aerospike.client.listener.AbortListener

class ScalaAbortListener extends AbortListener with PromiseLike[AbortStatus] {

override def onSuccess(status: AbortStatus): Unit = {
success(status)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.github.reugn.aerospike.scala.listener

import com.aerospike.client.listener.CommitListener
import com.aerospike.client.{AerospikeException, CommitStatus}

class ScalaCommitListener extends CommitListener with PromiseLike[CommitStatus] {

override def onSuccess(status: CommitStatus): Unit = {
success(status)
}

override def onFailure(exception: AerospikeException.Commit): Unit = {
failure(exception)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ class MonixAerospikeHandler(protected val client: IAerospikeClient)
Task(client.operate(policy, records.asJava))
}

override def commit(txn: Txn): Task[CommitStatus] = {
Task(client.commit(txn))
}

override def abort(txn: Txn): Task[AbortStatus] = {
Task(client.abort(txn))
}

override def scanNodeName(nodeName: String, ns: String, set: String, binNames: String*)
(implicit policy: ScanPolicy): Task[List[KeyRecord]] = {
Task {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ class ZioAerospikeHandler(protected val client: IAerospikeClient)
ZIO.attemptBlocking(client.operate(policy, records.asJava))
}

override def commit(txn: Txn): Task[CommitStatus] = {
ZIO.attemptBlocking(client.commit(txn))
}

override def abort(txn: Txn): Task[AbortStatus] = {
ZIO.attemptBlocking(client.abort(txn))
}

override def scanNodeName(nodeName: String, ns: String, set: String, binNames: String*)
(implicit policy: ScanPolicy): Task[List[KeyRecord]] = {
ZIO.attemptBlocking {
Expand Down
18 changes: 9 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
val ZIOVersion = "2.0.16"
val ZIOVersion = "2.0.22"
val MonixVersion = "3.4.1"
val AerospikeVersion = "7.1.0"
val AkkaStreamVersion = "2.8.4"
val NettyVersion = "4.1.97.Final"
val AerospikeVersion = "9.0.2"
val AkkaStreamVersion = "2.8.8"
val NettyVersion = "4.1.116.Final"

lazy val commonSettings = Seq(
organization := "io.github.reugn",
scalaVersion := "2.12.18",
crossScalaVersions := Seq(scalaVersion.value, "2.13.11"),
scalaVersion := "2.12.20",
crossScalaVersions := Seq(scalaVersion.value, "2.13.15"),

libraryDependencies ++= Seq(
"com.aerospike" % "aerospike-client" % AerospikeVersion,
"com.aerospike" % "aerospike-client-jdk8" % AerospikeVersion,
"com.typesafe.akka" %% "akka-stream" % AkkaStreamVersion,
"io.netty" % "netty-transport" % NettyVersion,
"io.netty" % "netty-transport-native-epoll" % NettyVersion classifier "linux-x86_64",
"io.netty" % "netty-transport-native-kqueue" % NettyVersion classifier "osx-x86_64",
"io.netty" % "netty-handler" % NettyVersion,
"com.typesafe" % "config" % "1.4.2",
"org.scalatest" %% "scalatest" % "3.2.16" % Test
"com.typesafe" % "config" % "1.4.3",
"org.scalatest" %% "scalatest" % "3.2.19" % Test
),

scalacOptions := Seq(
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.9.4
sbt.version = 1.10.6
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ThisBuild / version := "0.6.0"
ThisBuild / version := "0.7.0"

0 comments on commit 861cdf5

Please sign in to comment.