Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from akka to pekko #547

Merged
merged 1 commit into from Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis

import akka.util.{ByteString, ByteStringBuilder}
import org.apache.pekko.util.{ByteString, ByteStringBuilder}
import com.avsystem.commons.redis.protocol.{ArrayMsg, BulkStringMsg, IntegerMsg, NullBulkStringMsg, RedisMsg, SimpleStringMsg}
import org.openjdk.jmh.annotations._

Expand Down
Expand Up @@ -6,8 +6,8 @@ import java.security.{KeyStore, SecureRandom}
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.{ConcurrentHashMap, CountDownLatch, TimeUnit}

import akka.actor.ActorSystem
import akka.util.{ByteString, Timeout}
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.util.{ByteString, Timeout}
import com.avsystem.commons.concurrent.RunNowEC
import com.avsystem.commons.redis.RedisClientBenchmark._
import com.avsystem.commons.redis.actor.RedisConnectionActor.DebugListener
Expand Down

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions docs/RedisDriver.md
Expand Up @@ -29,7 +29,7 @@ libraryDependencies += "com.avsystem.commons" %% "commons-redis" % avsCommonsVer

The module `commons-redis` contains from-the-scratch implementation of Scala driver for Redis. Its most important goals
and characteristics are:
* non-blocking network communication (based on Akka IO)
* non-blocking network communication (based on Pekko IO)
* asynchronous API
* support for Redis Cluster
* type safety
Expand Down Expand Up @@ -66,7 +66,7 @@ Missing features:
### Quickstart example

```scala
import akka.actor.ActorSystem
import org.apache.pekko.actor.ActorSystem
import com.avsystem.commons.redis._

import scala.concurrent.ExecutionContext.Implicits.global
Expand Down
4 changes: 2 additions & 2 deletions project/Commons.scala
Expand Up @@ -35,7 +35,7 @@ object Commons extends ProjectGroup("commons") {
val typesafeConfigVersion = "1.4.3"
val commonsIoVersion = "1.3.2" // test only
val scalaLoggingVersion = "3.9.5"
val akkaVersion = "2.6.19"
val pekkoVersion = "1.0.2"
val monixVersion = "3.4.1"
val circeVersion = "0.14.5" // benchmark only
val upickleVersion = "3.1.2" // benchmark only
Expand Down Expand Up @@ -332,7 +332,7 @@ object Commons extends ProjectGroup("commons") {
jvmCommonSettings,
libraryDependencies ++= Seq(
"com.google.guava" % "guava" % guavaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"org.apache.pekko" %% "pekko-stream" % pekkoVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"io.monix" %% "monix" % monixVersion,
),
Expand Down
2 changes: 1 addition & 1 deletion redis/src/main/resources/reference.conf
@@ -1,6 +1,6 @@
redis {
worker-dispatcher-path = redis.pinned-dispatcher
default-dispatcher-path = akka.actor.default-dispatcher
default-dispatcher-path = pekko.actor.default-dispatcher

pinned-dispatcher {
executor = thread-pool-executor
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import com.avsystem.commons.redis.ApiSubset.{HeadOps, IterableTailOps, IteratorTailOps}
import com.avsystem.commons.redis.commands._
import com.avsystem.commons.redis.config.ExecutionConfig
Expand Down
2 changes: 1 addition & 1 deletion redis/src/main/scala/com/avsystem/commons/redis/Hash.scala
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis

import akka.util.ByteString
import org.apache.pekko.util.ByteString

/**
* Implementation of key hashing function used in Redis Cluster, as specified in
Expand Down
@@ -1,9 +1,9 @@
package com.avsystem.commons
package redis

import akka.actor.{ActorSystem, Props}
import akka.pattern.ask
import akka.util.Timeout
import org.apache.pekko.actor.{ActorSystem, Props}
import org.apache.pekko.pattern.ask
import org.apache.pekko.util.Timeout
import com.avsystem.commons.concurrent.RetryStrategy
import com.avsystem.commons.redis.RawCommand.Level
import com.avsystem.commons.redis.RedisClusterClient.{AskingPack, CollectionPacks}
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import com.avsystem.commons.misc.{NamedEnum, NamedEnumCompanion}
import com.avsystem.commons.redis.CommandEncoder.CommandArg
import com.avsystem.commons.redis.RedisBatch.Index
Expand Down
@@ -1,8 +1,8 @@
package com.avsystem.commons
package redis

import akka.actor.{ActorSystem, Props}
import akka.pattern.ask
import org.apache.pekko.actor.{ActorSystem, Props}
import org.apache.pekko.pattern.ask
import com.avsystem.commons.concurrent.RetryStrategy
import com.avsystem.commons.redis.RawCommand.Level
import com.avsystem.commons.redis.actor.RedisConnectionActor.PacksResult
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import com.avsystem.commons.redis.protocol.BulkStringMsg
import com.avsystem.commons.serialization.GenCodec.ReadFailure
import com.avsystem.commons.serialization._
Expand Down
@@ -1,8 +1,8 @@
package com.avsystem.commons
package redis

import akka.actor.{ActorSystem, Props}
import akka.util.Timeout
import org.apache.pekko.actor.{ActorSystem, Props}
import org.apache.pekko.util.Timeout
import com.avsystem.commons.concurrent.RetryStrategy
import com.avsystem.commons.redis.actor.RedisConnectionActor.PacksResult
import com.avsystem.commons.redis.actor.SentinelsMonitoringActor
Expand Down
Expand Up @@ -4,9 +4,9 @@ package redis
import java.util.concurrent.ConcurrentLinkedDeque
import java.util.concurrent.atomic.AtomicLong

import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import akka.pattern.ask
import akka.util.Timeout
import org.apache.pekko.actor.{Actor, ActorRef, ActorSystem, Props}
import org.apache.pekko.pattern.ask
import org.apache.pekko.util.Timeout
import com.avsystem.commons.concurrent.RunInQueueEC
import com.avsystem.commons.redis.actor.ConnectionPoolActor.QueuedConn
import com.avsystem.commons.redis.actor.RedisConnectionActor.PacksResult
Expand Down Expand Up @@ -118,7 +118,7 @@ final class RedisNodeClient(

/**
* Executes a [[RedisBatch]] on this client by sending its commands to the Redis node in a single network
* message (technically, a single `akka.io.Tcp.Write` message). Therefore it's also naturally guaranteed that
* message (technically, a single `org.apache.pekko.io.Tcp.Write` message). Therefore it's also naturally guaranteed that
* all commands in a batch are executed on the same connection.
*
* Note that even though connection used by [[RedisNodeClient]] are automatically reconnected, it's still possible
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.actor

import akka.actor.{Actor, ActorRef, Cancellable, Props}
import org.apache.pekko.actor.{Actor, ActorRef, Cancellable, Props}
import com.avsystem.commons.redis._
import com.avsystem.commons.redis.actor.RedisConnectionActor.PacksResult
import com.avsystem.commons.redis.commands.{NodeInfo, SlotRange, SlotRangeMapping}
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.actor

import akka.actor.{Actor, ActorRef, Props}
import org.apache.pekko.actor.{Actor, ActorRef, Props}
import com.avsystem.commons.redis.NodeAddress
import com.avsystem.commons.redis.actor.ConnectionPoolActor._
import com.avsystem.commons.redis.config.{ConnectionConfig, NodeConfig}
Expand Down
@@ -1,10 +1,10 @@
package com.avsystem.commons
package redis.actor

import akka.actor.{Actor, ActorRef, Cancellable}
import akka.stream.scaladsl._
import akka.stream.{CompletionStrategy, IgnoreComplete, Materializer, SystemMaterializer}
import akka.util.ByteString
import org.apache.pekko.actor.{Actor, ActorRef, Cancellable}
import org.apache.pekko.stream.scaladsl._
import org.apache.pekko.stream.{CompletionStrategy, IgnoreComplete, Materializer, SystemMaterializer}
import org.apache.pekko.util.ByteString
import com.avsystem.commons.concurrent.RetryStrategy
import com.avsystem.commons.redis._
import com.avsystem.commons.redis.commands.{PubSubCommand, PubSubEvent, ReplyDecoders}
Expand Down Expand Up @@ -141,7 +141,7 @@ final class RedisConnectionActor(
case _: TcpEvent => //ignore, this is from previous connection
}

// previously this was implemented using Akka IO, now using Akka Streams in a way that mimics Akka IO
// previously this was implemented using Akka IO, now using Pekko Streams in a way that mimics Akka IO
private def doConnect(): Unit = {
// using Akka IO, this was implemented as:
// IO(Tcp) ! Tcp.Connect(address.socketAddress,
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.actor

import akka.actor.{Actor, ActorRef}
import org.apache.pekko.actor.{Actor, ActorRef}
import com.avsystem.commons.redis.RawCommand.Level
import com.avsystem.commons.redis.RedisOp.{FlatMappedOp, LeafOp}
import com.avsystem.commons.redis.actor.RedisConnectionActor.{Release, Reserving}
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.actor

import akka.actor.{Actor, ActorRef, Props}
import org.apache.pekko.actor.{Actor, ActorRef, Props}
import com.avsystem.commons.redis.actor.RedisConnectionActor.PacksResult
import com.avsystem.commons.redis.commands.{PubSubEvent, Subscribe}
import com.avsystem.commons.redis.config.MasterSlaveConfig
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.commands

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import com.avsystem.commons.misc.{NamedEnum, NamedEnumCompanion}
import com.avsystem.commons.redis.exception.UnexpectedReplyException
import com.avsystem.commons.redis.protocol._
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.commands

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import com.avsystem.commons.redis._
import com.avsystem.commons.redis.commands.ReplyDecoders._

Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.commands

import akka.util.{ByteString, ByteStringBuilder}
import org.apache.pekko.util.{ByteString, ByteStringBuilder}
import com.avsystem.commons.misc.{NamedEnum, NamedEnumCompanion}
import com.avsystem.commons.redis.CommandEncoder.CommandArg
import com.avsystem.commons.redis._
Expand Down
@@ -1,6 +1,6 @@
package com.avsystem.commons.redis.commands

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import com.avsystem.commons.redis.{RawCommandPack, RawCommandPacks, RedisBatch, UnsafeCommand}
import com.avsystem.commons.redis.protocol.{BulkStringMsg, ValidRedisMsg}

Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.commands

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import com.avsystem.commons.misc.{NamedEnum, NamedEnumCompanion}
import com.avsystem.commons.redis.CommandEncoder.CommandArg
import com.avsystem.commons.redis._
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.commands

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import com.avsystem.commons.misc.{NamedEnum, NamedEnumCompanion}
import com.avsystem.commons.redis.CommandEncoder.CommandArg
import com.avsystem.commons.redis._
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.config

import akka.util.Timeout
import org.apache.pekko.util.Timeout
import com.avsystem.commons.concurrent.RunNowEC

import scala.concurrent.duration._
Expand Down
Expand Up @@ -2,8 +2,8 @@ package com.avsystem.commons
package redis.config

import java.net.InetSocketAddress
import akka.io.Inet
import akka.util.Timeout
import org.apache.pekko.io.Inet
import org.apache.pekko.util.Timeout
import com.avsystem.commons.concurrent.RetryStrategy
import com.avsystem.commons.concurrent.RetryStrategy._
import com.avsystem.commons.redis.actor.RedisConnectionActor.{DebugListener, DevNullListener}
Expand Down
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis.protocol

import akka.util.{ByteString, ByteStringBuilder}
import org.apache.pekko.util.{ByteString, ByteStringBuilder}
import com.avsystem.commons.misc.Sam
import com.avsystem.commons.redis.exception.{InvalidDataException, RedisException}
import com.avsystem.commons.redis.util.SizedArraySeqBuilder
Expand Down
2 changes: 1 addition & 1 deletion redis/src/main/scala/com/avsystem/commons/redis/raw.scala
@@ -1,7 +1,7 @@
package com.avsystem.commons
package redis

import akka.util.ByteString
import org.apache.pekko.util.ByteString
import com.avsystem.commons.redis.RawCommand.Level
import com.avsystem.commons.redis.exception.ForbiddenCommandException
import com.avsystem.commons.redis.protocol.{ArrayMsg, BulkStringMsg, RedisMsg, RedisReply}
Expand Down