From 93928bb3701ba15297ce0449466aa214ebc9d8a5 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Thu, 26 Sep 2024 22:06:48 +0600 Subject: [PATCH] Deprecate Triggers and Functions feature (#3968) * Use redis:8.0-M01 image * Deprecate TFUNCTION commands * Deprecate TFCALL and TFCALLASYNC commands * Deprecate EVERYTHING about Gears module * Revert "Use redis:8.0-M01 image" --- .../java/redis/clients/jedis/CommandObjects.java | 5 +++++ .../java/redis/clients/jedis/UnifiedJedis.java | 5 +++++ .../clients/jedis/gears/RedisGearsCommands.java | 15 ++++++++------- .../clients/jedis/gears/RedisGearsProtocol.java | 9 ++++++--- .../clients/jedis/gears/TFunctionListParams.java | 1 + .../clients/jedis/gears/TFunctionLoadParams.java | 1 + .../clients/jedis/gears/resps/FunctionInfo.java | 2 ++ .../jedis/gears/resps/FunctionStreamInfo.java | 2 ++ .../jedis/gears/resps/GearsLibraryInfo.java | 3 +++ .../jedis/gears/resps/StreamTriggerInfo.java | 2 ++ .../clients/jedis/gears/resps/TriggerInfo.java | 2 ++ 11 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/main/java/redis/clients/jedis/CommandObjects.java b/src/main/java/redis/clients/jedis/CommandObjects.java index a413086f82..0a1f360133 100644 --- a/src/main/java/redis/clients/jedis/CommandObjects.java +++ b/src/main/java/redis/clients/jedis/CommandObjects.java @@ -4390,26 +4390,31 @@ public final CommandObject> graphConfigGet(String configName // RedisGraph commands // RedisGears commands + @Deprecated public final CommandObject tFunctionLoad(String libraryCode, TFunctionLoadParams params) { return new CommandObject<>(commandArguments(GearsCommand.TFUNCTION).add(GearsKeyword.LOAD) .addParams(params).add(libraryCode), BuilderFactory.STRING); } + @Deprecated public final CommandObject tFunctionDelete(String libraryName) { return new CommandObject<>(commandArguments(GearsCommand.TFUNCTION).add(GearsKeyword.DELETE) .add(libraryName), BuilderFactory.STRING); } + @Deprecated public final CommandObject> tFunctionList(TFunctionListParams params) { return new CommandObject<>(commandArguments(GearsCommand.TFUNCTION).add(GearsKeyword.LIST) .addParams(params), GearsLibraryInfo.GEARS_LIBRARY_INFO_LIST); } + @Deprecated public final CommandObject tFunctionCall(String library, String function, List keys, List args) { return new CommandObject<>(commandArguments(GearsCommand.TFCALL).add(library + "." + function) .add(keys.size()).keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); } + @Deprecated public final CommandObject tFunctionCallAsync(String library, String function, List keys, List args) { return new CommandObject<>(commandArguments(GearsCommand.TFCALLASYNC).add(library + "." + function) .add(keys.size()).keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT); diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index 07e5a01d70..cd8dc43dfc 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -4972,26 +4972,31 @@ public Map graphConfigGet(String configName) { // RedisGraph commands // RedisGears commands + @Deprecated @Override public String tFunctionLoad(String libraryCode, TFunctionLoadParams params) { return executeCommand(commandObjects.tFunctionLoad(libraryCode, params)); } + @Deprecated @Override public String tFunctionDelete(String libraryName) { return executeCommand(commandObjects.tFunctionDelete(libraryName)); } + @Deprecated @Override public List tFunctionList(TFunctionListParams params) { return executeCommand(commandObjects.tFunctionList(params)); } + @Deprecated @Override public Object tFunctionCall(String library, String function, List keys, List args) { return executeCommand(commandObjects.tFunctionCall(library, function, keys, args)); } + @Deprecated @Override public Object tFunctionCallAsync(String library, String function, List keys, List args) { return executeCommand(commandObjects.tFunctionCallAsync(library, function, keys, args)); diff --git a/src/main/java/redis/clients/jedis/gears/RedisGearsCommands.java b/src/main/java/redis/clients/jedis/gears/RedisGearsCommands.java index f5adb42c9e..e196835ab0 100644 --- a/src/main/java/redis/clients/jedis/gears/RedisGearsCommands.java +++ b/src/main/java/redis/clients/jedis/gears/RedisGearsCommands.java @@ -4,23 +4,24 @@ import java.util.List; +@Deprecated public interface RedisGearsCommands { - default String tFunctionLoad(String libraryCode) { + @Deprecated default String tFunctionLoad(String libraryCode) { return tFunctionLoad(libraryCode, TFunctionLoadParams.loadParams()); } - String tFunctionLoad(String libraryCode, TFunctionLoadParams params); + @Deprecated String tFunctionLoad(String libraryCode, TFunctionLoadParams params); - default List tFunctionList() { + @Deprecated default List tFunctionList() { return tFunctionList(TFunctionListParams.listParams()); } - List tFunctionList(TFunctionListParams params); + @Deprecated List tFunctionList(TFunctionListParams params); - String tFunctionDelete(String libraryName); + @Deprecated String tFunctionDelete(String libraryName); - Object tFunctionCall(String library, String function, List keys, List args); + @Deprecated Object tFunctionCall(String library, String function, List keys, List args); - Object tFunctionCallAsync(String library, String function, List keys, List args); + @Deprecated Object tFunctionCallAsync(String library, String function, List keys, List args); } diff --git a/src/main/java/redis/clients/jedis/gears/RedisGearsProtocol.java b/src/main/java/redis/clients/jedis/gears/RedisGearsProtocol.java index fc43f29e66..dfb73b04a9 100644 --- a/src/main/java/redis/clients/jedis/gears/RedisGearsProtocol.java +++ b/src/main/java/redis/clients/jedis/gears/RedisGearsProtocol.java @@ -4,13 +4,15 @@ import redis.clients.jedis.commands.ProtocolCommand; import redis.clients.jedis.util.SafeEncoder; +@Deprecated public class RedisGearsProtocol { + @Deprecated public enum GearsCommand implements ProtocolCommand { - TFUNCTION, - TFCALL, - TFCALLASYNC; + @Deprecated TFUNCTION, + @Deprecated TFCALL, + @Deprecated TFCALLASYNC; private final byte[] raw; @@ -24,6 +26,7 @@ public byte[] getRaw() { } } + @Deprecated public enum GearsKeyword implements Rawable { CONFIG, diff --git a/src/main/java/redis/clients/jedis/gears/TFunctionListParams.java b/src/main/java/redis/clients/jedis/gears/TFunctionListParams.java index d3f867e92b..e32bb43639 100644 --- a/src/main/java/redis/clients/jedis/gears/TFunctionListParams.java +++ b/src/main/java/redis/clients/jedis/gears/TFunctionListParams.java @@ -6,6 +6,7 @@ import java.util.Collections; +@Deprecated public class TFunctionListParams implements IParams { private boolean withCode = false; private int verbose; diff --git a/src/main/java/redis/clients/jedis/gears/TFunctionLoadParams.java b/src/main/java/redis/clients/jedis/gears/TFunctionLoadParams.java index d155727ec5..b8b0363b6e 100644 --- a/src/main/java/redis/clients/jedis/gears/TFunctionLoadParams.java +++ b/src/main/java/redis/clients/jedis/gears/TFunctionLoadParams.java @@ -4,6 +4,7 @@ import redis.clients.jedis.gears.RedisGearsProtocol.GearsKeyword; import redis.clients.jedis.params.IParams; +@Deprecated public class TFunctionLoadParams implements IParams { private boolean replace = false; private String config; diff --git a/src/main/java/redis/clients/jedis/gears/resps/FunctionInfo.java b/src/main/java/redis/clients/jedis/gears/resps/FunctionInfo.java index ccb8785812..24d47b0e4e 100644 --- a/src/main/java/redis/clients/jedis/gears/resps/FunctionInfo.java +++ b/src/main/java/redis/clients/jedis/gears/resps/FunctionInfo.java @@ -10,6 +10,7 @@ import static redis.clients.jedis.BuilderFactory.*; +@Deprecated public class FunctionInfo { private final String name; private final String description; @@ -40,6 +41,7 @@ public FunctionInfo(String name, String description, boolean isAsync, List> FUNCTION_INFO_LIST = new Builder>() { @Override public List build(Object data) { diff --git a/src/main/java/redis/clients/jedis/gears/resps/FunctionStreamInfo.java b/src/main/java/redis/clients/jedis/gears/resps/FunctionStreamInfo.java index f4b607d6a3..577a0992fc 100644 --- a/src/main/java/redis/clients/jedis/gears/resps/FunctionStreamInfo.java +++ b/src/main/java/redis/clients/jedis/gears/resps/FunctionStreamInfo.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.stream.Collectors; +@Deprecated public class FunctionStreamInfo { private final String name; private final String idToReadFrom; @@ -67,6 +68,7 @@ public FunctionStreamInfo(String name, String idToReadFrom, String lastError, this.pendingIds = pendingIds; } + @Deprecated public static final Builder> STREAM_INFO_LIST = new Builder>() { @Override public List build(Object data) { diff --git a/src/main/java/redis/clients/jedis/gears/resps/GearsLibraryInfo.java b/src/main/java/redis/clients/jedis/gears/resps/GearsLibraryInfo.java index 5ed6515ff6..d16a607cd2 100644 --- a/src/main/java/redis/clients/jedis/gears/resps/GearsLibraryInfo.java +++ b/src/main/java/redis/clients/jedis/gears/resps/GearsLibraryInfo.java @@ -12,6 +12,7 @@ import static redis.clients.jedis.gears.resps.StreamTriggerInfo.STREAM_TRIGGER_INFO_LIST; import static redis.clients.jedis.gears.resps.TriggerInfo.KEYSPACE_TRIGGER_INFO_LIST; +@Deprecated public class GearsLibraryInfo { private final String apiVersion; private final List clusterFunctions; @@ -90,6 +91,7 @@ public String getUser() { return user; } + @Deprecated public static final Builder GEARS_LIBRARY_INFO = new Builder() { @Override public GearsLibraryInfo build(Object data) { @@ -171,6 +173,7 @@ public GearsLibraryInfo build(Object data) { } }; + @Deprecated public static final Builder> GEARS_LIBRARY_INFO_LIST = new Builder>() { @Override public List build(Object data) { diff --git a/src/main/java/redis/clients/jedis/gears/resps/StreamTriggerInfo.java b/src/main/java/redis/clients/jedis/gears/resps/StreamTriggerInfo.java index be526e0e71..202d4bba4f 100644 --- a/src/main/java/redis/clients/jedis/gears/resps/StreamTriggerInfo.java +++ b/src/main/java/redis/clients/jedis/gears/resps/StreamTriggerInfo.java @@ -11,6 +11,7 @@ import static redis.clients.jedis.BuilderFactory.*; import static redis.clients.jedis.gears.resps.FunctionStreamInfo.STREAM_INFO_LIST; +@Deprecated public class StreamTriggerInfo { private final String name; private final String description; @@ -60,6 +61,7 @@ public StreamTriggerInfo(String name, String description, String prefix, this(name, description, prefix, window, trim, Collections.emptyList()); } + @Deprecated public static final Builder> STREAM_TRIGGER_INFO_LIST = new Builder>() { @Override public List build(Object data) { diff --git a/src/main/java/redis/clients/jedis/gears/resps/TriggerInfo.java b/src/main/java/redis/clients/jedis/gears/resps/TriggerInfo.java index 8a5b470484..775af5cecd 100644 --- a/src/main/java/redis/clients/jedis/gears/resps/TriggerInfo.java +++ b/src/main/java/redis/clients/jedis/gears/resps/TriggerInfo.java @@ -11,6 +11,7 @@ import static redis.clients.jedis.BuilderFactory.LONG; import static redis.clients.jedis.BuilderFactory.STRING; +@Deprecated public class TriggerInfo { private final String name; private final String description; @@ -80,6 +81,7 @@ public TriggerInfo(String name, String description, String lastError, long numFi this.totalExecutionTime = totalExecutionTime; } + @Deprecated public static final Builder> KEYSPACE_TRIGGER_INFO_LIST = new Builder>() { @Override public List build(Object data) {