Skip to content

Commit

Permalink
Deprecate Triggers and Functions feature (#3968)
Browse files Browse the repository at this point in the history
* 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"
  • Loading branch information
sazzad16 committed Sep 26, 2024
1 parent f60814a commit 93928bb
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 10 deletions.
5 changes: 5 additions & 0 deletions src/main/java/redis/clients/jedis/CommandObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -4390,26 +4390,31 @@ public final CommandObject<Map<String, Object>> graphConfigGet(String configName
// RedisGraph commands

// RedisGears commands
@Deprecated
public final CommandObject<String> tFunctionLoad(String libraryCode, TFunctionLoadParams params) {
return new CommandObject<>(commandArguments(GearsCommand.TFUNCTION).add(GearsKeyword.LOAD)
.addParams(params).add(libraryCode), BuilderFactory.STRING);
}

@Deprecated
public final CommandObject<String> tFunctionDelete(String libraryName) {
return new CommandObject<>(commandArguments(GearsCommand.TFUNCTION).add(GearsKeyword.DELETE)
.add(libraryName), BuilderFactory.STRING);
}

@Deprecated
public final CommandObject<List<GearsLibraryInfo>> tFunctionList(TFunctionListParams params) {
return new CommandObject<>(commandArguments(GearsCommand.TFUNCTION).add(GearsKeyword.LIST)
.addParams(params), GearsLibraryInfo.GEARS_LIBRARY_INFO_LIST);
}

@Deprecated
public final CommandObject<Object> tFunctionCall(String library, String function, List<String> keys, List<String> 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<Object> tFunctionCallAsync(String library, String function, List<String> keys, List<String> args) {
return new CommandObject<>(commandArguments(GearsCommand.TFCALLASYNC).add(library + "." + function)
.add(keys.size()).keys(keys).addObjects(args), BuilderFactory.AGGRESSIVE_ENCODED_OBJECT);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/redis/clients/jedis/UnifiedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -4972,26 +4972,31 @@ public Map<String, Object> 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<GearsLibraryInfo> tFunctionList(TFunctionListParams params) {
return executeCommand(commandObjects.tFunctionList(params));
}

@Deprecated
@Override
public Object tFunctionCall(String library, String function, List<String> keys, List<String> args) {
return executeCommand(commandObjects.tFunctionCall(library, function, keys, args));
}

@Deprecated
@Override
public Object tFunctionCallAsync(String library, String function, List<String> keys, List<String> args) {
return executeCommand(commandObjects.tFunctionCallAsync(library, function, keys, args));
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/redis/clients/jedis/gears/RedisGearsCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<GearsLibraryInfo> tFunctionList() {
@Deprecated default List<GearsLibraryInfo> tFunctionList() {
return tFunctionList(TFunctionListParams.listParams());
}

List<GearsLibraryInfo> tFunctionList(TFunctionListParams params);
@Deprecated List<GearsLibraryInfo> tFunctionList(TFunctionListParams params);

String tFunctionDelete(String libraryName);
@Deprecated String tFunctionDelete(String libraryName);

Object tFunctionCall(String library, String function, List<String> keys, List<String> args);
@Deprecated Object tFunctionCall(String library, String function, List<String> keys, List<String> args);

Object tFunctionCallAsync(String library, String function, List<String> keys, List<String> args);
@Deprecated Object tFunctionCallAsync(String library, String function, List<String> keys, List<String> args);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -24,6 +26,7 @@ public byte[] getRaw() {
}
}

@Deprecated
public enum GearsKeyword implements Rawable {

CONFIG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.util.Collections;

@Deprecated
public class TFunctionListParams implements IParams {
private boolean withCode = false;
private int verbose;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import static redis.clients.jedis.BuilderFactory.*;

@Deprecated
public class FunctionInfo {
private final String name;
private final String description;
Expand Down Expand Up @@ -40,6 +41,7 @@ public FunctionInfo(String name, String description, boolean isAsync, List<Strin
this.flags = flags;
}

@Deprecated
public static final Builder<List<FunctionInfo>> FUNCTION_INFO_LIST = new Builder<List<FunctionInfo>>() {
@Override
public List<FunctionInfo> build(Object data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -67,6 +68,7 @@ public FunctionStreamInfo(String name, String idToReadFrom, String lastError,
this.pendingIds = pendingIds;
}

@Deprecated
public static final Builder<List<FunctionStreamInfo>> STREAM_INFO_LIST = new Builder<List<FunctionStreamInfo>>() {
@Override
public List<FunctionStreamInfo> build(Object data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> clusterFunctions;
Expand Down Expand Up @@ -90,6 +91,7 @@ public String getUser() {
return user;
}

@Deprecated
public static final Builder<GearsLibraryInfo> GEARS_LIBRARY_INFO = new Builder<GearsLibraryInfo>() {
@Override
public GearsLibraryInfo build(Object data) {
Expand Down Expand Up @@ -171,6 +173,7 @@ public GearsLibraryInfo build(Object data) {
}
};

@Deprecated
public static final Builder<List<GearsLibraryInfo>> GEARS_LIBRARY_INFO_LIST = new Builder<List<GearsLibraryInfo>>() {
@Override
public List<GearsLibraryInfo> build(Object data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<List<StreamTriggerInfo>> STREAM_TRIGGER_INFO_LIST = new Builder<List<StreamTriggerInfo>>() {
@Override
public List<StreamTriggerInfo> build(Object data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -80,6 +81,7 @@ public TriggerInfo(String name, String description, String lastError, long numFi
this.totalExecutionTime = totalExecutionTime;
}

@Deprecated
public static final Builder<List<TriggerInfo>> KEYSPACE_TRIGGER_INFO_LIST = new Builder<List<TriggerInfo>>() {
@Override
public List<TriggerInfo> build(Object data) {
Expand Down

0 comments on commit 93928bb

Please sign in to comment.