Skip to content

Commit 693809e

Browse files
committed
Merge branch '5.0' into 'master'
Conflicts: src/main/java/redis/clients/jedis/resps/StreamConsumerInfo.java
2 parents 1da7591 + 4daa722 commit 693809e

File tree

130 files changed

+1723
-2344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+1723
-2344
lines changed

.github/workflows/integration.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,20 @@ jobs:
5454
env:
5555
JVM_OPTS: -Xmx3200m
5656
TERM: dumb
57-
- name: redismod docker
57+
- name: Make - start
58+
run: make start
59+
- name: Docker - mod or stack
5860
run: docker run -p 52567:6379 -d redis/redis-stack-server:edge
59-
- name: Run tests
61+
- name: Test commands - default protocol
62+
run: mvn -Dtest="redis.clients.jedis.commands.**" test
63+
- name: Test commands - RESP3 protocol
64+
run: mvn -DjedisProtocol=3 -Dtest="redis.clients.jedis.commands.**" test
65+
- name: Test module commands - default protocol
6066
run: mvn -DmodulesDocker="localhost:52567" -Dtest="redis.clients.jedis.modules.**" test
67+
- name: Test module commands - RESP3 protocol
68+
run: mvn -DjedisProtocol=3 -DmodulesDocker="localhost:52567" -Dtest="redis.clients.jedis.modules.**" test
69+
- name: Make - stop
70+
run: make stop
6171
- name: Codecov
6272
run: |
6373
bash <(curl -s https://codecov.io/bash)

docs/3to4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Jedis 3 to Jedis 4 Breaking Changes
1+
# Jedis 4 Breaking Changes
22

33
- The `BinaryJedis` and `BinaryJedisCluster` classes have been removed.
44

docs/jedis5-breaking.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Jedis 5 Breaking Changes
2+
3+
- `StreamConsumersInfo` has been renamed to `StreamConsumerInfo`.
4+
5+
- `bzpopmax(double timeout, byte[]... keys)` now returns `List<Object>` (instead of `List<byte[]>`).
6+
- This is a three element list where the last element is a `Double`.
7+
8+
- `bzpopmin(double timeout, byte[]... keys)` now returns `List<Object>` (instead of `List<byte[]>`).
9+
- This is a three element list where the last element is a `Double`.
10+
11+
- `getAgeSeconds()` in `AccessControlLogEntry` now returns `Double` instead of `String`.
12+
13+
- `graphSlowlog(String graphName)` now returns `List<List<Object>>` (instead of `List<List<String>>`).
14+
15+
- `List<Object> getUnflushedObjectMultiBulkReply()` method has been removed from `Connection`.
16+
- `Object getUnflushedObject()` method has been added instead.
17+
18+
- `STREAM_INFO_FULL` in BuilderFactory has been renamed to `STREAM_FULL_INFO`.
19+
- `STREAM_CONSUMERS_INFO_LIST` in BuilderFactory has been renamed to `STREAM_CONSUMER_INFO_LIST`.
20+
- `STREAM_AUTO_CLAIM_ID_RESPONSE` in BuilderFactory has been renamed to `STREAM_AUTO_CLAIM_JUSTID_RESPONSE`.
21+
22+
- Following BuilderFactory implementations have been removed:
23+
- `BYTE_ARRAY` (use `BINARY`)
24+
- `BYTE_ARRAY_LIST` (use `BINARY_LIST`)
25+
26+
<!--- Deprecated in Jedis 4 --->
27+
28+
- `quit()` method has been removed from `Connection` and `ServerCommands` interface and implementations.
29+
30+
- `select(int index)` method has been removed from `Connection`.
31+
32+
- `updatePassword(String password)` method has been removed from `JedisClientConfig` and implementations.
33+
34+
- `setPassword(String password)` method has been removed from `ConnectionFactory`.
35+
36+
- `setPassword(String password)` method has been removed from `JedisFactory`.
37+
38+
- `get()` option has been removed from `SetParams`. Following methods have been added in Jedis/UnifiedJedis for convenience:
39+
- `setGet(String key, String value)` method has been added in `` interface.
40+
- `setGet(byte[] key, byte[] value)` method has been added in `` interface.
41+
42+
- `xpending(String key, String groupName, StreamEntryID start, StreamEntryID end, int count, String consumerName)` method has been removed from everywhere.
43+
- Use `xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)` instead.
44+
45+
- `xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName)` method has been removed from everywhere.
46+
- Use `xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)` instead.
47+
48+
- `topkCount(String key, String... items)` method has been removed from everywhere.
49+
50+
- Following methods have been removed:
51+
- `strAlgoLCSStrings(String strA, String strB, StrAlgoLCSParams params)`
52+
- `strAlgoLCSStrings(byte[] strA, byte[] strB, StrAlgoLCSParams params)`
53+
- `strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params)`
54+
- `strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params)`
55+
56+
- `StrAlgoLCSParams` has been removed.
57+
58+
- Following methods have been removed from all Pipeline classes:
59+
- `ftCursorRead(String indexName, long cursorId, int count)`
60+
- `ftCursorDel(String indexName, long cursorId)`
61+
- `ftDropIndex(String indexName)`
62+
- `ftDropIndexDD(String indexName)`
63+
- `ftAliasAdd(String aliasName, String indexName)`
64+
- `ftAliasUpdate(String aliasName, String indexName)`
65+
- `ftAliasDel(String aliasName)`
66+
67+
- `addObjects(int[] ints)` method has been removed from `CommandArguments`.
68+
69+
- `getArgsString()` and `serializeRedisArgs(List<byte[]> redisArgs)` methods have been removed from `AggregationBuilder`.
70+
71+
- `totalResults` variable in `AggregationResult` has been made private. Use `getTotalResults()` method instead.
72+
73+
- `retentionTime(long retentionTime)` method in `TSAlterParams` has been removed. Use `retention(long)` method instead.
74+
75+
- `JedisSentineled(String masterName, Set<HostAndPort> sentinels, JedisClientConfig masterClientConfig, JedisClientConfig sentinelClientConfig)` and
76+
`JedisSentineled(String masterName, Set<HostAndPort> sentinels, GenericObjectPoolConfig<Connection> poolConfig, JedisClientConfig masterClientConfig, JedisClientConfig sentinelClientConfig)`
77+
constructors have been removed.
78+
79+
- `JedisClusterInfoCache(JedisClientConfig clientConfig)` and `JedisClusterInfoCache(JedisClientConfig clientConfig, GenericObjectPoolConfig<Connection> poolConfig)`
80+
constructors have been removed.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<packaging>jar</packaging>
1010
<groupId>redis.clients</groupId>
1111
<artifactId>jedis</artifactId>
12-
<version>4.5.0-SNAPSHOT</version>
12+
<version>5.0.0-SNAPSHOT</version>
1313
<name>Jedis</name>
1414
<description>Jedis is a blazingly small and sane Redis java client.</description>
1515
<url>https://github.com/redis/jedis</url>
Lines changed: 4 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,9 @@
11
package redis.clients.jedis;
22

3-
import static redis.clients.jedis.Protocol.ResponseKeyword.*;
3+
public abstract class BinaryJedisPubSub extends JedisPubSubBase<byte[]> {
44

5-
import java.util.Arrays;
6-
import java.util.List;
7-
8-
import redis.clients.jedis.Protocol.Command;
9-
import redis.clients.jedis.exceptions.JedisException;
10-
11-
public abstract class BinaryJedisPubSub {
12-
private int subscribedChannels = 0;
13-
private Connection client;
14-
15-
public void onMessage(byte[] channel, byte[] message) {
16-
}
17-
18-
public void onPMessage(byte[] pattern, byte[] channel, byte[] message) {
19-
}
20-
21-
public void onSubscribe(byte[] channel, int subscribedChannels) {
22-
}
23-
24-
public void onUnsubscribe(byte[] channel, int subscribedChannels) {
25-
}
26-
27-
public void onPUnsubscribe(byte[] pattern, int subscribedChannels) {
28-
}
29-
30-
public void onPSubscribe(byte[] pattern, int subscribedChannels) {
31-
}
32-
33-
public void onPong(byte[] pattern) {
34-
}
35-
36-
public void unsubscribe() {
37-
client.sendCommand(Command.UNSUBSCRIBE);
38-
client.flush();
39-
}
40-
41-
public void unsubscribe(byte[]... channels) {
42-
client.sendCommand(Command.UNSUBSCRIBE, channels);
43-
client.flush();
44-
}
45-
46-
public void subscribe(byte[]... channels) {
47-
client.sendCommand(Command.SUBSCRIBE, channels);
48-
client.flush();
49-
}
50-
51-
public void psubscribe(byte[]... patterns) {
52-
client.sendCommand(Command.PSUBSCRIBE, patterns);
53-
client.flush();
54-
}
55-
56-
public void punsubscribe() {
57-
client.sendCommand(Command.PUNSUBSCRIBE);
58-
client.flush();
59-
}
60-
61-
public void punsubscribe(byte[]... patterns) {
62-
client.sendCommand(Command.PUNSUBSCRIBE, patterns);
63-
client.flush();
64-
}
65-
66-
public void ping() {
67-
client.sendCommand(Command.PING);
68-
client.flush();
69-
}
70-
71-
public void ping(byte[] argument) {
72-
client.sendCommand(Command.PING, argument);
73-
client.flush();
74-
}
75-
76-
public boolean isSubscribed() {
77-
return subscribedChannels > 0;
78-
}
79-
80-
public void proceedWithPatterns(Connection client, byte[]... patterns) {
81-
this.client = client;
82-
this.client.setTimeoutInfinite();
83-
try {
84-
psubscribe(patterns);
85-
process();
86-
} finally {
87-
this.client.rollbackTimeout();
88-
}
89-
}
90-
91-
public void proceed(Connection client, byte[]... channels) {
92-
this.client = client;
93-
this.client.setTimeoutInfinite();
94-
try {
95-
subscribe(channels);
96-
process();
97-
} finally {
98-
this.client.rollbackTimeout();
99-
}
100-
}
101-
102-
private void process() {
103-
do {
104-
List<Object> reply = client.getUnflushedObjectMultiBulkReply();
105-
final Object firstObj = reply.get(0);
106-
if (!(firstObj instanceof byte[])) {
107-
throw new JedisException("Unknown message type: " + firstObj);
108-
}
109-
final byte[] resp = (byte[]) firstObj;
110-
if (Arrays.equals(SUBSCRIBE.getRaw(), resp)) {
111-
subscribedChannels = ((Long) reply.get(2)).intValue();
112-
final byte[] bchannel = (byte[]) reply.get(1);
113-
onSubscribe(bchannel, subscribedChannels);
114-
} else if (Arrays.equals(UNSUBSCRIBE.getRaw(), resp)) {
115-
subscribedChannels = ((Long) reply.get(2)).intValue();
116-
final byte[] bchannel = (byte[]) reply.get(1);
117-
onUnsubscribe(bchannel, subscribedChannels);
118-
} else if (Arrays.equals(MESSAGE.getRaw(), resp)) {
119-
final byte[] bchannel = (byte[]) reply.get(1);
120-
final byte[] bmesg = (byte[]) reply.get(2);
121-
onMessage(bchannel, bmesg);
122-
} else if (Arrays.equals(PMESSAGE.getRaw(), resp)) {
123-
final byte[] bpattern = (byte[]) reply.get(1);
124-
final byte[] bchannel = (byte[]) reply.get(2);
125-
final byte[] bmesg = (byte[]) reply.get(3);
126-
onPMessage(bpattern, bchannel, bmesg);
127-
} else if (Arrays.equals(PSUBSCRIBE.getRaw(), resp)) {
128-
subscribedChannels = ((Long) reply.get(2)).intValue();
129-
final byte[] bpattern = (byte[]) reply.get(1);
130-
onPSubscribe(bpattern, subscribedChannels);
131-
} else if (Arrays.equals(PUNSUBSCRIBE.getRaw(), resp)) {
132-
subscribedChannels = ((Long) reply.get(2)).intValue();
133-
final byte[] bpattern = (byte[]) reply.get(1);
134-
onPUnsubscribe(bpattern, subscribedChannels);
135-
} else if (Arrays.equals(PONG.getRaw(), resp)) {
136-
final byte[] bpattern = (byte[]) reply.get(1);
137-
onPong(bpattern);
138-
} else {
139-
throw new JedisException("Unknown message type: " + firstObj);
140-
}
141-
} while (isSubscribed());
142-
}
143-
144-
public int getSubscribedChannels() {
145-
return subscribedChannels;
5+
@Override
6+
protected final byte[] encode(byte[] raw) {
7+
return raw;
1468
}
1479
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package redis.clients.jedis;
2+
3+
public abstract class BinaryJedisShardedPubSub extends JedisShardedPubSubBase<byte[]> {
4+
5+
@Override
6+
protected final byte[] encode(byte[] raw) {
7+
return raw;
8+
}
9+
}

0 commit comments

Comments
 (0)