From db4bc590d4b3243f6db9cbe611049914e67ca3dc Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Mon, 7 Feb 2022 17:49:22 +0600 Subject: [PATCH] Add RedisBloom in Pipeline/Transaction --- .../clients/jedis/MultiNodePipelineBase.java | 192 ++++++++++++++- .../java/redis/clients/jedis/Pipeline.java | 226 +++++++++++++++-- .../redis/clients/jedis/TransactionBase.java | 231 ++++++++++++++++-- .../redis/clients/jedis/UnifiedJedis.java | 14 +- .../bloom/BloomFilterPipelineCommands.java | 26 ++ .../bloom/CountMinSketchPipelineCommands.java | 22 ++ .../jedis/bloom/CuckooFilterCommands.java | 2 - .../bloom/CuckooFilterPipelineCommands.java | 32 +++ .../bloom/RedisBloomPipelineCommands.java | 9 + .../bloom/TopKFilterPipelineCommands.java | 24 ++ .../commands/RedisModulePipelineCommands.java | 4 +- 11 files changed, 733 insertions(+), 49 deletions(-) create mode 100644 src/main/java/redis/clients/jedis/bloom/BloomFilterPipelineCommands.java create mode 100644 src/main/java/redis/clients/jedis/bloom/CountMinSketchPipelineCommands.java create mode 100644 src/main/java/redis/clients/jedis/bloom/CuckooFilterPipelineCommands.java create mode 100644 src/main/java/redis/clients/jedis/bloom/RedisBloomPipelineCommands.java create mode 100644 src/main/java/redis/clients/jedis/bloom/TopKFilterPipelineCommands.java diff --git a/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java b/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java index ac92615be1..026f70c0ba 100644 --- a/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java +++ b/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java @@ -7,10 +7,13 @@ import java.util.Map; import java.util.Queue; import java.util.Set; - import org.json.JSONArray; import redis.clients.jedis.args.*; +import redis.clients.jedis.bloom.BFInsertParams; +import redis.clients.jedis.bloom.BFReserveParams; +import redis.clients.jedis.bloom.CFInsertParams; +import redis.clients.jedis.bloom.CFReserveParams; import redis.clients.jedis.commands.PipelineBinaryCommands; import redis.clients.jedis.commands.PipelineCommands; import redis.clients.jedis.commands.RedisModulePipelineCommands; @@ -19,7 +22,10 @@ import redis.clients.jedis.json.Path2; import redis.clients.jedis.params.*; import redis.clients.jedis.resps.*; -import redis.clients.jedis.search.*; +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.search.aggr.AggregationBuilder; import redis.clients.jedis.search.aggr.AggregationResult; import redis.clients.jedis.timeseries.*; @@ -3543,6 +3549,188 @@ public Response> tsQueryIndex(String... filters) { } // RedisTimeSeries commands + // RedisBloom commands + @Override + public Response bfReserve(String key, double errorRate, long capacity) { + return appendCommand(commandObjects.bfReserve(key, errorRate, capacity)); + } + + @Override + public Response bfReserve(String key, double errorRate, long capacity, BFReserveParams reserveParams) { + return appendCommand(commandObjects.bfReserve(key, errorRate, capacity, reserveParams)); + } + + @Override + public Response bfAdd(String key, String item) { + return appendCommand(commandObjects.bfAdd(key, item)); + } + + @Override + public Response> bfMAdd(String key, String... items) { + return appendCommand(commandObjects.bfMAdd(key, items)); + } + + @Override + public Response> bfInsert(String key, String... items) { + return appendCommand(commandObjects.bfInsert(key, items)); + } + + @Override + public Response> bfInsert(String key, BFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.bfInsert(key, insertParams, items)); + } + + @Override + public Response bfExists(String key, String item) { + return appendCommand(commandObjects.bfExists(key, item)); + } + + @Override + public Response> bfMExists(String key, String... items) { + return appendCommand(commandObjects.bfMExists(key, items)); + } + + @Override + public Response> bfInfo(String key) { + return appendCommand(commandObjects.bfInfo(key)); + } + + @Override + public Response cfReserve(String key, long capacity) { + return appendCommand(commandObjects.cfReserve(key, capacity)); + } + + @Override + public Response cfReserve(String key, long capacity, CFReserveParams reserveParams) { + return appendCommand(commandObjects.cfReserve(key, capacity, reserveParams)); + } + + @Override + public Response cfAdd(String key, String item) { + return appendCommand(commandObjects.cfAdd(key, item)); + } + + @Override + public Response cfAddNx(String key, String item) { + return appendCommand(commandObjects.cfAddNx(key, item)); + } + + @Override + public Response> cfInsert(String key, String... items) { + return appendCommand(commandObjects.cfInsert(key, items)); + } + + @Override + public Response> cfInsert(String key, CFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.cfInsert(key, insertParams, items)); + } + + @Override + public Response> cfInsertNx(String key, String... items) { + return appendCommand(commandObjects.cfInsertNx(key, items)); + } + + @Override + public Response> cfInsertNx(String key, CFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.cfInsertNx(key, insertParams, items)); + } + + @Override + public Response cfExists(String key, String item) { + return appendCommand(commandObjects.cfExists(key, item)); + } + + @Override + public Response cfDel(String key, String item) { + return appendCommand(commandObjects.cfDel(key, item)); + } + + @Override + public Response cfCount(String key, String item) { + return appendCommand(commandObjects.cfCount(key, item)); + } + + @Override + public Response> cfInfo(String key) { + return appendCommand(commandObjects.cfInfo(key)); + } + + @Override + public Response cmsInitByDim(String key, long width, long depth) { + return appendCommand(commandObjects.cmsInitByDim(key, width, depth)); + } + + @Override + public Response cmsInitByProb(String key, double error, double probability) { + return appendCommand(commandObjects.cmsInitByProb(key, error, probability)); + } + + @Override + public Response> cmsIncrBy(String key, Map itemIncrements) { + return appendCommand(commandObjects.cmsIncrBy(key, itemIncrements)); + } + + @Override + public Response> cmsQuery(String key, String... items) { + return appendCommand(commandObjects.cmsQuery(key, items)); + } + + @Override + public Response cmsMerge(String destKey, String... keys) { + return appendCommand(commandObjects.cmsMerge(destKey, keys)); + } + + @Override + public Response cmsMerge(String destKey, Map keysAndWeights) { + return appendCommand(commandObjects.cmsMerge(destKey, keysAndWeights)); + } + + @Override + public Response> cmsInfo(String key) { + return appendCommand(commandObjects.cmsInfo(key)); + } + + @Override + public Response topkReserve(String key, long topk) { + return appendCommand(commandObjects.topkReserve(key, topk)); + } + + @Override + public Response topkReserve(String key, long topk, long width, long depth, double decay) { + return appendCommand(commandObjects.topkReserve(key, topk, width, depth, decay)); + } + + @Override + public Response> topkAdd(String key, String... items) { + return appendCommand(commandObjects.topkAdd(key, items)); + } + + @Override + public Response> topkIncrBy(String key, Map itemIncrements) { + return appendCommand(commandObjects.topkIncrBy(key, itemIncrements)); + } + + @Override + public Response> topkQuery(String key, String... items) { + return appendCommand(commandObjects.topkQuery(key, items)); + } + + @Override + public Response> topkCount(String key, String... items) { + return appendCommand(commandObjects.topkCount(key, items)); + } + + @Override + public Response> topkList(String key) { + return appendCommand(commandObjects.topkList(key)); + } + + @Override + public Response> topkInfo(String key) { + return appendCommand(commandObjects.topkInfo(key)); + } + // RedisBloom commands + public Response waitReplicas(int replicas, long timeout) { return appendCommand(commandObjects.waitReplicas(replicas, timeout)); } diff --git a/src/main/java/redis/clients/jedis/Pipeline.java b/src/main/java/redis/clients/jedis/Pipeline.java index 89e8145a45..2e24c23513 100644 --- a/src/main/java/redis/clients/jedis/Pipeline.java +++ b/src/main/java/redis/clients/jedis/Pipeline.java @@ -8,6 +8,10 @@ import org.json.JSONArray; import redis.clients.jedis.args.*; +import redis.clients.jedis.bloom.BFInsertParams; +import redis.clients.jedis.bloom.BFReserveParams; +import redis.clients.jedis.bloom.CFInsertParams; +import redis.clients.jedis.bloom.CFReserveParams; import redis.clients.jedis.commands.DatabasePipelineCommands; import redis.clients.jedis.commands.PipelineBinaryCommands; import redis.clients.jedis.commands.PipelineCommands; @@ -3454,105 +3458,287 @@ public Response jsonArrPop(String key, Path path) { // RedisTimeSeries commands @Override public Response tsCreate(String key) { - return executeCommand(commandObjects.tsCreate(key)); + return appendCommand(commandObjects.tsCreate(key)); } @Override public Response tsCreate(String key, TSCreateParams createParams) { - return executeCommand(commandObjects.tsCreate(key, createParams)); + return appendCommand(commandObjects.tsCreate(key, createParams)); } @Override public Response tsDel(String key, long fromTimestamp, long toTimestamp) { - return executeCommand(commandObjects.tsDel(key, fromTimestamp, toTimestamp)); + return appendCommand(commandObjects.tsDel(key, fromTimestamp, toTimestamp)); } @Override public Response tsAlter(String key, TSAlterParams alterParams) { - return executeCommand(commandObjects.tsAlter(key, alterParams)); + return appendCommand(commandObjects.tsAlter(key, alterParams)); } @Override public Response tsAdd(String key, double value) { - return executeCommand(commandObjects.tsAdd(key, value)); + return appendCommand(commandObjects.tsAdd(key, value)); } @Override public Response tsAdd(String key, long timestamp, double value) { - return executeCommand(commandObjects.tsAdd(key, timestamp, value)); + return appendCommand(commandObjects.tsAdd(key, timestamp, value)); } @Override public Response tsAdd(String key, long timestamp, double value, TSCreateParams createParams) { - return executeCommand(commandObjects.tsAdd(key, timestamp, value, createParams)); + return appendCommand(commandObjects.tsAdd(key, timestamp, value, createParams)); } @Override public Response> tsRange(String key, long fromTimestamp, long toTimestamp) { - return executeCommand(commandObjects.tsRange(key, fromTimestamp, toTimestamp)); + return appendCommand(commandObjects.tsRange(key, fromTimestamp, toTimestamp)); } @Override public Response> tsRange(String key, TSRangeParams rangeParams) { - return executeCommand(commandObjects.tsRange(key, rangeParams)); + return appendCommand(commandObjects.tsRange(key, rangeParams)); } @Override public Response> tsRevRange(String key, long fromTimestamp, long toTimestamp) { - return executeCommand(commandObjects.tsRevRange(key, fromTimestamp, toTimestamp)); + return appendCommand(commandObjects.tsRevRange(key, fromTimestamp, toTimestamp)); } @Override public Response> tsRevRange(String key, TSRangeParams rangeParams) { - return executeCommand(commandObjects.tsRevRange(key, rangeParams)); + return appendCommand(commandObjects.tsRevRange(key, rangeParams)); } @Override public Response> tsMRange(long fromTimestamp, long toTimestamp, String... filters) { - return executeCommand(commandObjects.tsMRange(fromTimestamp, toTimestamp, filters)); + return appendCommand(commandObjects.tsMRange(fromTimestamp, toTimestamp, filters)); } @Override public Response> tsMRange(TSMRangeParams multiRangeParams) { - return executeCommand(commandObjects.tsMRange(multiRangeParams)); + return appendCommand(commandObjects.tsMRange(multiRangeParams)); } @Override public Response> tsMRevRange(long fromTimestamp, long toTimestamp, String... filters) { - return executeCommand(commandObjects.tsMRevRange(fromTimestamp, toTimestamp, filters)); + return appendCommand(commandObjects.tsMRevRange(fromTimestamp, toTimestamp, filters)); } @Override public Response> tsMRevRange(TSMRangeParams multiRangeParams) { - return executeCommand(commandObjects.tsMRevRange(multiRangeParams)); + return appendCommand(commandObjects.tsMRevRange(multiRangeParams)); } @Override public Response tsGet(String key) { - return executeCommand(commandObjects.tsGet(key)); + return appendCommand(commandObjects.tsGet(key)); } @Override public Response> tsMGet(TSMGetParams multiGetParams, String... filters) { - return executeCommand(commandObjects.tsMGet(multiGetParams, filters)); + return appendCommand(commandObjects.tsMGet(multiGetParams, filters)); } @Override public Response tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long timeBucket) { - return executeCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, timeBucket)); + return appendCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, timeBucket)); } @Override public Response tsDeleteRule(String sourceKey, String destKey) { - return executeCommand(commandObjects.tsDeleteRule(sourceKey, destKey)); + return appendCommand(commandObjects.tsDeleteRule(sourceKey, destKey)); } @Override public Response> tsQueryIndex(String... filters) { - return executeCommand(commandObjects.tsQueryIndex(filters)); + return appendCommand(commandObjects.tsQueryIndex(filters)); } // RedisTimeSeries commands + // RedisBloom commands + @Override + public Response bfReserve(String key, double errorRate, long capacity) { + return appendCommand(commandObjects.bfReserve(key, errorRate, capacity)); + } + + @Override + public Response bfReserve(String key, double errorRate, long capacity, BFReserveParams reserveParams) { + return appendCommand(commandObjects.bfReserve(key, errorRate, capacity, reserveParams)); + } + + @Override + public Response bfAdd(String key, String item) { + return appendCommand(commandObjects.bfAdd(key, item)); + } + + @Override + public Response> bfMAdd(String key, String... items) { + return appendCommand(commandObjects.bfMAdd(key, items)); + } + + @Override + public Response> bfInsert(String key, String... items) { + return appendCommand(commandObjects.bfInsert(key, items)); + } + + @Override + public Response> bfInsert(String key, BFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.bfInsert(key, insertParams, items)); + } + + @Override + public Response bfExists(String key, String item) { + return appendCommand(commandObjects.bfExists(key, item)); + } + + @Override + public Response> bfMExists(String key, String... items) { + return appendCommand(commandObjects.bfMExists(key, items)); + } + + @Override + public Response> bfInfo(String key) { + return appendCommand(commandObjects.bfInfo(key)); + } + + @Override + public Response cfReserve(String key, long capacity) { + return appendCommand(commandObjects.cfReserve(key, capacity)); + } + + @Override + public Response cfReserve(String key, long capacity, CFReserveParams reserveParams) { + return appendCommand(commandObjects.cfReserve(key, capacity, reserveParams)); + } + + @Override + public Response cfAdd(String key, String item) { + return appendCommand(commandObjects.cfAdd(key, item)); + } + + @Override + public Response cfAddNx(String key, String item) { + return appendCommand(commandObjects.cfAddNx(key, item)); + } + + @Override + public Response> cfInsert(String key, String... items) { + return appendCommand(commandObjects.cfInsert(key, items)); + } + + @Override + public Response> cfInsert(String key, CFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.cfInsert(key, insertParams, items)); + } + + @Override + public Response> cfInsertNx(String key, String... items) { + return appendCommand(commandObjects.cfInsertNx(key, items)); + } + + @Override + public Response> cfInsertNx(String key, CFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.cfInsertNx(key, insertParams, items)); + } + + @Override + public Response cfExists(String key, String item) { + return appendCommand(commandObjects.cfExists(key, item)); + } + + @Override + public Response cfDel(String key, String item) { + return appendCommand(commandObjects.cfDel(key, item)); + } + + @Override + public Response cfCount(String key, String item) { + return appendCommand(commandObjects.cfCount(key, item)); + } + + @Override + public Response> cfInfo(String key) { + return appendCommand(commandObjects.cfInfo(key)); + } + + @Override + public Response cmsInitByDim(String key, long width, long depth) { + return appendCommand(commandObjects.cmsInitByDim(key, width, depth)); + } + + @Override + public Response cmsInitByProb(String key, double error, double probability) { + return appendCommand(commandObjects.cmsInitByProb(key, error, probability)); + } + + @Override + public Response> cmsIncrBy(String key, Map itemIncrements) { + return appendCommand(commandObjects.cmsIncrBy(key, itemIncrements)); + } + + @Override + public Response> cmsQuery(String key, String... items) { + return appendCommand(commandObjects.cmsQuery(key, items)); + } + + @Override + public Response cmsMerge(String destKey, String... keys) { + return appendCommand(commandObjects.cmsMerge(destKey, keys)); + } + + @Override + public Response cmsMerge(String destKey, Map keysAndWeights) { + return appendCommand(commandObjects.cmsMerge(destKey, keysAndWeights)); + } + + @Override + public Response> cmsInfo(String key) { + return appendCommand(commandObjects.cmsInfo(key)); + } + + @Override + public Response topkReserve(String key, long topk) { + return appendCommand(commandObjects.topkReserve(key, topk)); + } + + @Override + public Response topkReserve(String key, long topk, long width, long depth, double decay) { + return appendCommand(commandObjects.topkReserve(key, topk, width, depth, decay)); + } + + @Override + public Response> topkAdd(String key, String... items) { + return appendCommand(commandObjects.topkAdd(key, items)); + } + + @Override + public Response> topkIncrBy(String key, Map itemIncrements) { + return appendCommand(commandObjects.topkIncrBy(key, itemIncrements)); + } + + @Override + public Response> topkQuery(String key, String... items) { + return appendCommand(commandObjects.topkQuery(key, items)); + } + + @Override + public Response> topkCount(String key, String... items) { + return appendCommand(commandObjects.topkCount(key, items)); + } + + @Override + public Response> topkList(String key) { + return appendCommand(commandObjects.topkList(key)); + } + + @Override + public Response> topkInfo(String key) { + return appendCommand(commandObjects.topkInfo(key)); + } + // RedisBloom commands + public Response waitReplicas(int replicas, long timeout) { return appendCommand(commandObjects.waitReplicas(replicas, timeout)); } diff --git a/src/main/java/redis/clients/jedis/TransactionBase.java b/src/main/java/redis/clients/jedis/TransactionBase.java index 7c57172f58..5f40edb25a 100644 --- a/src/main/java/redis/clients/jedis/TransactionBase.java +++ b/src/main/java/redis/clients/jedis/TransactionBase.java @@ -14,6 +14,10 @@ import org.json.JSONArray; import redis.clients.jedis.args.*; +import redis.clients.jedis.bloom.BFInsertParams; +import redis.clients.jedis.bloom.BFReserveParams; +import redis.clients.jedis.bloom.CFInsertParams; +import redis.clients.jedis.bloom.CFReserveParams; import redis.clients.jedis.commands.PipelineBinaryCommands; import redis.clients.jedis.commands.PipelineCommands; import redis.clients.jedis.commands.ProtocolCommand; @@ -25,7 +29,10 @@ import redis.clients.jedis.json.Path2; import redis.clients.jedis.params.*; import redis.clients.jedis.resps.*; -import redis.clients.jedis.search.*; +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.search.aggr.AggregationBuilder; import redis.clients.jedis.search.aggr.AggregationResult; import redis.clients.jedis.timeseries.*; @@ -3520,105 +3527,287 @@ public Response jsonArrPop(String key, Path path) { // RedisTimeSeries commands @Override public Response tsCreate(String key) { - return executeCommand(commandObjects.tsCreate(key)); + return appendCommand(commandObjects.tsCreate(key)); } @Override public Response tsCreate(String key, TSCreateParams createParams) { - return executeCommand(commandObjects.tsCreate(key, createParams)); + return appendCommand(commandObjects.tsCreate(key, createParams)); } @Override public Response tsDel(String key, long fromTimestamp, long toTimestamp) { - return executeCommand(commandObjects.tsDel(key, fromTimestamp, toTimestamp)); + return appendCommand(commandObjects.tsDel(key, fromTimestamp, toTimestamp)); } @Override public Response tsAlter(String key, TSAlterParams alterParams) { - return executeCommand(commandObjects.tsAlter(key, alterParams)); + return appendCommand(commandObjects.tsAlter(key, alterParams)); } @Override public Response tsAdd(String key, double value) { - return executeCommand(commandObjects.tsAdd(key, value)); + return appendCommand(commandObjects.tsAdd(key, value)); } @Override public Response tsAdd(String key, long timestamp, double value) { - return executeCommand(commandObjects.tsAdd(key, timestamp, value)); + return appendCommand(commandObjects.tsAdd(key, timestamp, value)); } @Override public Response tsAdd(String key, long timestamp, double value, TSCreateParams createParams) { - return executeCommand(commandObjects.tsAdd(key, timestamp, value, createParams)); + return appendCommand(commandObjects.tsAdd(key, timestamp, value, createParams)); } @Override public Response> tsRange(String key, long fromTimestamp, long toTimestamp) { - return executeCommand(commandObjects.tsRange(key, fromTimestamp, toTimestamp)); + return appendCommand(commandObjects.tsRange(key, fromTimestamp, toTimestamp)); } @Override public Response> tsRange(String key, TSRangeParams rangeParams) { - return executeCommand(commandObjects.tsRange(key, rangeParams)); + return appendCommand(commandObjects.tsRange(key, rangeParams)); } @Override public Response> tsRevRange(String key, long fromTimestamp, long toTimestamp) { - return executeCommand(commandObjects.tsRevRange(key, fromTimestamp, toTimestamp)); + return appendCommand(commandObjects.tsRevRange(key, fromTimestamp, toTimestamp)); } @Override public Response> tsRevRange(String key, TSRangeParams rangeParams) { - return executeCommand(commandObjects.tsRevRange(key, rangeParams)); + return appendCommand(commandObjects.tsRevRange(key, rangeParams)); } @Override public Response> tsMRange(long fromTimestamp, long toTimestamp, String... filters) { - return executeCommand(commandObjects.tsMRange(fromTimestamp, toTimestamp, filters)); + return appendCommand(commandObjects.tsMRange(fromTimestamp, toTimestamp, filters)); } @Override public Response> tsMRange(TSMRangeParams multiRangeParams) { - return executeCommand(commandObjects.tsMRange(multiRangeParams)); + return appendCommand(commandObjects.tsMRange(multiRangeParams)); } @Override public Response> tsMRevRange(long fromTimestamp, long toTimestamp, String... filters) { - return executeCommand(commandObjects.tsMRevRange(fromTimestamp, toTimestamp, filters)); + return appendCommand(commandObjects.tsMRevRange(fromTimestamp, toTimestamp, filters)); } @Override public Response> tsMRevRange(TSMRangeParams multiRangeParams) { - return executeCommand(commandObjects.tsMRevRange(multiRangeParams)); + return appendCommand(commandObjects.tsMRevRange(multiRangeParams)); } @Override public Response tsGet(String key) { - return executeCommand(commandObjects.tsGet(key)); + return appendCommand(commandObjects.tsGet(key)); } @Override public Response> tsMGet(TSMGetParams multiGetParams, String... filters) { - return executeCommand(commandObjects.tsMGet(multiGetParams, filters)); + return appendCommand(commandObjects.tsMGet(multiGetParams, filters)); } @Override public Response tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long timeBucket) { - return executeCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, timeBucket)); + return appendCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, timeBucket)); } @Override public Response tsDeleteRule(String sourceKey, String destKey) { - return executeCommand(commandObjects.tsDeleteRule(sourceKey, destKey)); + return appendCommand(commandObjects.tsDeleteRule(sourceKey, destKey)); } @Override public Response> tsQueryIndex(String... filters) { - return executeCommand(commandObjects.tsQueryIndex(filters)); + return appendCommand(commandObjects.tsQueryIndex(filters)); } // RedisTimeSeries commands + // RedisBloom commands + @Override + public Response bfReserve(String key, double errorRate, long capacity) { + return appendCommand(commandObjects.bfReserve(key, errorRate, capacity)); + } + + @Override + public Response bfReserve(String key, double errorRate, long capacity, BFReserveParams reserveParams) { + return appendCommand(commandObjects.bfReserve(key, errorRate, capacity, reserveParams)); + } + + @Override + public Response bfAdd(String key, String item) { + return appendCommand(commandObjects.bfAdd(key, item)); + } + + @Override + public Response> bfMAdd(String key, String... items) { + return appendCommand(commandObjects.bfMAdd(key, items)); + } + + @Override + public Response> bfInsert(String key, String... items) { + return appendCommand(commandObjects.bfInsert(key, items)); + } + + @Override + public Response> bfInsert(String key, BFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.bfInsert(key, insertParams, items)); + } + + @Override + public Response bfExists(String key, String item) { + return appendCommand(commandObjects.bfExists(key, item)); + } + + @Override + public Response> bfMExists(String key, String... items) { + return appendCommand(commandObjects.bfMExists(key, items)); + } + + @Override + public Response> bfInfo(String key) { + return appendCommand(commandObjects.bfInfo(key)); + } + + @Override + public Response cfReserve(String key, long capacity) { + return appendCommand(commandObjects.cfReserve(key, capacity)); + } + + @Override + public Response cfReserve(String key, long capacity, CFReserveParams reserveParams) { + return appendCommand(commandObjects.cfReserve(key, capacity, reserveParams)); + } + + @Override + public Response cfAdd(String key, String item) { + return appendCommand(commandObjects.cfAdd(key, item)); + } + + @Override + public Response cfAddNx(String key, String item) { + return appendCommand(commandObjects.cfAddNx(key, item)); + } + + @Override + public Response> cfInsert(String key, String... items) { + return appendCommand(commandObjects.cfInsert(key, items)); + } + + @Override + public Response> cfInsert(String key, CFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.cfInsert(key, insertParams, items)); + } + + @Override + public Response> cfInsertNx(String key, String... items) { + return appendCommand(commandObjects.cfInsertNx(key, items)); + } + + @Override + public Response> cfInsertNx(String key, CFInsertParams insertParams, String... items) { + return appendCommand(commandObjects.cfInsertNx(key, insertParams, items)); + } + + @Override + public Response cfExists(String key, String item) { + return appendCommand(commandObjects.cfExists(key, item)); + } + + @Override + public Response cfDel(String key, String item) { + return appendCommand(commandObjects.cfDel(key, item)); + } + + @Override + public Response cfCount(String key, String item) { + return appendCommand(commandObjects.cfCount(key, item)); + } + + @Override + public Response> cfInfo(String key) { + return appendCommand(commandObjects.cfInfo(key)); + } + + @Override + public Response cmsInitByDim(String key, long width, long depth) { + return appendCommand(commandObjects.cmsInitByDim(key, width, depth)); + } + + @Override + public Response cmsInitByProb(String key, double error, double probability) { + return appendCommand(commandObjects.cmsInitByProb(key, error, probability)); + } + + @Override + public Response> cmsIncrBy(String key, Map itemIncrements) { + return appendCommand(commandObjects.cmsIncrBy(key, itemIncrements)); + } + + @Override + public Response> cmsQuery(String key, String... items) { + return appendCommand(commandObjects.cmsQuery(key, items)); + } + + @Override + public Response cmsMerge(String destKey, String... keys) { + return appendCommand(commandObjects.cmsMerge(destKey, keys)); + } + + @Override + public Response cmsMerge(String destKey, Map keysAndWeights) { + return appendCommand(commandObjects.cmsMerge(destKey, keysAndWeights)); + } + + @Override + public Response> cmsInfo(String key) { + return appendCommand(commandObjects.cmsInfo(key)); + } + + @Override + public Response topkReserve(String key, long topk) { + return appendCommand(commandObjects.topkReserve(key, topk)); + } + + @Override + public Response topkReserve(String key, long topk, long width, long depth, double decay) { + return appendCommand(commandObjects.topkReserve(key, topk, width, depth, decay)); + } + + @Override + public Response> topkAdd(String key, String... items) { + return appendCommand(commandObjects.topkAdd(key, items)); + } + + @Override + public Response> topkIncrBy(String key, Map itemIncrements) { + return appendCommand(commandObjects.topkIncrBy(key, itemIncrements)); + } + + @Override + public Response> topkQuery(String key, String... items) { + return appendCommand(commandObjects.topkQuery(key, items)); + } + + @Override + public Response> topkCount(String key, String... items) { + return appendCommand(commandObjects.topkCount(key, items)); + } + + @Override + public Response> topkList(String key) { + return appendCommand(commandObjects.topkList(key)); + } + + @Override + public Response> topkInfo(String key) { + return appendCommand(commandObjects.topkInfo(key)); + } + // RedisBloom commands + public Response waitReplicas(int replicas, long timeout) { return appendCommand(commandObjects.waitReplicas(replicas, timeout)); } diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index 5d4efa76ec..372dc5a83c 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -10,7 +10,10 @@ import org.json.JSONArray; import redis.clients.jedis.args.*; -import redis.clients.jedis.bloom.*; +import redis.clients.jedis.bloom.BFInsertParams; +import redis.clients.jedis.bloom.BFReserveParams; +import redis.clients.jedis.bloom.CFInsertParams; +import redis.clients.jedis.bloom.CFReserveParams; import redis.clients.jedis.commands.JedisCommands; import redis.clients.jedis.commands.JedisBinaryCommands; import redis.clients.jedis.commands.ProtocolCommand; @@ -18,11 +21,16 @@ import redis.clients.jedis.commands.SampleKeyedCommands; import redis.clients.jedis.commands.RedisModuleCommands; import redis.clients.jedis.executors.*; -import redis.clients.jedis.json.*; +import redis.clients.jedis.json.JsonSetParams; +import redis.clients.jedis.json.Path; +import redis.clients.jedis.json.Path2; import redis.clients.jedis.params.*; import redis.clients.jedis.providers.*; import redis.clients.jedis.resps.*; -import redis.clients.jedis.search.*; +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.search.aggr.AggregationBuilder; import redis.clients.jedis.search.aggr.AggregationResult; import redis.clients.jedis.timeseries.*; diff --git a/src/main/java/redis/clients/jedis/bloom/BloomFilterPipelineCommands.java b/src/main/java/redis/clients/jedis/bloom/BloomFilterPipelineCommands.java new file mode 100644 index 0000000000..74fd081678 --- /dev/null +++ b/src/main/java/redis/clients/jedis/bloom/BloomFilterPipelineCommands.java @@ -0,0 +1,26 @@ +package redis.clients.jedis.bloom; + +import java.util.List; +import java.util.Map; +import redis.clients.jedis.Response; + +public interface BloomFilterPipelineCommands { + + Response bfReserve(String key, double errorRate, long capacity); + + Response bfReserve(String key, double errorRate, long capacity, BFReserveParams reserveParams); + + Response bfAdd(String key, String item); + + Response> bfMAdd(String key, String... items); + + Response> bfInsert(String key, String... items); + + Response> bfInsert(String key, BFInsertParams insertParams, String... items); + + Response bfExists(String key, String item); + + Response> bfMExists(String key, String... items); + + Response> bfInfo(String key); +} diff --git a/src/main/java/redis/clients/jedis/bloom/CountMinSketchPipelineCommands.java b/src/main/java/redis/clients/jedis/bloom/CountMinSketchPipelineCommands.java new file mode 100644 index 0000000000..c6ca2c6c3d --- /dev/null +++ b/src/main/java/redis/clients/jedis/bloom/CountMinSketchPipelineCommands.java @@ -0,0 +1,22 @@ +package redis.clients.jedis.bloom; + +import java.util.List; +import java.util.Map; +import redis.clients.jedis.Response; + +public interface CountMinSketchPipelineCommands { + + Response cmsInitByDim(String key, long width, long depth); + + Response cmsInitByProb(String key, double error, double probability); + + Response> cmsIncrBy(String key, Map itemIncrements); + + Response> cmsQuery(String key, String... items); + + Response cmsMerge(String destKey, String... keys); + + Response cmsMerge(String destKey, Map keysAndWeights); + + Response> cmsInfo(String key); +} diff --git a/src/main/java/redis/clients/jedis/bloom/CuckooFilterCommands.java b/src/main/java/redis/clients/jedis/bloom/CuckooFilterCommands.java index 967cc68b0f..1b58f3f34a 100644 --- a/src/main/java/redis/clients/jedis/bloom/CuckooFilterCommands.java +++ b/src/main/java/redis/clients/jedis/bloom/CuckooFilterCommands.java @@ -1,9 +1,7 @@ package redis.clients.jedis.bloom; -import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.stream.Stream; /** * Interface for RedisBloom Cuckoo Filter Commands diff --git a/src/main/java/redis/clients/jedis/bloom/CuckooFilterPipelineCommands.java b/src/main/java/redis/clients/jedis/bloom/CuckooFilterPipelineCommands.java new file mode 100644 index 0000000000..516bd01a34 --- /dev/null +++ b/src/main/java/redis/clients/jedis/bloom/CuckooFilterPipelineCommands.java @@ -0,0 +1,32 @@ +package redis.clients.jedis.bloom; + +import java.util.List; +import java.util.Map; +import redis.clients.jedis.Response; + +public interface CuckooFilterPipelineCommands { + + Response cfReserve(String key, long capacity); + + Response cfReserve(String key, long capacity, CFReserveParams reserveParams); + + Response cfAdd(String key, String item); + + Response cfAddNx(String key, String item); + + Response> cfInsert(String key, String... items); + + Response> cfInsert(String key, CFInsertParams insertParams, String... items); + + Response> cfInsertNx(String key, String... items); + + Response> cfInsertNx(String key, CFInsertParams insertParams, String... items); + + Response cfExists(String key, String item); + + Response cfDel(String key, String item); + + Response cfCount(String key, String item); + + Response> cfInfo(String key); +} diff --git a/src/main/java/redis/clients/jedis/bloom/RedisBloomPipelineCommands.java b/src/main/java/redis/clients/jedis/bloom/RedisBloomPipelineCommands.java new file mode 100644 index 0000000000..4895f68765 --- /dev/null +++ b/src/main/java/redis/clients/jedis/bloom/RedisBloomPipelineCommands.java @@ -0,0 +1,9 @@ +package redis.clients.jedis.bloom; + +public interface RedisBloomPipelineCommands extends + BloomFilterPipelineCommands, + CuckooFilterPipelineCommands, + CountMinSketchPipelineCommands, + TopKFilterPipelineCommands { + +} diff --git a/src/main/java/redis/clients/jedis/bloom/TopKFilterPipelineCommands.java b/src/main/java/redis/clients/jedis/bloom/TopKFilterPipelineCommands.java new file mode 100644 index 0000000000..f37130549f --- /dev/null +++ b/src/main/java/redis/clients/jedis/bloom/TopKFilterPipelineCommands.java @@ -0,0 +1,24 @@ +package redis.clients.jedis.bloom; + +import java.util.List; +import java.util.Map; +import redis.clients.jedis.Response; + +public interface TopKFilterPipelineCommands { + + Response topkReserve(String key, long topk); + + Response topkReserve(String key, long topk, long width, long depth, double decay); + + Response> topkAdd(String key, String... items); + + Response> topkIncrBy(String key, Map itemIncrements); + + Response> topkQuery(String key, String... items); + + Response> topkCount(String key, String... items); + + Response> topkList(String key); + + Response> topkInfo(String key); +} diff --git a/src/main/java/redis/clients/jedis/commands/RedisModulePipelineCommands.java b/src/main/java/redis/clients/jedis/commands/RedisModulePipelineCommands.java index 843dda6040..61ecf654de 100644 --- a/src/main/java/redis/clients/jedis/commands/RedisModulePipelineCommands.java +++ b/src/main/java/redis/clients/jedis/commands/RedisModulePipelineCommands.java @@ -1,5 +1,6 @@ package redis.clients.jedis.commands; +import redis.clients.jedis.bloom.RedisBloomPipelineCommands; import redis.clients.jedis.json.RedisJsonPipelineCommands; import redis.clients.jedis.search.RediSearchPipelineCommands; import redis.clients.jedis.timeseries.RedisTimeSeriesPipelineCommands; @@ -7,6 +8,7 @@ public interface RedisModulePipelineCommands extends RediSearchPipelineCommands, RedisJsonPipelineCommands, - RedisTimeSeriesPipelineCommands { + RedisTimeSeriesPipelineCommands, + RedisBloomPipelineCommands { }