From c9b4d29be876940748a1e17a659eb750dbb8fad6 Mon Sep 17 00:00:00 2001 From: Jey Date: Fri, 17 Jan 2025 02:59:54 +0300 Subject: [PATCH] 0.2.2 (#36) * Fixed casting issue caused by type erasure and wrong inlining. --- CHANGELOG.md | 4 ++ api/re.this.api | 56 +++++++++++++++-- api/re.this.klib.api | 62 +++++++++++++++++-- .../kotlin/eu/vendeli/rethis/ReThis.kt | 18 +++--- .../rethis/commands/SortedSetCommands.kt | 6 +- .../rethis/types/core/ClientConfiguration.kt | 2 +- .../rethis/types/core/ConnectionPool.kt | 3 +- .../eu/vendeli/rethis/types/core/RespCode.kt | 7 ++- .../eu/vendeli/rethis/utils/CommonUtils.kt | 6 +- .../eu/vendeli/rethis/utils/ResponseUtils.kt | 21 ++++--- .../tests/commands/SortedSetCommandTest.kt | 3 +- .../tests/commands/TransactionCommandTest.kt | 25 ++++---- .../rethis/tests/utils/RTypeResponseTest.kt | 9 ++- .../rethis/tests/utils/ResponseUtilsTest.kt | 30 ++++----- 14 files changed, 186 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de210e48..37992b33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Re.this Changelog +## 0.2.2 + +* Fixed casting issue caused by type erasure and wrong inlining. + ## 0.2.1 * Added connection retrying. diff --git a/api/re.this.api b/api/re.this.api index f706979a..b8f6aa8d 100644 --- a/api/re.this.api +++ b/api/re.this.api @@ -11,7 +11,7 @@ public final class eu/vendeli/rethis/ReThis { public final fun getSubscriptions ()Leu/vendeli/rethis/types/core/ActiveSubscriptions; public final fun isDisconnected ()Z public final fun pipeline (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public final fun reconnect ()Lkotlinx/coroutines/Job; + public final fun reconnect ()V public final fun transaction (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } @@ -703,6 +703,7 @@ public final class eu/vendeli/rethis/types/core/ActiveSubscriptions { } public abstract class eu/vendeli/rethis/types/core/Address { + public fun toString ()Ljava/lang/String; } public abstract interface class eu/vendeli/rethis/types/core/Argument { @@ -781,24 +782,26 @@ public final class eu/vendeli/rethis/types/core/BulkString : eu/vendeli/rethis/t public final class eu/vendeli/rethis/types/core/ClientConfiguration { public fun ()V - public fun (Ljava/lang/Integer;Ljava/nio/charset/Charset;Lio/ktor/network/tls/TLSConfig;Leu/vendeli/rethis/types/core/AuthConfiguration;Leu/vendeli/rethis/types/core/PoolConfiguration;)V - public synthetic fun (Ljava/lang/Integer;Ljava/nio/charset/Charset;Lio/ktor/network/tls/TLSConfig;Leu/vendeli/rethis/types/core/AuthConfiguration;Leu/vendeli/rethis/types/core/PoolConfiguration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/Integer;Ljava/nio/charset/Charset;Lio/ktor/network/tls/TLSConfig;Leu/vendeli/rethis/types/core/AuthConfiguration;Leu/vendeli/rethis/types/core/PoolConfiguration;Leu/vendeli/rethis/types/core/ReconnectionStrategyConfiguration;Leu/vendeli/rethis/types/core/SocketConfiguration;)V + public synthetic fun (Ljava/lang/Integer;Ljava/nio/charset/Charset;Lio/ktor/network/tls/TLSConfig;Leu/vendeli/rethis/types/core/AuthConfiguration;Leu/vendeli/rethis/types/core/PoolConfiguration;Leu/vendeli/rethis/types/core/ReconnectionStrategyConfiguration;Leu/vendeli/rethis/types/core/SocketConfiguration;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun auth (Ljava/lang/String;Ljava/lang/String;)V public static synthetic fun auth$default (Leu/vendeli/rethis/types/core/ClientConfiguration;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)V public final fun component1 ()Ljava/lang/Integer; public final fun component2 ()Ljava/nio/charset/Charset; public final fun component3 ()Lio/ktor/network/tls/TLSConfig; - public final fun copy (Ljava/lang/Integer;Ljava/nio/charset/Charset;Lio/ktor/network/tls/TLSConfig;Leu/vendeli/rethis/types/core/AuthConfiguration;Leu/vendeli/rethis/types/core/PoolConfiguration;)Leu/vendeli/rethis/types/core/ClientConfiguration; - public static synthetic fun copy$default (Leu/vendeli/rethis/types/core/ClientConfiguration;Ljava/lang/Integer;Ljava/nio/charset/Charset;Lio/ktor/network/tls/TLSConfig;Leu/vendeli/rethis/types/core/AuthConfiguration;Leu/vendeli/rethis/types/core/PoolConfiguration;ILjava/lang/Object;)Leu/vendeli/rethis/types/core/ClientConfiguration; + public final fun copy (Ljava/lang/Integer;Ljava/nio/charset/Charset;Lio/ktor/network/tls/TLSConfig;Leu/vendeli/rethis/types/core/AuthConfiguration;Leu/vendeli/rethis/types/core/PoolConfiguration;Leu/vendeli/rethis/types/core/ReconnectionStrategyConfiguration;Leu/vendeli/rethis/types/core/SocketConfiguration;)Leu/vendeli/rethis/types/core/ClientConfiguration; + public static synthetic fun copy$default (Leu/vendeli/rethis/types/core/ClientConfiguration;Ljava/lang/Integer;Ljava/nio/charset/Charset;Lio/ktor/network/tls/TLSConfig;Leu/vendeli/rethis/types/core/AuthConfiguration;Leu/vendeli/rethis/types/core/PoolConfiguration;Leu/vendeli/rethis/types/core/ReconnectionStrategyConfiguration;Leu/vendeli/rethis/types/core/SocketConfiguration;ILjava/lang/Object;)Leu/vendeli/rethis/types/core/ClientConfiguration; public fun equals (Ljava/lang/Object;)Z public final fun getCharset ()Ljava/nio/charset/Charset; public final fun getDb ()Ljava/lang/Integer; public final fun getTlsConfig ()Lio/ktor/network/tls/TLSConfig; public fun hashCode ()I public final fun pool (Lkotlin/jvm/functions/Function1;)V + public final fun reconnectionStrategy (Lkotlin/jvm/functions/Function1;)V public final fun setCharset (Ljava/nio/charset/Charset;)V public final fun setDb (Ljava/lang/Integer;)V public final fun setTlsConfig (Lio/ktor/network/tls/TLSConfig;)V + public final fun socket (Lkotlin/jvm/functions/Function1;)V public fun toString ()Ljava/lang/String; } @@ -981,6 +984,26 @@ public final class eu/vendeli/rethis/types/core/RType$Raw : eu/vendeli/rethis/ty public fun getValue ()[B } +public final class eu/vendeli/rethis/types/core/ReconnectionStrategyConfiguration { + public fun ()V + public fun (ZIJ)V + public synthetic fun (ZIJILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Z + public final fun component2 ()I + public final fun component3 ()J + public final fun copy (ZIJ)Leu/vendeli/rethis/types/core/ReconnectionStrategyConfiguration; + public static synthetic fun copy$default (Leu/vendeli/rethis/types/core/ReconnectionStrategyConfiguration;ZIJILjava/lang/Object;)Leu/vendeli/rethis/types/core/ReconnectionStrategyConfiguration; + public fun equals (Ljava/lang/Object;)Z + public final fun getDoHealthCheck ()Z + public final fun getReconnectAttempts ()I + public final fun getReconnectDelay ()J + public fun hashCode ()I + public final fun setDoHealthCheck (Z)V + public final fun setReconnectAttempts (I)V + public final fun setReconnectDelay (J)V + public fun toString ()Ljava/lang/String; +} + public abstract class eu/vendeli/rethis/types/core/RespVer { public synthetic fun (ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getLiteral ()I @@ -1000,6 +1023,29 @@ public final class eu/vendeli/rethis/types/core/RespVer$V3 : eu/vendeli/rethis/t public fun toString ()Ljava/lang/String; } +public final class eu/vendeli/rethis/types/core/SocketConfiguration { + public fun ()V + public fun (Ljava/lang/Long;Ljava/lang/Integer;ZZ)V + public synthetic fun (Ljava/lang/Long;Ljava/lang/Integer;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Ljava/lang/Long; + public final fun component2 ()Ljava/lang/Integer; + public final fun component3 ()Z + public final fun component4 ()Z + public final fun copy (Ljava/lang/Long;Ljava/lang/Integer;ZZ)Leu/vendeli/rethis/types/core/SocketConfiguration; + public static synthetic fun copy$default (Leu/vendeli/rethis/types/core/SocketConfiguration;Ljava/lang/Long;Ljava/lang/Integer;ZZILjava/lang/Object;)Leu/vendeli/rethis/types/core/SocketConfiguration; + public fun equals (Ljava/lang/Object;)Z + public final fun getKeepAlive ()Z + public final fun getLinger ()Ljava/lang/Integer; + public final fun getNoDelay ()Z + public final fun getTimeout ()Ljava/lang/Long; + public fun hashCode ()I + public final fun setKeepAlive (Z)V + public final fun setLinger (Ljava/lang/Integer;)V + public final fun setNoDelay (Z)V + public final fun setTimeout (Ljava/lang/Long;)V + public fun toString ()Ljava/lang/String; +} + public abstract interface class eu/vendeli/rethis/types/core/SubscriptionEventHandler { public abstract fun onException (Ljava/lang/String;Ljava/lang/Exception;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public abstract fun onSubscribe (Ljava/lang/String;JLkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/api/re.this.klib.api b/api/re.this.klib.api index d417d8f3..bbeb64b4 100644 --- a/api/re.this.klib.api +++ b/api/re.this.klib.api @@ -502,7 +502,7 @@ final class eu.vendeli.rethis.types.core/BulkString : eu.vendeli.rethis.types.co } final class eu.vendeli.rethis.types.core/ClientConfiguration { // eu.vendeli.rethis.types.core/ClientConfiguration|null[0] - constructor (kotlin/Int? = ..., io.ktor.utils.io.charsets/Charset = ..., io.ktor.network.tls/TLSConfig? = ..., eu.vendeli.rethis.types.core/AuthConfiguration? = ..., eu.vendeli.rethis.types.core/PoolConfiguration = ...) // eu.vendeli.rethis.types.core/ClientConfiguration.|(kotlin.Int?;io.ktor.utils.io.charsets.Charset;io.ktor.network.tls.TLSConfig?;eu.vendeli.rethis.types.core.AuthConfiguration?;eu.vendeli.rethis.types.core.PoolConfiguration){}[0] + constructor (kotlin/Int? = ..., io.ktor.utils.io.charsets/Charset = ..., io.ktor.network.tls/TLSConfig? = ..., eu.vendeli.rethis.types.core/AuthConfiguration? = ..., eu.vendeli.rethis.types.core/PoolConfiguration = ..., eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration = ..., eu.vendeli.rethis.types.core/SocketConfiguration = ...) // eu.vendeli.rethis.types.core/ClientConfiguration.|(kotlin.Int?;io.ktor.utils.io.charsets.Charset;io.ktor.network.tls.TLSConfig?;eu.vendeli.rethis.types.core.AuthConfiguration?;eu.vendeli.rethis.types.core.PoolConfiguration;eu.vendeli.rethis.types.core.ReconnectionStrategyConfiguration;eu.vendeli.rethis.types.core.SocketConfiguration){}[0] final var charset // eu.vendeli.rethis.types.core/ClientConfiguration.charset|{}charset[0] final fun (): io.ktor.utils.io.charsets/Charset // eu.vendeli.rethis.types.core/ClientConfiguration.charset.|(){}[0] @@ -518,10 +518,12 @@ final class eu.vendeli.rethis.types.core/ClientConfiguration { // eu.vendeli.ret final fun component1(): kotlin/Int? // eu.vendeli.rethis.types.core/ClientConfiguration.component1|component1(){}[0] final fun component2(): io.ktor.utils.io.charsets/Charset // eu.vendeli.rethis.types.core/ClientConfiguration.component2|component2(){}[0] final fun component3(): io.ktor.network.tls/TLSConfig? // eu.vendeli.rethis.types.core/ClientConfiguration.component3|component3(){}[0] - final fun copy(kotlin/Int? = ..., io.ktor.utils.io.charsets/Charset = ..., io.ktor.network.tls/TLSConfig? = ..., eu.vendeli.rethis.types.core/AuthConfiguration? = ..., eu.vendeli.rethis.types.core/PoolConfiguration = ...): eu.vendeli.rethis.types.core/ClientConfiguration // eu.vendeli.rethis.types.core/ClientConfiguration.copy|copy(kotlin.Int?;io.ktor.utils.io.charsets.Charset;io.ktor.network.tls.TLSConfig?;eu.vendeli.rethis.types.core.AuthConfiguration?;eu.vendeli.rethis.types.core.PoolConfiguration){}[0] + final fun copy(kotlin/Int? = ..., io.ktor.utils.io.charsets/Charset = ..., io.ktor.network.tls/TLSConfig? = ..., eu.vendeli.rethis.types.core/AuthConfiguration? = ..., eu.vendeli.rethis.types.core/PoolConfiguration = ..., eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration = ..., eu.vendeli.rethis.types.core/SocketConfiguration = ...): eu.vendeli.rethis.types.core/ClientConfiguration // eu.vendeli.rethis.types.core/ClientConfiguration.copy|copy(kotlin.Int?;io.ktor.utils.io.charsets.Charset;io.ktor.network.tls.TLSConfig?;eu.vendeli.rethis.types.core.AuthConfiguration?;eu.vendeli.rethis.types.core.PoolConfiguration;eu.vendeli.rethis.types.core.ReconnectionStrategyConfiguration;eu.vendeli.rethis.types.core.SocketConfiguration){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // eu.vendeli.rethis.types.core/ClientConfiguration.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // eu.vendeli.rethis.types.core/ClientConfiguration.hashCode|hashCode(){}[0] final fun pool(kotlin/Function1) // eu.vendeli.rethis.types.core/ClientConfiguration.pool|pool(kotlin.Function1){}[0] + final fun reconnectionStrategy(kotlin/Function1) // eu.vendeli.rethis.types.core/ClientConfiguration.reconnectionStrategy|reconnectionStrategy(kotlin.Function1){}[0] + final fun socket(kotlin/Function1) // eu.vendeli.rethis.types.core/ClientConfiguration.socket|socket(kotlin.Function1){}[0] final fun toString(): kotlin/String // eu.vendeli.rethis.types.core/ClientConfiguration.toString|toString(){}[0] } @@ -638,6 +640,54 @@ final class eu.vendeli.rethis.types.core/RSet : eu.vendeli.rethis.types.core/RTy final fun toString(): kotlin/String // eu.vendeli.rethis.types.core/RSet.toString|toString(){}[0] } +final class eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration { // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration|null[0] + constructor (kotlin/Boolean = ..., kotlin/Int = ..., kotlin/Long = ...) // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.|(kotlin.Boolean;kotlin.Int;kotlin.Long){}[0] + + final var doHealthCheck // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.doHealthCheck|{}doHealthCheck[0] + final fun (): kotlin/Boolean // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.doHealthCheck.|(){}[0] + final fun (kotlin/Boolean) // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.doHealthCheck.|(kotlin.Boolean){}[0] + final var reconnectAttempts // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.reconnectAttempts|{}reconnectAttempts[0] + final fun (): kotlin/Int // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.reconnectAttempts.|(){}[0] + final fun (kotlin/Int) // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.reconnectAttempts.|(kotlin.Int){}[0] + final var reconnectDelay // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.reconnectDelay|{}reconnectDelay[0] + final fun (): kotlin/Long // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.reconnectDelay.|(){}[0] + final fun (kotlin/Long) // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.reconnectDelay.|(kotlin.Long){}[0] + + final fun component1(): kotlin/Boolean // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.component1|component1(){}[0] + final fun component2(): kotlin/Int // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.component2|component2(){}[0] + final fun component3(): kotlin/Long // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.component3|component3(){}[0] + final fun copy(kotlin/Boolean = ..., kotlin/Int = ..., kotlin/Long = ...): eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.copy|copy(kotlin.Boolean;kotlin.Int;kotlin.Long){}[0] + final fun equals(kotlin/Any?): kotlin/Boolean // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.equals|equals(kotlin.Any?){}[0] + final fun hashCode(): kotlin/Int // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.hashCode|hashCode(){}[0] + final fun toString(): kotlin/String // eu.vendeli.rethis.types.core/ReconnectionStrategyConfiguration.toString|toString(){}[0] +} + +final class eu.vendeli.rethis.types.core/SocketConfiguration { // eu.vendeli.rethis.types.core/SocketConfiguration|null[0] + constructor (kotlin/Long? = ..., kotlin/Int? = ..., kotlin/Boolean = ..., kotlin/Boolean = ...) // eu.vendeli.rethis.types.core/SocketConfiguration.|(kotlin.Long?;kotlin.Int?;kotlin.Boolean;kotlin.Boolean){}[0] + + final var keepAlive // eu.vendeli.rethis.types.core/SocketConfiguration.keepAlive|{}keepAlive[0] + final fun (): kotlin/Boolean // eu.vendeli.rethis.types.core/SocketConfiguration.keepAlive.|(){}[0] + final fun (kotlin/Boolean) // eu.vendeli.rethis.types.core/SocketConfiguration.keepAlive.|(kotlin.Boolean){}[0] + final var linger // eu.vendeli.rethis.types.core/SocketConfiguration.linger|{}linger[0] + final fun (): kotlin/Int? // eu.vendeli.rethis.types.core/SocketConfiguration.linger.|(){}[0] + final fun (kotlin/Int?) // eu.vendeli.rethis.types.core/SocketConfiguration.linger.|(kotlin.Int?){}[0] + final var noDelay // eu.vendeli.rethis.types.core/SocketConfiguration.noDelay|{}noDelay[0] + final fun (): kotlin/Boolean // eu.vendeli.rethis.types.core/SocketConfiguration.noDelay.|(){}[0] + final fun (kotlin/Boolean) // eu.vendeli.rethis.types.core/SocketConfiguration.noDelay.|(kotlin.Boolean){}[0] + final var timeout // eu.vendeli.rethis.types.core/SocketConfiguration.timeout|{}timeout[0] + final fun (): kotlin/Long? // eu.vendeli.rethis.types.core/SocketConfiguration.timeout.|(){}[0] + final fun (kotlin/Long?) // eu.vendeli.rethis.types.core/SocketConfiguration.timeout.|(kotlin.Long?){}[0] + + final fun component1(): kotlin/Long? // eu.vendeli.rethis.types.core/SocketConfiguration.component1|component1(){}[0] + final fun component2(): kotlin/Int? // eu.vendeli.rethis.types.core/SocketConfiguration.component2|component2(){}[0] + final fun component3(): kotlin/Boolean // eu.vendeli.rethis.types.core/SocketConfiguration.component3|component3(){}[0] + final fun component4(): kotlin/Boolean // eu.vendeli.rethis.types.core/SocketConfiguration.component4|component4(){}[0] + final fun copy(kotlin/Long? = ..., kotlin/Int? = ..., kotlin/Boolean = ..., kotlin/Boolean = ...): eu.vendeli.rethis.types.core/SocketConfiguration // eu.vendeli.rethis.types.core/SocketConfiguration.copy|copy(kotlin.Long?;kotlin.Int?;kotlin.Boolean;kotlin.Boolean){}[0] + final fun equals(kotlin/Any?): kotlin/Boolean // eu.vendeli.rethis.types.core/SocketConfiguration.equals|equals(kotlin.Any?){}[0] + final fun hashCode(): kotlin/Int // eu.vendeli.rethis.types.core/SocketConfiguration.hashCode|hashCode(){}[0] + final fun toString(): kotlin/String // eu.vendeli.rethis.types.core/SocketConfiguration.toString|toString(){}[0] +} + final class eu.vendeli.rethis.types.core/UnixSocket : eu.vendeli.rethis.types.core/Address { // eu.vendeli.rethis.types.core/UnixSocket|null[0] constructor (kotlin/String) // eu.vendeli.rethis.types.core/UnixSocket.|(kotlin.String){}[0] } @@ -796,7 +846,7 @@ final class eu.vendeli.rethis/ReThis { // eu.vendeli.rethis/ReThis|null[0] final fun (): eu.vendeli.rethis.types.core/ActiveSubscriptions // eu.vendeli.rethis/ReThis.subscriptions.|(){}[0] final fun disconnect() // eu.vendeli.rethis/ReThis.disconnect|disconnect(){}[0] - final fun reconnect(): kotlinx.coroutines/Job // eu.vendeli.rethis/ReThis.reconnect|reconnect(){}[0] + final fun reconnect() // eu.vendeli.rethis/ReThis.reconnect|reconnect(){}[0] final suspend fun execute(kotlin.collections/List, kotlin/Boolean = ...): eu.vendeli.rethis.types.core/RType // eu.vendeli.rethis/ReThis.execute|execute(kotlin.collections.List;kotlin.Boolean){}[0] final suspend fun pipeline(kotlin.coroutines/SuspendFunction1): kotlin.collections/List // eu.vendeli.rethis/ReThis.pipeline|pipeline(kotlin.coroutines.SuspendFunction1){}[0] final suspend fun transaction(kotlin.coroutines/SuspendFunction1): kotlin.collections/List // eu.vendeli.rethis/ReThis.transaction|transaction(kotlin.coroutines.SuspendFunction1){}[0] @@ -855,7 +905,9 @@ final value class eu.vendeli.rethis.types.core/LongArg : eu.vendeli.rethis.types final fun toString(): kotlin/String // eu.vendeli.rethis.types.core/LongArg.toString|toString(){}[0] } -sealed class eu.vendeli.rethis.types.core/Address // eu.vendeli.rethis.types.core/Address|null[0] +sealed class eu.vendeli.rethis.types.core/Address { // eu.vendeli.rethis.types.core/Address|null[0] + open fun toString(): kotlin/String // eu.vendeli.rethis.types.core/Address.toString|toString(){}[0] +} sealed class eu.vendeli.rethis.types.core/RPrimitive : eu.vendeli.rethis.types.core/RType // eu.vendeli.rethis.types.core/RPrimitive|null[0] @@ -1827,7 +1879,7 @@ final suspend fun (eu.vendeli.rethis/ReThis).eu.vendeli.rethis.commands/zLexCoun final suspend fun (eu.vendeli.rethis/ReThis).eu.vendeli.rethis.commands/zMpop(eu.vendeli.rethis.types.options/ZPopCommonOption, kotlin/Array..., kotlin/Long? = ...): kotlin.collections/List // eu.vendeli.rethis.commands/zMpop|zMpop@eu.vendeli.rethis.ReThis(eu.vendeli.rethis.types.options.ZPopCommonOption;kotlin.Array...;kotlin.Long?){}[0] final suspend fun (eu.vendeli.rethis/ReThis).eu.vendeli.rethis.commands/zMscore(kotlin/String, kotlin/Array...): kotlin.collections/List // eu.vendeli.rethis.commands/zMscore|zMscore@eu.vendeli.rethis.ReThis(kotlin.String;kotlin.Array...){}[0] final suspend fun (eu.vendeli.rethis/ReThis).eu.vendeli.rethis.commands/zPopmax(kotlin/String, kotlin/Long? = ...): kotlin.collections/List // eu.vendeli.rethis.commands/zPopmax|zPopmax@eu.vendeli.rethis.ReThis(kotlin.String;kotlin.Long?){}[0] -final suspend fun (eu.vendeli.rethis/ReThis).eu.vendeli.rethis.commands/zPopmin(kotlin/String): kotlin.collections/List // eu.vendeli.rethis.commands/zPopmin|zPopmin@eu.vendeli.rethis.ReThis(kotlin.String){}[0] +final suspend fun (eu.vendeli.rethis/ReThis).eu.vendeli.rethis.commands/zPopmin(kotlin/String): kotlin.collections/Map // eu.vendeli.rethis.commands/zPopmin|zPopmin@eu.vendeli.rethis.ReThis(kotlin.String){}[0] final suspend fun (eu.vendeli.rethis/ReThis).eu.vendeli.rethis.commands/zPopmin(kotlin/String, kotlin/Long): kotlin.collections/List> // eu.vendeli.rethis.commands/zPopmin|zPopmin@eu.vendeli.rethis.ReThis(kotlin.String;kotlin.Long){}[0] final suspend fun (eu.vendeli.rethis/ReThis).eu.vendeli.rethis.commands/zRandmember(kotlin/String): kotlin/String? // eu.vendeli.rethis.commands/zRandmember|zRandmember@eu.vendeli.rethis.ReThis(kotlin.String){}[0] final suspend fun (eu.vendeli.rethis/ReThis).eu.vendeli.rethis.commands/zRandmember(kotlin/String, kotlin/Long): kotlin.collections/List // eu.vendeli.rethis.commands/zRandmember|zRandmember@eu.vendeli.rethis.ReThis(kotlin.String;kotlin.Long){}[0] diff --git a/src/commonMain/kotlin/eu/vendeli/rethis/ReThis.kt b/src/commonMain/kotlin/eu/vendeli/rethis/ReThis.kt index d6cf1e12..47f72522 100644 --- a/src/commonMain/kotlin/eu/vendeli/rethis/ReThis.kt +++ b/src/commonMain/kotlin/eu/vendeli/rethis/ReThis.kt @@ -60,7 +60,9 @@ class ReThis( val isDisconnected: Boolean get() = connectionPool.isEmpty fun disconnect() = connectionPool.disconnect() - fun reconnect() = connectionPool.prepare() + fun reconnect() { + if (connectionPool.isEmpty) connectionPool.prepare() + } suspend fun pipeline(block: suspend ReThis.() -> Unit): List { val responses = mutableListOf() @@ -128,7 +130,7 @@ class ReThis( conn.sendRequest(listOf("DISCARD".toArg())) require(conn.input.readRedisMessage(cfg.charset).value == "OK") logger.error("Transaction canceled", it) - return@use emptyList() + throw it } logger.debug("Transaction completed") @@ -144,20 +146,20 @@ class ReThis( handleRequest(payload)?.input?.readRedisMessage(cfg.charset, rawResponse) ?: RType.Null @JvmName("executeSimple") - internal suspend inline fun execute( + internal suspend inline fun execute( payload: List, - ): T? = handleRequest(payload)?.input?.processRedisSimpleResponse(cfg.charset) + ): T? = handleRequest(payload)?.input?.processRedisSimpleResponse(T::class, cfg.charset) @JvmName("executeList") - internal suspend inline fun execute( + internal suspend inline fun execute( payload: List, isCollectionResponse: Boolean = false, - ): List? = handleRequest(payload)?.input?.processRedisListResponse(cfg.charset) + ): List? = handleRequest(payload)?.input?.processRedisListResponse(T::class, cfg.charset) @JvmName("executeMap") - internal suspend inline fun execute( + internal suspend inline fun execute( payload: List, - ): Map? = handleRequest(payload)?.input?.processRedisMapResponse(cfg.charset) + ): Map? = handleRequest(payload)?.input?.processRedisMapResponse(K::class, V::class, cfg.charset) private suspend fun handleRequest( payload: List, diff --git a/src/commonMain/kotlin/eu/vendeli/rethis/commands/SortedSetCommands.kt b/src/commonMain/kotlin/eu/vendeli/rethis/commands/SortedSetCommands.kt index 16d07ddf..b5806bab 100644 --- a/src/commonMain/kotlin/eu/vendeli/rethis/commands/SortedSetCommands.kt +++ b/src/commonMain/kotlin/eu/vendeli/rethis/commands/SortedSetCommands.kt @@ -13,6 +13,7 @@ import eu.vendeli.rethis.types.options.ZPopCommonOption import eu.vendeli.rethis.types.options.ZRangeOption import eu.vendeli.rethis.utils.cast import eu.vendeli.rethis.utils.safeCast +import eu.vendeli.rethis.utils.unwrapRespIndMap import eu.vendeli.rethis.utils.writeArg suspend fun ReThis.bzMPop( @@ -232,13 +233,12 @@ suspend fun ReThis.zPopmax(key: String, count: Long? = null): List = MPopResult(name = item.first().unwrap()!!, poppedElements = item.last().unwrapSet().toList()) } -suspend fun ReThis.zPopmin(key: String): List = execute( +suspend fun ReThis.zPopmin(key: String): Map = execute( listOfNotNull( "ZPOPMIN".toArg(), key.toArg(), ), - isCollectionResponse = true, -) ?: emptyList() +).unwrapRespIndMap() ?: emptyMap() suspend fun ReThis.zPopmin(key: String, count: Long): List> = execute( listOfNotNull( diff --git a/src/commonMain/kotlin/eu/vendeli/rethis/types/core/ClientConfiguration.kt b/src/commonMain/kotlin/eu/vendeli/rethis/types/core/ClientConfiguration.kt index 06b51440..485dd618 100644 --- a/src/commonMain/kotlin/eu/vendeli/rethis/types/core/ClientConfiguration.kt +++ b/src/commonMain/kotlin/eu/vendeli/rethis/types/core/ClientConfiguration.kt @@ -25,7 +25,7 @@ data class ClientConfiguration( internal var auth: AuthConfiguration? = null, internal val poolConfiguration: PoolConfiguration = PoolConfiguration(), internal val reconnectionStrategy: ReconnectionStrategyConfiguration = ReconnectionStrategyConfiguration(), - internal val socketConfiguration: SocketConfiguration = SocketConfiguration() + internal val socketConfiguration: SocketConfiguration = SocketConfiguration(), ) { /** * Configures authentication for the client. diff --git a/src/commonMain/kotlin/eu/vendeli/rethis/types/core/ConnectionPool.kt b/src/commonMain/kotlin/eu/vendeli/rethis/types/core/ConnectionPool.kt index ef341f09..476ce7ce 100644 --- a/src/commonMain/kotlin/eu/vendeli/rethis/types/core/ConnectionPool.kt +++ b/src/commonMain/kotlin/eu/vendeli/rethis/types/core/ConnectionPool.kt @@ -41,8 +41,7 @@ internal class ConnectionPool( this@connect.keepAlive = keepAlive this@connect.noDelay = noDelay } - } - .let { socket -> + }.let { socket -> client.cfg.tlsConfig?.let { socket.tls(selector.coroutineContext, it) } ?: socket diff --git a/src/commonMain/kotlin/eu/vendeli/rethis/types/core/RespCode.kt b/src/commonMain/kotlin/eu/vendeli/rethis/types/core/RespCode.kt index f8a9c617..31e74cc3 100644 --- a/src/commonMain/kotlin/eu/vendeli/rethis/types/core/RespCode.kt +++ b/src/commonMain/kotlin/eu/vendeli/rethis/types/core/RespCode.kt @@ -1,6 +1,7 @@ package eu.vendeli.rethis.types.core import eu.vendeli.rethis.exception +import eu.vendeli.rethis.types.core.RespCode.entries internal enum class RespCode( val code: Byte, @@ -22,7 +23,9 @@ internal enum class RespCode( ; companion object { - fun fromCode(code: Byte): RespCode = - entries.find { it.code == code } ?: exception { "No suitable message type found" } + private val EntryMap = entries.associate { it.code to it } + fun fromCode(code: Byte): RespCode = EntryMap[code] ?: exception { + "No suitable message type found - ${code.toInt().toChar()}" + } } } diff --git a/src/commonMain/kotlin/eu/vendeli/rethis/utils/CommonUtils.kt b/src/commonMain/kotlin/eu/vendeli/rethis/utils/CommonUtils.kt index d5fbd639..831641ca 100644 --- a/src/commonMain/kotlin/eu/vendeli/rethis/utils/CommonUtils.kt +++ b/src/commonMain/kotlin/eu/vendeli/rethis/utils/CommonUtils.kt @@ -5,12 +5,12 @@ package eu.vendeli.rethis.utils import eu.vendeli.rethis.ReThis import eu.vendeli.rethis.types.core.* import eu.vendeli.rethis.types.coroutine.CoLocalConn -import io.ktor.utils.io.* import kotlinx.coroutines.currentCoroutineContext import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import kotlin.coroutines.CoroutineContext +import kotlin.reflect.KClass fun RType.isOk() = unwrap() == "OK" @@ -20,6 +20,10 @@ internal inline fun Any.cast(): T = this as T @Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE") internal inline fun Any.safeCast(): T? = this as? T +@Suppress("UNCHECKED_CAST", "NOTHING_TO_INLINE") +internal inline fun Any.safeCast(clazz: KClass): T? = + if (this::class == clazz) this as T else null + @Suppress("NOTHING_TO_INLINE") private inline fun String?.isEqTo(other: String) = if (this != null) { compareTo(other.lowercase()) == 0 diff --git a/src/commonMain/kotlin/eu/vendeli/rethis/utils/ResponseUtils.kt b/src/commonMain/kotlin/eu/vendeli/rethis/utils/ResponseUtils.kt index d601e6ad..cbb93d16 100644 --- a/src/commonMain/kotlin/eu/vendeli/rethis/utils/ResponseUtils.kt +++ b/src/commonMain/kotlin/eu/vendeli/rethis/utils/ResponseUtils.kt @@ -14,6 +14,7 @@ import io.ktor.utils.io.core.* import kotlinx.io.Buffer import kotlinx.io.readDecimalLong import kotlinx.io.readString +import kotlin.reflect.KClass internal suspend fun ByteReadChannel.readRedisMessage(charset: Charset, rawOnly: Boolean = false): RType { val type = RespCode.fromCode(readByte()) // Read the type byte (e.g., +, -, :, $, *) @@ -109,7 +110,8 @@ internal suspend fun ByteReadChannel.readRedisMessage(charset: Charset, rawOnly: } } -internal suspend inline fun ByteReadChannel.processRedisSimpleResponse( +internal suspend fun ByteReadChannel.processRedisSimpleResponse( + tClass: KClass, charset: Charset, ): T? { val type = RespCode.fromCode(readByte()) // Read the type byte (e.g., +, -, :, $, *) @@ -161,10 +163,11 @@ internal suspend inline fun ByteReadChannel.processRedisSimpleResponse( } else -> null - }?.safeCast() + }?.safeCast(tClass) } -internal suspend inline fun ByteReadChannel.processRedisListResponse( +internal suspend fun ByteReadChannel.processRedisListResponse( + tClass: KClass, charset: Charset, ): List? { val type = RespCode.fromCode(readByte()) // Read the type byte (e.g., +, -, :, $, *) @@ -175,7 +178,7 @@ internal suspend inline fun ByteReadChannel.processRedisListResponse( val arraySize = line.readDecimalLong() if (arraySize < 0) return null // Handle null array (`*-1`) List(arraySize.toInt()) { - processRedisSimpleResponse(charset) + processRedisSimpleResponse(tClass,charset) } // Recursively read each array element } @@ -183,7 +186,7 @@ internal suspend inline fun ByteReadChannel.processRedisListResponse( val setSize = line.readDecimalLong() if (setSize < 0) return null // Handle null set List(setSize.toInt()) { - processRedisSimpleResponse(charset) + processRedisSimpleResponse(tClass, charset) } } @@ -191,7 +194,7 @@ internal suspend inline fun ByteReadChannel.processRedisListResponse( val pushSize = line.readDecimalLong() if (pushSize < 0) return null // Handle null push message List(pushSize.toInt()) { - processRedisSimpleResponse(charset) + processRedisSimpleResponse(tClass, charset) } } @@ -200,6 +203,8 @@ internal suspend inline fun ByteReadChannel.processRedisListResponse( } internal suspend fun ByteReadChannel.processRedisMapResponse( + kClass: KClass, + vClass: KClass, charset: Charset, ): Map? { val type = RespCode.fromCode(readByte()) // Read the type byte (e.g., +, -, :, $, *) @@ -211,8 +216,8 @@ internal suspend fun ByteReadChannel.processRedisMapResponse( if (mapSize < 0) return null // Handle null map buildMap(mapSize.toInt()) { (1..mapSize.toInt()).forEach { - val key = processRedisSimpleResponse(charset) ?: exception { "Invalid map key" } - val value = processRedisSimpleResponse(charset) + val key = processRedisSimpleResponse(kClass, charset) ?: exception { "Invalid map key" } + val value = processRedisSimpleResponse(vClass, charset) put(key, value) } } diff --git a/src/jvmTest/kotlin/eu/vendeli/rethis/tests/commands/SortedSetCommandTest.kt b/src/jvmTest/kotlin/eu/vendeli/rethis/tests/commands/SortedSetCommandTest.kt index 7e695cfc..991208c9 100644 --- a/src/jvmTest/kotlin/eu/vendeli/rethis/tests/commands/SortedSetCommandTest.kt +++ b/src/jvmTest/kotlin/eu/vendeli/rethis/tests/commands/SortedSetCommandTest.kt @@ -7,6 +7,7 @@ import eu.vendeli.rethis.types.common.ScanResult import eu.vendeli.rethis.types.common.ZMember import eu.vendeli.rethis.types.common.ZPopResult import eu.vendeli.rethis.types.options.ZPopCommonOption +import io.kotest.matchers.maps.shouldContain import io.kotest.matchers.shouldBe class SortedSetCommandTest : ReThisTestCtx() { @@ -52,7 +53,7 @@ class SortedSetCommandTest : ReThisTestCtx() { suspend fun `test ZPOPMIN command`() { client.zAdd("testSet27", ZMember("testValue27", 1.0)) - client.zPopmin("testSet27") shouldBe listOf("testValue27", 1.0) + client.zPopmin("testSet27") shouldContain ("testValue27" to 1.0) } @Test diff --git a/src/jvmTest/kotlin/eu/vendeli/rethis/tests/commands/TransactionCommandTest.kt b/src/jvmTest/kotlin/eu/vendeli/rethis/tests/commands/TransactionCommandTest.kt index 8097b535..8adcaab7 100644 --- a/src/jvmTest/kotlin/eu/vendeli/rethis/tests/commands/TransactionCommandTest.kt +++ b/src/jvmTest/kotlin/eu/vendeli/rethis/tests/commands/TransactionCommandTest.kt @@ -3,12 +3,14 @@ package eu.vendeli.rethis.tests.commands import eu.vendeli.rethis.ReThisException import eu.vendeli.rethis.ReThisTestCtx import eu.vendeli.rethis.commands.* +import eu.vendeli.rethis.types.core.Int64 import eu.vendeli.rethis.types.core.PlainString import eu.vendeli.rethis.types.core.RArray import eu.vendeli.rethis.types.core.toArg import eu.vendeli.rethis.types.coroutine.CoLocalConn import eu.vendeli.rethis.utils.bufferValues import eu.vendeli.rethis.utils.readRedisMessage +import eu.vendeli.rethis.utils.sendRequest import io.kotest.assertions.throwables.shouldNotThrowAny import io.kotest.assertions.throwables.shouldThrow import io.kotest.matchers.collections.shouldHaveSize @@ -21,20 +23,16 @@ class TransactionCommandTest : ReThisTestCtx() { suspend fun `test EXEC command with multiple queued commands`() { val conn = client.connectionPool.acquire() - conn.output.writeBuffer(bufferValues(listOf("MULTI".toArg()), Charsets.UTF_8)) - conn.output.flush() + conn.sendRequest(bufferValues(listOf("MULTI".toArg()), Charsets.UTF_8)) conn.input.readRedisMessage(Charsets.UTF_8) shouldBe PlainString("OK") - conn.output.writeBuffer(bufferValues(listOf("SET".toArg(), "test3".toArg(), "testv3".toArg()), Charsets.UTF_8)) - conn.output.flush() + conn.sendRequest(bufferValues(listOf("SET".toArg(), "test3".toArg(), "testv3".toArg()), Charsets.UTF_8)) conn.input.readRedisMessage(Charsets.UTF_8) shouldBe PlainString("QUEUED") - conn.output.writeBuffer(bufferValues(listOf("SET".toArg(), "test4".toArg(), "testv4".toArg()), Charsets.UTF_8)) - conn.output.flush() + conn.sendRequest(bufferValues(listOf("SET".toArg(), "test4".toArg(), "testv4".toArg()), Charsets.UTF_8)) conn.input.readRedisMessage(Charsets.UTF_8) shouldBe PlainString("QUEUED") - conn.output.writeBuffer(bufferValues(listOf("EXEC".toArg()), Charsets.UTF_8)) - conn.output.flush() + conn.sendRequest(bufferValues(listOf("EXEC".toArg()), Charsets.UTF_8)) conn.input.readRedisMessage(Charsets.UTF_8) shouldBe RArray(listOf(PlainString("OK"), PlainString("OK"))) } @@ -42,9 +40,10 @@ class TransactionCommandTest : ReThisTestCtx() { suspend fun `test transaction util`() { client.transaction { client.set("testKey1", "testVal1") - client.set("testKey2", "testVal2") - client.set("testKey3", "testVal3") - } shouldBe listOf(PlainString("OK"), PlainString("OK"), PlainString("OK")) + set("testKey2", "testVal2") + set("testKey3", "testVal3") + del("testKey1") + } shouldBe listOf(PlainString("OK"), PlainString("OK"), PlainString("OK"), Int64(1)) } @Test @@ -65,14 +64,14 @@ class TransactionCommandTest : ReThisTestCtx() { } @Test - suspend fun `test transaction with queued commands that fail`() { + suspend fun `test transaction with queued commands that fail`() = shouldThrow { client.transaction { set("testKey1", "testVal1") set("testKey2", "testVal2") set("testKey2", "testVal2") jsonClear("test") } shouldHaveSize 0 - } + }.message shouldBe "ERR unknown command 'JSON.CLEAR', with args beginning with: 'test' " @Test suspend fun `test WATCH command with multiple keys`() { diff --git a/src/jvmTest/kotlin/eu/vendeli/rethis/tests/utils/RTypeResponseTest.kt b/src/jvmTest/kotlin/eu/vendeli/rethis/tests/utils/RTypeResponseTest.kt index e544a803..d67a5b9e 100644 --- a/src/jvmTest/kotlin/eu/vendeli/rethis/tests/utils/RTypeResponseTest.kt +++ b/src/jvmTest/kotlin/eu/vendeli/rethis/tests/utils/RTypeResponseTest.kt @@ -48,7 +48,11 @@ class RTypeResponseTest : ReThisTestCtx() { writeFully("!21\r\nSYNTAX invalid syntax\r\n".encodeToByteArray()) } - channel.readRedisMessage(charset).safeCast()?.exception?.message shouldBe "SYNTAX invalid syntax" + channel + .readRedisMessage(charset) + .safeCast() + ?.exception + ?.message shouldBe "SYNTAX invalid syntax" } @Test @@ -80,7 +84,8 @@ class RTypeResponseTest : ReThisTestCtx() { val result = channel.readRedisMessage(charset) result shouldBe RArray( listOf( - PlainString("first"), PlainString("second"), + PlainString("first"), + PlainString("second"), ), ) } diff --git a/src/jvmTest/kotlin/eu/vendeli/rethis/tests/utils/ResponseUtilsTest.kt b/src/jvmTest/kotlin/eu/vendeli/rethis/tests/utils/ResponseUtilsTest.kt index 30b76ab7..a206ef11 100644 --- a/src/jvmTest/kotlin/eu/vendeli/rethis/tests/utils/ResponseUtilsTest.kt +++ b/src/jvmTest/kotlin/eu/vendeli/rethis/tests/utils/ResponseUtilsTest.kt @@ -22,7 +22,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("+Hello, World!\r\n".encodeToByteArray()) } - val result = channel.processRedisSimpleResponse(charset) + val result = channel.processRedisSimpleResponse(String::class, charset) result shouldBe "Hello, World!" } @@ -32,7 +32,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("=15\r\ntxt:Some string\r\n".encodeToByteArray()) } - val result = channel.processRedisSimpleResponse(charset) + val result = channel.processRedisSimpleResponse(String::class, charset) result shouldBe "txt:Some string" } @@ -43,7 +43,7 @@ class ResponseUtilsTest : ReThisTestCtx() { } shouldThrow { - channel.processRedisSimpleResponse(charset) + channel.processRedisSimpleResponse(String::class, charset) }.message shouldBe "Error message" } @@ -54,7 +54,7 @@ class ResponseUtilsTest : ReThisTestCtx() { } shouldThrow { - channel.processRedisSimpleResponse(charset) + channel.processRedisSimpleResponse(String::class, charset) }.message shouldBe "SYNTAX invalid syntax" } @@ -64,7 +64,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully(":123\r\n".encodeToByteArray()) } - val result = channel.processRedisSimpleResponse(charset) + val result = channel.processRedisSimpleResponse(Long::class, charset) result shouldBe 123L } @@ -74,7 +74,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("$5\r\nHello\r\n".encodeToByteArray()) } - val result = channel.processRedisSimpleResponse(charset) + val result = channel.processRedisSimpleResponse(String::class, charset) result shouldBe "Hello" } @@ -84,7 +84,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("$-1\r\n".encodeToByteArray()) } - val result = channel.processRedisSimpleResponse(charset) + val result = channel.processRedisSimpleResponse(String::class, charset) result.shouldBeNull() } @@ -94,7 +94,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("_\r\n".encodeToByteArray()) } - val result = channel.processRedisSimpleResponse(charset) + val result = channel.processRedisSimpleResponse(String::class, charset) result.shouldBeNull() } @@ -104,7 +104,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("#t\r\n".encodeToByteArray()) } - val result = channel.processRedisSimpleResponse(charset) + val result = channel.processRedisSimpleResponse(Boolean::class, charset) result shouldBe true } @@ -114,7 +114,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully(",3.14\r\n".encodeToByteArray()) } - val result = channel.processRedisSimpleResponse(charset) + val result = channel.processRedisSimpleResponse(Double::class, charset) result shouldBe 3.14 } @@ -124,7 +124,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("(12345678901234567890\r\n".encodeToByteArray()) } - val result = channel.processRedisSimpleResponse(charset) + val result = channel.processRedisSimpleResponse(BigInteger::class, charset) result shouldBe "12345678901234567890".toBigInteger() } @@ -134,7 +134,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("*2\r\n$5\r\nHello\r\n$5\r\nWorld\r\n".encodeToByteArray()) } - val result = channel.processRedisListResponse(charset) + val result = channel.processRedisListResponse(String::class, charset) result shouldBe listOf("Hello", "World") } @@ -144,7 +144,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("~2\r\n$5\r\nHello\r\n$5\r\nWorld\r\n".encodeToByteArray()) } - val result = channel.processRedisListResponse(charset) + val result = channel.processRedisListResponse(String::class, charset) result shouldBe listOf("Hello", "World") } @@ -154,7 +154,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully(">2\r\n$5\r\nHello\r\n$5\r\nWorld\r\n".encodeToByteArray()) } - val result = channel.processRedisListResponse(charset) + val result = channel.processRedisListResponse(String::class, charset) result shouldBe listOf("Hello", "World") } @@ -164,7 +164,7 @@ class ResponseUtilsTest : ReThisTestCtx() { writeFully("%2\r\n+first\r\n:1\r\n+second\r\n:2\r\n".encodeToByteArray()) } - val result = channel.processRedisMapResponse(charset) + val result = channel.processRedisMapResponse(String::class, Long::class, charset) result shouldBe mapOf( "first" to 1L, "second" to 2L,