diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84712a69b..ae8280730 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,6 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REDIS_VERSION: 6.2.12 jobs: build: @@ -52,12 +51,6 @@ jobs: - name: Setup sbt uses: sbt/setup-sbt@v1 - - name: Cache Redis - uses: actions/cache@v2 - with: - path: ./redis-${{ env.REDIS_VERSION }} - key: ${{ runner.os }}-redis-cache-v2-${{ env.REDIS_VERSION }} - - name: Setup Node.js uses: actions/setup-node@v2 with: @@ -69,9 +62,6 @@ jobs: mongodb-version: 7.0 mongodb-replica-set: test-rs - - name: Setup Redis - run: ./install-redis.sh - - name: Check that workflows are up to date run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck diff --git a/README.md b/README.md index c9e1b9cb3..73b757f9b 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ [`OptRef`](http://avsystem.github.io/scala-commons/api/com/avsystem/commons/misc/OptRef.html) (implemented as value classes) * [Components](docs/Components.md) and Dependency Injection library -* `commons-redis` - [Scala driver for Redis](docs/RedisDriver.md) +* `commons-redis` (DEPRECATED) - [Scala driver for Redis](docs/RedisDriver.md) * `commons-macros` contains implementations of macros used in other modules and reusable macro utilities: * `MacroCommons` trait with several convenience functions for implementing macros * `TypeClassDerivation` - implements infrastructure for automatic type class derivation diff --git a/docs/RedisDriver.md b/docs/RedisDriver.md index 7517f0317..e6c8cfabf 100644 --- a/docs/RedisDriver.md +++ b/docs/RedisDriver.md @@ -1,5 +1,8 @@ # Redis driver +**⚠️ WARNING: This module is deprecated and scheduled for removal in a future release. +It has not been actively tested since v2.21.0. Please migrate to an alternative solution. ** + `commons-redis` - Scala driver for Redis ```scala diff --git a/install-redis.sh b/install-redis.sh deleted file mode 100755 index 2b0784e61..000000000 --- a/install-redis.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -REDIS_HOME=$PWD/redis-$REDIS_VERSION/src -echo "REDIS_HOME=$REDIS_HOME" >> $GITHUB_ENV -if [ ! -d $REDIS_HOME ]; then - wget http://download.redis.io/releases/redis-$REDIS_VERSION.tar.gz - tar -xzf redis-$REDIS_VERSION.tar.gz - cd redis-$REDIS_VERSION && make BUILD_TLS=yes -fi - diff --git a/project/Commons.scala b/project/Commons.scala index 460c79de2..683678f13 100644 --- a/project/Commons.scala +++ b/project/Commons.scala @@ -73,20 +73,9 @@ object Commons extends ProjectGroup("commons") { githubWorkflowTargetTags ++= Seq("v*"), - githubWorkflowEnv ++= Map( - "REDIS_VERSION" -> "6.2.12", - ), githubWorkflowArtifactUpload := false, githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17"), JavaSpec.temurin("21")), githubWorkflowBuildPreamble ++= Seq( - WorkflowStep.Use( - UseRef.Public("actions", "cache", "v2"), - name = Some("Cache Redis"), - params = Map( - "path" -> "./redis-${{ env.REDIS_VERSION }}", - "key" -> "${{ runner.os }}-redis-cache-v2-${{ env.REDIS_VERSION }}" - ) - ), WorkflowStep.Use( UseRef.Public("actions", "setup-node", "v2"), name = Some("Setup Node.js"), @@ -100,10 +89,6 @@ object Commons extends ProjectGroup("commons") { "mongodb-replica-set" -> "test-rs", ) ), - WorkflowStep.Run( - List("./install-redis.sh"), - name = Some("Setup Redis"), - ) ), githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v"))), @@ -337,6 +322,8 @@ object Commons extends ProjectGroup("commons") { "io.monix" %% "monix" % monixVersion, ), Test / parallelExecution := false, + Compile / scalacOptions += "-Wconf:cat=deprecation:is", // only inform about deprecations due to scheduled removal + Test / skip := true, ) lazy val hocon = mkSubProject diff --git a/redis/src/main/scala/com/avsystem/commons/redis/RedisClusterClient.scala b/redis/src/main/scala/com/avsystem/commons/redis/RedisClusterClient.scala index 44551ef56..4882e8e31 100644 --- a/redis/src/main/scala/com/avsystem/commons/redis/RedisClusterClient.scala +++ b/redis/src/main/scala/com/avsystem/commons/redis/RedisClusterClient.scala @@ -1,9 +1,6 @@ package com.avsystem.commons package redis -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} @@ -12,16 +9,19 @@ import com.avsystem.commons.redis.actor.ClusterMonitoringActor.{GetClient, GetCl import com.avsystem.commons.redis.actor.RedisConnectionActor.PacksResult import com.avsystem.commons.redis.commands.{Asking, SlotRange} import com.avsystem.commons.redis.config.{ClusterConfig, ExecutionConfig} -import com.avsystem.commons.redis.exception._ +import com.avsystem.commons.redis.exception.* import com.avsystem.commons.redis.monitoring.ClusterStateObserver -import com.avsystem.commons.redis.protocol._ +import com.avsystem.commons.redis.protocol.* import com.avsystem.commons.redis.util.DelayedFuture +import org.apache.pekko.actor.{ActorSystem, Props} +import org.apache.pekko.pattern.ask +import org.apache.pekko.util.Timeout import java.util.concurrent.atomic.AtomicInteger import scala.annotation.tailrec import scala.collection.mutable import scala.collection.mutable.ArrayBuffer -import scala.concurrent.duration._ +import scala.concurrent.duration.* /** * Redis client implementation for Redis Cluster deployments. Internally, it uses single [[RedisNodeClient]] instance @@ -45,6 +45,7 @@ import scala.concurrent.duration._ * @param config client configuration - [[ClusterConfig]] * @param clusterStateObserver optional observer for monitoring client's state and connections - [[ClusterStateObserver]] */ +@deprecated("Redis driver is scheduled for removal. It has not been actively tested since v2.21.0. Use a different library, e.g. redisson.", "2.21.0") final class RedisClusterClient( val seedNodes: Seq[NodeAddress] = List(NodeAddress.Default), val config: ClusterConfig = ClusterConfig(), diff --git a/redis/src/main/scala/com/avsystem/commons/redis/RedisConnectionClient.scala b/redis/src/main/scala/com/avsystem/commons/redis/RedisConnectionClient.scala index 7226cc4fc..eaca0f242 100644 --- a/redis/src/main/scala/com/avsystem/commons/redis/RedisConnectionClient.scala +++ b/redis/src/main/scala/com/avsystem/commons/redis/RedisConnectionClient.scala @@ -1,8 +1,6 @@ package com.avsystem.commons package redis -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 @@ -10,6 +8,8 @@ import com.avsystem.commons.redis.actor.RedisOperationActor.OpResult import com.avsystem.commons.redis.actor.{RedisConnectionActor, RedisOperationActor} import com.avsystem.commons.redis.config.{ConfigDefaults, ConnectionConfig, ExecutionConfig} import com.avsystem.commons.redis.exception.ClientStoppedException +import org.apache.pekko.actor.{ActorSystem, Props} +import org.apache.pekko.pattern.ask /** * Redis client that uses a single, non-reconnectable connection. @@ -24,6 +24,7 @@ import com.avsystem.commons.redis.exception.ClientStoppedException * If you simply need a single-connection, reconnectable client, use [[RedisNodeClient]] with connection pool size * configured to 1. */ +@deprecated("Redis driver is scheduled for removal. It has not been actively tested since v2.21.0. Use a different library, e.g. redisson.", "2.21.0") final class RedisConnectionClient( val address: NodeAddress = NodeAddress.Default, val config: ConnectionConfig = ConnectionConfig(), diff --git a/redis/src/main/scala/com/avsystem/commons/redis/RedisExecutor.scala b/redis/src/main/scala/com/avsystem/commons/redis/RedisExecutor.scala index ef10990f6..da078a995 100644 --- a/redis/src/main/scala/com/avsystem/commons/redis/RedisExecutor.scala +++ b/redis/src/main/scala/com/avsystem/commons/redis/RedisExecutor.scala @@ -1,10 +1,10 @@ package com.avsystem.commons package redis -import java.io.Closeable - import com.avsystem.commons.redis.config.ExecutionConfig +import java.io.Closeable + /** * Base trait for Redis clients with ability to execute [[RedisBatch]]es. */ @@ -54,6 +54,7 @@ trait RedisNodeExecutor extends RedisKeyedExecutor with RedisOpExecutor */ trait RedisConnectionExecutor extends RedisNodeExecutor +@deprecated("Redis driver is scheduled for removal. It has not been actively tested since v2.21.0. Use a different library, e.g. redisson.", "2.21.0") abstract class RedisClient extends RedisExecutor with Closeable { def initialized: Future[this.type] } diff --git a/redis/src/main/scala/com/avsystem/commons/redis/RedisNodeClient.scala b/redis/src/main/scala/com/avsystem/commons/redis/RedisNodeClient.scala index 15f106363..ecb952732 100644 --- a/redis/src/main/scala/com/avsystem/commons/redis/RedisNodeClient.scala +++ b/redis/src/main/scala/com/avsystem/commons/redis/RedisNodeClient.scala @@ -1,12 +1,6 @@ package com.avsystem.commons package redis -import java.util.concurrent.ConcurrentLinkedDeque -import java.util.concurrent.atomic.AtomicLong - -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 @@ -14,15 +8,21 @@ import com.avsystem.commons.redis.actor.RedisOperationActor.OpResult import com.avsystem.commons.redis.actor.{ConnectionPoolActor, RedisConnectionActor, RedisOperationActor} import com.avsystem.commons.redis.config.{ConfigDefaults, ConnectionConfig, ExecutionConfig, NodeConfig} import com.avsystem.commons.redis.exception.{ClientStoppedException, NodeInitializationFailure, NodeRemovedException, TooManyConnectionsException} +import org.apache.pekko.actor.{Actor, ActorRef, ActorSystem, Props} +import org.apache.pekko.pattern.ask +import org.apache.pekko.util.Timeout +import java.util.concurrent.ConcurrentLinkedDeque +import java.util.concurrent.atomic.AtomicLong import scala.collection.mutable.ArrayBuffer -import scala.concurrent.duration._ +import scala.concurrent.duration.* /** * Redis client implementation for a single Redis node using a connection pool. Connection pool size is constant * and batches and operations are distributed over connections using round-robin scheme. Connections are automatically * reconnected upon failure (possibly with an appropriate delay, see [[config.NodeConfig NodeConfig]] for details). */ +@deprecated("Redis driver is scheduled for removal. It has not been actively tested since v2.21.0. Use a different library, e.g. redisson.", "2.21.0") final class RedisNodeClient( val address: NodeAddress = NodeAddress.Default, val config: NodeConfig = NodeConfig(), diff --git a/redis/src/main/scala/com/avsystem/commons/redis/config/config.scala b/redis/src/main/scala/com/avsystem/commons/redis/config/config.scala index ce22c431e..aa965a34d 100644 --- a/redis/src/main/scala/com/avsystem/commons/redis/config/config.scala +++ b/redis/src/main/scala/com/avsystem/commons/redis/config/config.scala @@ -1,16 +1,16 @@ package com.avsystem.commons package redis.config -import java.net.InetSocketAddress -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.concurrent.RetryStrategy.* import com.avsystem.commons.redis.actor.RedisConnectionActor.{DebugListener, DevNullListener} import com.avsystem.commons.redis.{NodeAddress, RedisBatch, RedisOp} +import org.apache.pekko.io.Inet +import org.apache.pekko.util.Timeout +import java.net.InetSocketAddress import javax.net.ssl.SSLEngine -import scala.concurrent.duration._ +import scala.concurrent.duration.* /** * Configuration of a [[com.avsystem.commons.redis.RedisClusterClient RedisClusterClient]] @@ -161,6 +161,7 @@ case class NodeConfig( * @param debugListener listener for traffic going through this connection. Only for debugging and testing * purposes */ +@deprecated("Redis driver is scheduled for removal. It has not been actively tested since v2.21.0. Use a different library, e.g. redisson.", "2.21.0") case class ConnectionConfig( initCommands: RedisBatch[Any] = RedisBatch.unit, sslEngineCreator: OptArg[() => SSLEngine] = OptArg.Empty,