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

Deprecate commons-redis #662

Merged
merged 6 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ on:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REDIS_VERSION: 6.2.12

jobs:
build:
Expand Down Expand Up @@ -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:
Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
[`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)
ddworak marked this conversation as resolved.
Show resolved Hide resolved
* `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
Expand Down
3 changes: 3 additions & 0 deletions docs/RedisDriver.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Redis driver

**⚠️ WARNING: This module is deprecated and scheduled for removal in a future release. Please migrate to an alternative
solution.**

`commons-redis` - Scala driver for Redis

```scala
Expand Down
9 changes: 0 additions & 9 deletions install-redis.sh

This file was deleted.

17 changes: 2 additions & 15 deletions project/Commons.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"))),
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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}
Expand All @@ -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
Expand All @@ -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. Use a different library, e.g. redisson.", "2.21.0")
ddworak marked this conversation as resolved.
Show resolved Hide resolved
final class RedisClusterClient(
val seedNodes: Seq[NodeAddress] = List(NodeAddress.Default),
val config: ClusterConfig = ClusterConfig(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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
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.
Expand All @@ -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. Use a different library, e.g. redisson.", "2.21.0")
final class RedisConnectionClient(
val address: NodeAddress = NodeAddress.Default,
val config: ConnectionConfig = ConnectionConfig(),
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down Expand Up @@ -54,6 +54,7 @@ trait RedisNodeExecutor extends RedisKeyedExecutor with RedisOpExecutor
*/
trait RedisConnectionExecutor extends RedisNodeExecutor

@deprecated("Redis driver is scheduled for removal. Use a different library, e.g. redisson.", "2.21.0")
abstract class RedisClient extends RedisExecutor with Closeable {
def initialized: Future[this.type]
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
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
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. Use a different library, e.g. redisson.", "2.21.0")
final class RedisNodeClient(
val address: NodeAddress = NodeAddress.Default,
val config: NodeConfig = NodeConfig(),
Expand Down
Original file line number Diff line number Diff line change
@@ -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]]
Expand Down Expand Up @@ -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. Use a different library, e.g. redisson.", "2.21.0")
case class ConnectionConfig(
initCommands: RedisBatch[Any] = RedisBatch.unit,
sslEngineCreator: OptArg[() => SSLEngine] = OptArg.Empty,
Expand Down
Loading