Skip to content

Commit

Permalink
Merge pull request #547 from AVSystem/pekko
Browse files Browse the repository at this point in the history
Migrate from akka to pekko
  • Loading branch information
ddworak committed Mar 4, 2024
2 parents bc330b6 + 6f31733 commit 437342a
Show file tree
Hide file tree
Showing 55 changed files with 72 additions and 169 deletions.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 437342a

Please sign in to comment.