Skip to content

Commit

Permalink
RedisModulePipelineCommands (#2680)
Browse files Browse the repository at this point in the history
  • Loading branch information
AvitalFineRedis authored Oct 28, 2021
1 parent 80f5a57 commit 1eaefd6
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 4 deletions.
57 changes: 56 additions & 1 deletion src/main/java/redis/clients/jedis/ClusterPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@
import redis.clients.jedis.args.*;
import redis.clients.jedis.commands.PipelineBinaryCommands;
import redis.clients.jedis.commands.PipelineCommands;
import redis.clients.jedis.commands.RedisModulePipelineCommands;
import redis.clients.jedis.json.Path;
import redis.clients.jedis.params.*;
import redis.clients.jedis.providers.JedisClusterConnectionProvider;
import redis.clients.jedis.resps.*;
import redis.clients.jedis.search.IndexOptions;
import redis.clients.jedis.search.Query;
import redis.clients.jedis.search.Schema;
import redis.clients.jedis.search.SearchResult;
import redis.clients.jedis.stream.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class ClusterPipeline extends MultiNodePipelineBase implements PipelineCommands, PipelineBinaryCommands {
public class ClusterPipeline extends MultiNodePipelineBase implements PipelineCommands, PipelineBinaryCommands,
RedisModulePipelineCommands {

private final JedisClusterConnectionProvider provider;
private final RedisCommandObjects commandObjects;
Expand Down Expand Up @@ -2713,4 +2720,52 @@ public Response<LCSMatchResult> strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgo
throw new UnsupportedOperationException("Not supported yet.");
// return appendCommand(provider.getNode(key), commandObjects.strAlgoLCSStrings(keyA, keyB, params));
}

@Override
public Response<String> jsonSet(String key, Object object) {
return appendCommand(provider.getNode(key), commandObjects.jsonSet(key, object));
}

@Override
public Response<String> jsonSet(String key, Path path, Object object) {
return appendCommand(provider.getNode(key), commandObjects.jsonSet(key, path, object));
}

@Override
public <T> Response<T> jsonGet(String key, Class<T> clazz) {
return appendCommand(provider.getNode(key), commandObjects.jsonGet(key, clazz));
}

@Override
public <T> Response<T> jsonGet(String key, Class<T> clazz, Path... paths) {
return appendCommand(provider.getNode(key), commandObjects.jsonGet(key, clazz, paths));
}

@Override
public Response<Long> jsonDel(String key) {
return appendCommand(provider.getNode(key), commandObjects.jsonDel(key));
}

@Override
public Response<Long> jsonDel(String key, Path path) {
return appendCommand(provider.getNode(key), commandObjects.jsonDel(key, path));
}

@Override
public Response<String> ftCreate(String indexName, IndexOptions indexOptions, Schema schema) {
throw new UnsupportedOperationException("Not supported yet.");
//return appendCommand(provider.getNode(key), commandObjects.ftCreate(indexName, indexOptions, schema));
}

@Override
public Response<SearchResult> ftSearch(String indexName, Query query) {
throw new UnsupportedOperationException("Not supported yet.");
//return appendCommand(provider.getNode(key), commandObjects.ftCreate(indexName, query));
}

@Override
public Response<SearchResult> ftSearch(byte[] indexName, Query query) {
throw new UnsupportedOperationException("Not supported yet.");
//return appendCommand(provider.getNode(key), commandObjects.ftCreate(indexName, query));
}
}
54 changes: 53 additions & 1 deletion src/main/java/redis/clients/jedis/Pipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
import redis.clients.jedis.args.*;
import redis.clients.jedis.commands.PipelineBinaryCommands;
import redis.clients.jedis.commands.PipelineCommands;
import redis.clients.jedis.commands.RedisModulePipelineCommands;
import redis.clients.jedis.json.Path;
import redis.clients.jedis.params.*;
import redis.clients.jedis.resps.*;
import redis.clients.jedis.search.IndexOptions;
import redis.clients.jedis.search.Query;
import redis.clients.jedis.search.Schema;
import redis.clients.jedis.search.SearchResult;
import redis.clients.jedis.stream.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class Pipeline extends PipelineBase implements PipelineCommands, PipelineBinaryCommands {
public class Pipeline extends PipelineBase implements PipelineCommands, PipelineBinaryCommands,
RedisModulePipelineCommands {

private final RedisCommandObjects commandObjects;

Expand Down Expand Up @@ -2678,4 +2685,49 @@ public Response<Long> bitop(BitOP op, byte[] destKey, byte[]... srcKeys) {
public Response<LCSMatchResult> strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params) {
return appendCommand(commandObjects.strAlgoLCSStrings(keyA, keyB, params));
}

@Override
public Response<String> jsonSet(String key, Object object) {
return appendCommand(commandObjects.jsonSet(key, object));
}

@Override
public Response<String> jsonSet(String key, Path path, Object object) {
return appendCommand(commandObjects.jsonSet(key, path, object));
}

@Override
public <T> Response<T> jsonGet(String key, Class<T> clazz) {
return appendCommand(commandObjects.jsonGet(key, clazz));
}

@Override
public <T> Response<T> jsonGet(String key, Class<T> clazz, Path... paths) {
return appendCommand(commandObjects.jsonGet(key, clazz, paths));
}

@Override
public Response<Long> jsonDel(String key) {
return appendCommand(commandObjects.jsonDel(key));
}

@Override
public Response<Long> jsonDel(String key, Path path) {
return appendCommand(commandObjects.jsonDel(key, path));
}

@Override
public Response<String> ftCreate(String indexName, IndexOptions indexOptions, Schema schema) {
return appendCommand(commandObjects.ftCreate(indexName, indexOptions, schema));
}

@Override
public Response<SearchResult> ftSearch(String indexName, Query query) {
return appendCommand(commandObjects.ftSearch(indexName, query));
}

@Override
public Response<SearchResult> ftSearch(byte[] indexName, Query query) {
return appendCommand(commandObjects.ftSearch(indexName, query));
}
}
54 changes: 53 additions & 1 deletion src/main/java/redis/clients/jedis/ReliableTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
import redis.clients.jedis.args.*;
import redis.clients.jedis.commands.PipelineBinaryCommands;
import redis.clients.jedis.commands.PipelineCommands;
import redis.clients.jedis.commands.RedisModulePipelineCommands;
import redis.clients.jedis.json.Path;
import redis.clients.jedis.params.*;
import redis.clients.jedis.resps.*;
import redis.clients.jedis.search.IndexOptions;
import redis.clients.jedis.search.Query;
import redis.clients.jedis.search.Schema;
import redis.clients.jedis.search.SearchResult;
import redis.clients.jedis.stream.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class ReliableTransaction extends ReliableTransactionBase implements PipelineCommands, PipelineBinaryCommands {
public class ReliableTransaction extends ReliableTransactionBase implements PipelineCommands,
PipelineBinaryCommands, RedisModulePipelineCommands {

private final RedisCommandObjects commandObjects;

Expand Down Expand Up @@ -2678,4 +2685,49 @@ public Response<Long> bitop(BitOP op, byte[] destKey, byte[]... srcKeys) {
public Response<LCSMatchResult> strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params) {
return appendCommand(commandObjects.strAlgoLCSStrings(keyA, keyB, params));
}

@Override
public Response<String> jsonSet(String key, Object object) {
return appendCommand(commandObjects.jsonSet(key, object));
}

@Override
public Response<String> jsonSet(String key, Path path, Object object) {
return appendCommand(commandObjects.jsonSet(key, path, object));
}

@Override
public <T> Response<T> jsonGet(String key, Class<T> clazz) {
return appendCommand(commandObjects.jsonGet(key, clazz));
}

@Override
public <T> Response<T> jsonGet(String key, Class<T> clazz, Path... paths) {
return appendCommand(commandObjects.jsonGet(key, clazz, paths));
}

@Override
public Response<Long> jsonDel(String key) {
return appendCommand(commandObjects.jsonDel(key));
}

@Override
public Response<Long> jsonDel(String key, Path path) {
return appendCommand(commandObjects.jsonDel(key, path));
}

@Override
public Response<String> ftCreate(String indexName, IndexOptions indexOptions, Schema schema) {
return appendCommand(commandObjects.ftCreate(indexName, indexOptions, schema));
}

@Override
public Response<SearchResult> ftSearch(String indexName, Query query) {
return appendCommand(commandObjects.ftSearch(indexName, query));
}

@Override
public Response<SearchResult> ftSearch(byte[] indexName, Query query) {
return appendCommand(commandObjects.ftSearch(indexName, query));
}
}
54 changes: 53 additions & 1 deletion src/main/java/redis/clients/jedis/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
import redis.clients.jedis.args.*;
import redis.clients.jedis.commands.PipelineBinaryCommands;
import redis.clients.jedis.commands.PipelineCommands;
import redis.clients.jedis.commands.RedisModulePipelineCommands;
import redis.clients.jedis.json.Path;
import redis.clients.jedis.params.*;
import redis.clients.jedis.resps.*;
import redis.clients.jedis.search.IndexOptions;
import redis.clients.jedis.search.Query;
import redis.clients.jedis.search.Schema;
import redis.clients.jedis.search.SearchResult;
import redis.clients.jedis.stream.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

public class Transaction extends PipelinedTransactionBase implements PipelineCommands, PipelineBinaryCommands {
public class Transaction extends PipelinedTransactionBase implements PipelineCommands,
PipelineBinaryCommands, RedisModulePipelineCommands {

private final RedisCommandObjects commandObjects;

Expand Down Expand Up @@ -2678,4 +2685,49 @@ public Response<Long> bitop(BitOP op, byte[] destKey, byte[]... srcKeys) {
public Response<LCSMatchResult> strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params) {
return appendCommand(commandObjects.strAlgoLCSStrings(keyA, keyB, params));
}

@Override
public Response<String> jsonSet(String key, Object object) {
return appendCommand(commandObjects.jsonSet(key, object));
}

@Override
public Response<String> jsonSet(String key, Path path, Object object) {
return appendCommand(commandObjects.jsonSet(key, path, object));
}

@Override
public <T> Response<T> jsonGet(String key, Class<T> clazz) {
return appendCommand(commandObjects.jsonGet(key, clazz));
}

@Override
public <T> Response<T> jsonGet(String key, Class<T> clazz, Path... paths) {
return appendCommand(commandObjects.jsonGet(key, clazz, paths));
}

@Override
public Response<Long> jsonDel(String key) {
return appendCommand(commandObjects.jsonDel(key));
}

@Override
public Response<Long> jsonDel(String key, Path path) {
return appendCommand(commandObjects.jsonDel(key, path));
}

@Override
public Response<String> ftCreate(String indexName, IndexOptions indexOptions, Schema schema) {
return appendCommand(commandObjects.ftCreate(indexName, indexOptions, schema));
}

@Override
public Response<SearchResult> ftSearch(String indexName, Query query) {
return appendCommand(commandObjects.ftSearch(indexName, query));
}

@Override
public Response<SearchResult> ftSearch(byte[] indexName, Query query) {
return appendCommand(commandObjects.ftSearch(indexName, query));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package redis.clients.jedis.commands;

import redis.clients.jedis.json.RedisJsonPipelineCommands;
import redis.clients.jedis.search.RediSearchPipelineCommands;

public interface RedisModulePipelineCommands extends RediSearchPipelineCommands, RedisJsonPipelineCommands {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package redis.clients.jedis.json;

import redis.clients.jedis.Response;

public interface RedisJsonPipelineCommands {

Response<String> jsonSet(String key, Object object);

Response<String> jsonSet(String key, Path path, Object object);

<T> Response<T> jsonGet(String key, Class<T> clazz);

<T> Response<T> jsonGet(String key, Class<T> clazz, Path... paths);

Response<Long> jsonDel(String key);

Response<Long> jsonDel(String key, Path path);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package redis.clients.jedis.search;

import redis.clients.jedis.Response;

public interface RediSearchPipelineCommands {

Response<String> ftCreate(String indexName, IndexOptions indexOptions, Schema schema);

Response<SearchResult> ftSearch(String indexName, Query query);

Response<SearchResult> ftSearch(byte[] indexName, Query query);
}

0 comments on commit 1eaefd6

Please sign in to comment.