Skip to content

Commit

Permalink
Missed refactored naming from 'Akka' to 'Pekko'
Browse files Browse the repository at this point in the history
  • Loading branch information
TomJKing committed Dec 22, 2023
1 parent d474f60 commit c6aa67f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
28 changes: 14 additions & 14 deletions src/main/scala/play/api/cache/redis/connector/PekkoSerializer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ trait PekkoSerializer {
}

/**
* Akka encoder provides implementation of serialization using Akka serializer.
* Pekko encoder provides implementation of serialization using Pekko serializer.
* The implementation considers all primitives, nulls, and refs. This enables
* us to use Akka settings to modify serializer mapping and use different serializers
* us to use Pekko settings to modify serializer mapping and use different serializers
* for different objects.
*/
private[connector] class AkkaEncoder(serializer: Serialization) {
private[connector] class PekkoEncoder(serializer: Serialization) {

/** Unsafe method encoding the given value into a string */
def encode(value: Any): String = value match {
// null is special case
case null => unsupported("Null is not supported by the redis cache connector.")
// AnyVal is not supported by default, have to be implemented manually; also basic types are processed as primitives
case primitive if isPrimitive(primitive) => primitive.toString
// AnyRef is supported by Akka serializers, but it does not consider classTag, thus it is done manually
// AnyRef is supported by Pekko serializers, but it does not consider classTag, thus it is done manually
case anyRef: AnyRef => anyRefToString(anyRef)
// $COVERAGE-OFF$
// if no of the cases above matches, throw an exception
Expand All @@ -78,12 +78,12 @@ private[connector] class AkkaEncoder(serializer: Serialization) {
}

/**
* Akka decoder provides implementation of deserialization using Akka serializer.
* Pekko decoder provides implementation of deserialization using Pekko serializer.
* The implementation considers all primitives, nulls, and refs. This enables
* us to use Akka settings to modify serializer mapping and use different serializers
* us to use Pekko settings to modify serializer mapping and use different serializers
* for different objects.
*/
private[connector] class AkkaDecoder(serializer: Serialization) {
private[connector] class PekkoDecoder(serializer: Serialization) {

import scala.reflect.{ClassTag => Scala}

Expand Down Expand Up @@ -126,19 +126,19 @@ private[connector] class AkkaDecoder(serializer: Serialization) {
}

@Singleton
private[connector] class AkkaSerializerImpl @Inject() (system: ActorSystem) extends PekkoSerializer {
private[connector] class PekkoSerializerImpl @Inject() (system: ActorSystem) extends PekkoSerializer {

/**
* serializer dispatcher used to serialize the objects into bytes;
* the instance is retrieved from Akka based on its configuration
* the instance is retrieved from Pekko based on its configuration
*/
protected val serializer: Serialization = SerializationExtension(system)

/** value serializer based on Akka serialization */
private val encoder = new AkkaEncoder(serializer)
/** value serializer based on Pekko serialization */
private val encoder = new PekkoEncoder(serializer)

/** value decoder based on Akka serialization */
private val decoder = new AkkaDecoder(serializer)
/** value decoder based on Pekko serialization */
private val decoder = new PekkoDecoder(serializer)

/**
* Method accepts a value to be serialized into the string.
Expand Down Expand Up @@ -200,5 +200,5 @@ private[connector] object JavaClassTag {
}

class PekkoSerializerProvider @Inject() (implicit system: ActorSystem) extends Provider[PekkoSerializer] {
lazy val get = new AkkaSerializerImpl(system)
lazy val get = new PekkoSerializerImpl(system)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ScalaSpecificSerializerSpec extends Specification with Mockito {

private val system = GuiceApplicationBuilder().build().actorSystem

private implicit val serializer: PekkoSerializer = new AkkaSerializerImpl(system)
private implicit val serializer: PekkoSerializer = new PekkoSerializerImpl(system)

"AkkaEncoder" should "encode" >> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class RedisClusterSpec(implicit ee: ExecutionEnv) extends Specification with Wit

implicit private val runtime: RedisRuntime = RedisRuntime("cluster", syncTimeout = 5.seconds, ExecutionContext.global, new LogAndFailPolicy, LazyInvocation)

private val serializer = new AkkaSerializerImpl(system)
private val serializer = new PekkoSerializerImpl(system)

private lazy val containerIpAddress = container.containerIpAddress

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RedisConnectorSpec(implicit ee: ExecutionEnv) extends Specification with W

implicit private val runtime: RedisRuntime = RedisRuntime("connector", syncTimeout = 5.seconds, ExecutionContext.global, new LogAndFailPolicy, LazyInvocation)

private val serializer = new AkkaSerializerImpl(system)
private val serializer = new PekkoSerializerImpl(system)

private lazy val connector: RedisConnector = new RedisConnectorProvider(
RedisStandalone(defaultCacheName, RedisHost(container.containerIpAddress, container.mappedPort(defaultPort)), defaults),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RedisSentinelSpec(implicit ee: ExecutionEnv) extends Specification with Be

implicit private val runtime: RedisRuntime = RedisRuntime("sentinel", syncTimeout = 5.seconds, ExecutionContext.global, new LogAndFailPolicy, LazyInvocation)

private val serializer = new AkkaSerializerImpl(system)
private val serializer = new PekkoSerializerImpl(system)

private lazy val sentinelInstance = RedisSentinel(defaultCacheName, masterGroup = "sentinel5000", sentinels = RedisHost(dockerIp, 5000) :: RedisHost(dockerIp, 5001) :: RedisHost(dockerIp, 5002) :: Nil, defaults)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class SerializerSpec extends Specification with Mockito {

private val system = GuiceApplicationBuilder().build().actorSystem

private implicit val serializer: PekkoSerializer = new AkkaSerializerImpl(system)
private implicit val serializer: PekkoSerializer = new PekkoSerializerImpl(system)

"AkkaEncoder" should "encode" >> {
"PekkoEncoder" should "encode" >> {

"byte" in {
0xAB.toByte.encoded mustEqual "-85"
Expand Down Expand Up @@ -69,7 +69,7 @@ class SerializerSpec extends Specification with Mockito {
}
}

"AkkaDecoder" should "decode" >> {
"PekkoDecoder" should "decode" >> {

"byte" in {
"-85".decoded[Byte] mustEqual 0xAB.toByte
Expand Down

0 comments on commit c6aa67f

Please sign in to comment.