Skip to content

Commit

Permalink
Rename xpendingSummary to xpending (#2458)
Browse files Browse the repository at this point in the history
Because there is no conflict while maintaining Redis command name.
  • Loading branch information
sazzad16 authored Mar 18, 2021
1 parent 8b75067 commit 4fb5121
Show file tree
Hide file tree
Showing 17 changed files with 78 additions and 77 deletions.
8 changes: 4 additions & 4 deletions src/main/java/redis/clients/jedis/BinaryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,10 @@ public void xreadGroup(byte[] groupname, byte[] consumer, final XReadGroupParams
sendCommand(XREADGROUP, args);
}

public void xpending(final byte[] key, final byte[] groupname) {
sendCommand(XPENDING, key, groupname);
}

public void xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count,
byte[] consumername) {
if (consumername == null) {
Expand All @@ -1773,10 +1777,6 @@ public void xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int
}
}

public void xpendingSummary(final byte[] key, final byte[] groupname) {
sendCommand(XPENDING, key, groupname);
}

public void xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime,
long newIdleTime, int retries, boolean force, byte[][] ids) {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/redis/clients/jedis/BinaryJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -4651,9 +4651,9 @@ public List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[]
}

@Override
public Object xpendingSummary(final byte[] key, final byte[] groupname) {
public Object xpending(final byte[] key, final byte[] groupname) {
checkIsInMultiOrPipeline();
client.xpendingSummary(key, groupname);
client.xpending(key, groupname);
return client.getOne();
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/redis/clients/jedis/BinaryJedisCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -2568,11 +2568,11 @@ public List<Object> execute(Jedis connection) {
}

@Override
public Object xpendingSummary(final byte[] key, final byte[] groupname) {
public Object xpending(final byte[] key, final byte[] groupname) {
return new JedisClusterCommand<Object>(connectionHandler, maxAttempts) {
@Override
public Object execute(Jedis connection) {
return connection.xpendingSummary(key, groupname);
return connection.xpending(key, groupname);
}
}.runBinary(key);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/redis/clients/jedis/BinaryShardedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -1201,9 +1201,9 @@ public List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[]
}

@Override
public Object xpendingSummary(final byte[] key, final byte[] groupname) {
public Object xpending(final byte[] key, final byte[] groupname) {
Jedis j = getShard(key);
return j.xpendingSummary(key, groupname);
return j.xpending(key, groupname);
}

@Override
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/redis/clients/jedis/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -1491,18 +1491,18 @@ public void xreadGroup(String groupname, String consumer, XReadGroupParams param
sendCommand(Protocol.Command.XREADGROUP, args);
}

@Override
public void xpending(String key, String groupname) {
xpending(SafeEncoder.encode(key), SafeEncoder.encode(groupname));
}

@Override
public void xpending(String key, String groupname, StreamEntryID start, StreamEntryID end,
int count, String consumername) {
xpending(SafeEncoder.encode(key), SafeEncoder.encode(groupname), SafeEncoder.encode(start==null ? "-" : start.toString()),
SafeEncoder.encode(end==null ? "+" : end.toString()), count, consumername == null? null : SafeEncoder.encode(consumername));
}

@Override
public void xpendingSummary(String key, String groupname) {
xpendingSummary(SafeEncoder.encode(key), SafeEncoder.encode(groupname));
}

@Override
public void xclaim(String key, String group, String consumername, long minIdleTime,
long newIdleTime, int retries, boolean force, StreamEntryID... ids) {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/redis/clients/jedis/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -4231,18 +4231,18 @@ public List<Map.Entry<String, List<StreamEntry>>> xreadGroup(final String groupn
}

@Override
public List<StreamPendingEntry> xpending(final String key, final String groupname,
final StreamEntryID start, final StreamEntryID end, final int count, final String consumername) {
public StreamPendingSummary xpending(final String key, final String groupname) {
checkIsInMultiOrPipeline();
client.xpending(key, groupname, start, end, count, consumername);
return BuilderFactory.STREAM_PENDING_ENTRY_LIST.build(client.getObjectMultiBulkReply());
client.xpending(key, groupname);
return BuilderFactory.STREAM_PENDING_SUMMARY.build(client.getObjectMultiBulkReply());
}

@Override
public StreamPendingSummary xpendingSummary(final String key, final String groupname) {
public List<StreamPendingEntry> xpending(final String key, final String groupname,
final StreamEntryID start, final StreamEntryID end, final int count, final String consumername) {
checkIsInMultiOrPipeline();
client.xpendingSummary(key, groupname);
return BuilderFactory.STREAM_PENDING_SUMMARY.build(client.getObjectMultiBulkReply());
client.xpending(key, groupname, start, end, count, consumername);
return BuilderFactory.STREAM_PENDING_ENTRY_LIST.build(client.getObjectMultiBulkReply());
}

@Override
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/redis/clients/jedis/JedisCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -2629,22 +2629,22 @@ public List<Entry<String, List<StreamEntry>>> execute(Jedis connection) {
}

@Override
public List<StreamPendingEntry> xpending(final String key, final String groupname,
final StreamEntryID start, final StreamEntryID end, final int count, final String consumername) {
return new JedisClusterCommand<List<StreamPendingEntry>>(connectionHandler, maxAttempts) {
public StreamPendingSummary xpending(final String key, final String groupname) {
return new JedisClusterCommand<StreamPendingSummary>(connectionHandler, maxAttempts) {
@Override
public List<StreamPendingEntry> execute(Jedis connection) {
return connection.xpending(key, groupname, start, end, count, consumername);
public StreamPendingSummary execute(Jedis connection) {
return connection.xpending(key, groupname);
}
}.run(key);
}

@Override
public StreamPendingSummary xpendingSummary(final String key, final String groupname) {
return new JedisClusterCommand<StreamPendingSummary>(connectionHandler, maxAttempts) {
public List<StreamPendingEntry> xpending(final String key, final String groupname,
final StreamEntryID start, final StreamEntryID end, final int count, final String consumername) {
return new JedisClusterCommand<List<StreamPendingEntry>>(connectionHandler, maxAttempts) {
@Override
public StreamPendingSummary execute(Jedis connection) {
return connection.xpendingSummary(key, groupname);
public List<StreamPendingEntry> execute(Jedis connection) {
return connection.xpending(key, groupname, start, end, count, consumername);
}
}.run(key);
}
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/redis/clients/jedis/PipelineBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -2223,6 +2223,18 @@ public Response<Long> xgroupDelConsumer(byte[] key, byte[] groupname, byte[] con
return getResponse(BuilderFactory.LONG);
}

@Override
public Response<StreamPendingSummary> xpending(String key, String groupname) {
getClient(key).xpending(key, groupname);
return getResponse(BuilderFactory.STREAM_PENDING_SUMMARY);
}

@Override
public Response<Object> xpending(byte[] key, byte[] groupname) {
getClient(key).xpending(key, groupname);
return getResponse(BuilderFactory.RAW_OBJECT);
}

@Override
public Response<List<StreamPendingEntry>> xpending(String key, String groupname,
StreamEntryID start, StreamEntryID end, int count, String consumername) {
Expand All @@ -2244,18 +2256,6 @@ public Response<List<Object>> xpendingBinary(byte[] key, byte[] groupname, byte[
return getResponse(BuilderFactory.RAW_OBJECT_LIST);
}

@Override
public Response<StreamPendingSummary> xpendingSummary(String key, String groupname) {
getClient(key).xpendingSummary(key, groupname);
return getResponse(BuilderFactory.STREAM_PENDING_SUMMARY);
}

@Override
public Response<Object> xpendingSummary(byte[] key, byte[] groupname) {
getClient(key).xpendingSummary(key, groupname);
return getResponse(BuilderFactory.RAW_OBJECT);
}

@Override
public Response<Long> xdel(String key, StreamEntryID... ids) {
getClient(key).xdel(key, ids);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/redis/clients/jedis/ShardedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -1190,16 +1190,16 @@ public List<StreamEntry> xrevrange(String key, StreamEntryID end, StreamEntryID
}

@Override
public List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID start,
StreamEntryID end, int count, String consumername) {
public StreamPendingSummary xpending(String key, String groupname) {
Jedis j = getShard(key);
return j.xpending(key, groupname, start, end, count, consumername);
return j.xpending(key, groupname);
}

@Override
public StreamPendingSummary xpendingSummary(String key, String groupname) {
public List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID start,
StreamEntryID end, int count, String consumername) {
Jedis j = getShard(key);
return j.xpendingSummary(key, groupname);
return j.xpending(key, groupname, start, end, count, consumername);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ List<GeoRadiusResponse> georadiusByMemberReadonly(byte[] key, byte[] member, dou

Long xtrim(byte[] key, long maxLen, boolean approximateLength);

List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername);
Object xpending(final byte[] key, final byte[] groupname);

Object xpendingSummary(final byte[] key, final byte[] groupname);
List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername);

List<byte[]> xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime, long newIdleTime, int retries, boolean force, byte[][] ids);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,9 @@ default List<byte[]> xrange(byte[] key, byte[] start, byte[] end, long count) {

Long xtrim(byte[] key, long maxLen, boolean approximateLength);

List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername);
Object xpending(byte[] key, byte[] groupname);

Object xpendingSummary(byte[] key, byte[] groupname);
List<Object> xpending(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername);

List<byte[]> xclaim(byte[] key, byte[] groupname, byte[] consumername, long minIdleTime, long newIdleTime, int retries, boolean force, byte[]... ids);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ Response<List<GeoRadiusResponse>> georadiusByMemberReadonly(byte[] key, byte[] m

Response<Long> xgroupDelConsumer(byte[] key, byte[] groupname, byte[] consumername);

Response<Object> xpending(byte[] key, byte[] groupname);

/**
* @deprecated Use {@link #xpendingBinary(byte[], byte[], byte[], byte[], int, byte[])}.
*/
Expand All @@ -407,8 +409,6 @@ Response<List<GeoRadiusResponse>> georadiusByMemberReadonly(byte[] key, byte[] m

Response<List<Object>> xpendingBinary(byte[] key, byte[] groupname, byte[] start, byte[] end, int count, byte[] consumername);

Response<Object> xpendingSummary(byte[] key, byte[] groupname);

Response<Long> xdel(byte[] key, byte[]... ids);

Response<Long> xtrim(byte[] key, long maxLen, boolean approximateLength);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/redis/clients/jedis/commands/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,9 @@ default void restoreReplace(String key, int ttl, byte[] serializedValue) {

void xreadGroup(String groupname, String consumer, XReadGroupParams params, Map<String, StreamEntryID> streams);

void xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername);
void xpending(String key, String groupname);

void xpendingSummary(String key, String groupname);
void xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername);

void xclaim(String key, String group, String consumername, long minIdleTime, long newIdleTime,
int retries, boolean force, StreamEntryID... ids);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, dou
List<StreamEntry> xrevrange(String key, StreamEntryID end, StreamEntryID start, int count);

/**
* @deprecated Will be removed in future version. Use
* @deprecated This will be removed in future version. Use
* {@link MultiKeyJedisClusterCommands#xread(int, long, java.util.Map.Entry...)}.
*/
@Deprecated
Expand Down Expand Up @@ -517,33 +517,33 @@ List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, dou
Long xgroupDelConsumer( String key, String groupname, String consumername);

/**
* @deprecated Will be removed in future version. Use
* @deprecated This will be removed in future version. Use
* {@link MultiKeyJedisClusterCommands#xreadGroup(java.lang.String, java.lang.String, int, long, boolean, java.util.Map.Entry...)}.
*/
@Deprecated
List<Map.Entry<String, List<StreamEntry>>> xreadGroup(String groupname, String consumer, int count, long block, boolean noAck, Map.Entry<String, StreamEntryID>... streams);

/**
* XPENDING key group [start end count] [consumer]
* XPENDING key group
*
* @param key
* @param groupname
* @param start
* @param end
* @param count
* @param consumername
* @return
*/
List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername);
StreamPendingSummary xpending(String key, String groupname);

/**
* XPENDING key group
* XPENDING key group [start end count] [consumer]
*
* @param key
* @param groupname
* @param start
* @param end
* @param count
* @param consumername
* @return
*/
StreamPendingSummary xpendingSummary(String key, String groupname);
List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername);

/**
* XDEL key ID [ID ...]
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/redis/clients/jedis/commands/JedisCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -526,26 +526,27 @@ List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, dou
Long xgroupDelConsumer( String key, String groupname, String consumername);

/**
* XPENDING key group [start end count] [consumer]
* XPENDING key group
*
* @param key
* @param groupname
* @param start
* @param end
* @param count
* @param consumername
* @return
*/
List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername);
StreamPendingSummary xpending(String key, String groupname);

/**
* XPENDING key group
* XPENDING key group [start end count] [consumer]
*
* @param key
* @param groupname
* @param start
* @param end
* @param count
* @param consumername
* @return
*/
StreamPendingSummary xpendingSummary(String key, String groupname);
List<StreamPendingEntry> xpending(String key, String groupname, StreamEntryID start,
StreamEntryID end, int count, String consumername);

/**
* XDEL key ID [ID ...]
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/redis/clients/jedis/commands/RedisPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ Response<List<GeoRadiusResponse>> georadiusByMemberReadonly(String key, String m

Response<Long> xgroupDelConsumer( String key, String groupname, String consumername);

Response<StreamPendingSummary> xpending(String key, String groupname);

Response<List<StreamPendingEntry>> xpending(String key, String groupname,
StreamEntryID start, StreamEntryID end, int count, String consumername);

Response<StreamPendingSummary> xpendingSummary(String key, String groupname);

Response<Long> xdel( String key, StreamEntryID... ids);

Response<Long> xtrim( String key, long maxLen, boolean approximateLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ public void xpendeing() {
assertEquals(map, range.get(0).getValue().get(0).getFields());

// Get the summary about the pending messages
StreamPendingSummary pendingSummary = jedis.xpendingSummary("xpendeing-stream", "xpendeing-group");
StreamPendingSummary pendingSummary = jedis.xpending("xpendeing-stream", "xpendeing-group");
assertEquals(1, pendingSummary.getTotal());
assertEquals(id1, pendingSummary.getMinId());
assertEquals(1l, pendingSummary.getConsumerMessageCount().get("xpendeing-consumer").longValue());
Expand Down

0 comments on commit 4fb5121

Please sign in to comment.