Skip to content

Commit 63141ec

Browse files
authored
Merge branch 'master' into 5.0
2 parents b156dcb + 104c55b commit 63141ec

20 files changed

+165
-18
lines changed

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
JVM_OPTS: -Xmx3200m
5656
TERM: dumb
5757
- name: redismod docker
58-
run: docker run -p 52567:6379 -d redislabs/redismod:edge
58+
run: docker run -p 52567:6379 -d redis/redis-stack-server:edge
5959
- name: Run tests
6060
run: mvn -DmodulesDocker="localhost:52567" -Dtest="redis.clients.jedis.modules.**" test
6161
- name: Codecov

src/main/java/redis/clients/jedis/BuilderFactory.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,16 @@ public String toString() {
400400
}
401401
};
402402

403+
public static final Builder<KeyValue<Long, Long>> LONG_LONG_PAIR = new Builder<KeyValue<Long, Long>>() {
404+
@Override
405+
@SuppressWarnings("unchecked")
406+
public KeyValue<Long, Long> build(Object data) {
407+
if (data == null) return null;
408+
List<Object> dataList = (List<Object>) data;
409+
return new KeyValue<>(LONG.build(dataList.get(0)), LONG.build(dataList.get(1)));
410+
}
411+
};
412+
403413
public static final Builder<List<KeyValue<String, List<String>>>> KEYED_STRING_LIST_LIST
404414
= new Builder<List<KeyValue<String, List<String>>>>() {
405415
@Override

src/main/java/redis/clients/jedis/ClusterCommandObjects.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import redis.clients.jedis.params.ScanParams;
1111
import redis.clients.jedis.resps.ScanResult;
1212
import redis.clients.jedis.util.JedisClusterHashTag;
13+
import redis.clients.jedis.util.KeyValue;
1314

1415
public class ClusterCommandObjects extends CommandObjects {
1516

@@ -97,4 +98,10 @@ public final CommandObject<ScanResult<byte[]>> scan(byte[] cursor, ScanParams pa
9798
public final CommandObject<Long> waitReplicas(int replicas, long timeout) {
9899
throw new UnsupportedOperationException(CLUSTER_UNSUPPORTED_MESSAGE);
99100
}
101+
102+
@Override
103+
public CommandObject<KeyValue<Long, Long>> waitAOF(long numLocal, long numReplicas, long timeout) {
104+
throw new UnsupportedOperationException(CLUSTER_UNSUPPORTED_MESSAGE);
105+
}
106+
100107
}

src/main/java/redis/clients/jedis/CommandObjects.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,6 +3076,18 @@ public final CommandObject<Long> waitReplicas(byte[] sampleKey, int replicas, lo
30763076
return new CommandObject<>(commandArguments(WAIT).add(replicas).add(timeout).processKey(sampleKey), BuilderFactory.LONG);
30773077
}
30783078

3079+
public CommandObject<KeyValue<Long, Long>> waitAOF(long numLocal, long numReplicas, long timeout) {
3080+
return new CommandObject<>(commandArguments(WAITAOF).add(numLocal).add(numReplicas).add(timeout), BuilderFactory.LONG_LONG_PAIR);
3081+
}
3082+
3083+
public CommandObject<KeyValue<Long, Long>> waitAOF(byte[] sampleKey, long numLocal, long numReplicas, long timeout) {
3084+
return new CommandObject<>(commandArguments(WAITAOF).add(numLocal).add(numReplicas).add(timeout).processKey(sampleKey), BuilderFactory.LONG_LONG_PAIR);
3085+
}
3086+
3087+
public CommandObject<KeyValue<Long, Long>> waitAOF(String sampleKey, long numLocal, long numReplicas, long timeout) {
3088+
return new CommandObject<>(commandArguments(WAITAOF).add(numLocal).add(numReplicas).add(timeout).processKey(sampleKey), BuilderFactory.LONG_LONG_PAIR);
3089+
}
3090+
30793091
public final CommandObject<Long> publish(String channel, String message) {
30803092
return new CommandObject<>(commandArguments(PUBLISH).add(channel).add(message), BuilderFactory.LONG);
30813093
}

src/main/java/redis/clients/jedis/Jedis.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4354,6 +4354,13 @@ public long waitReplicas(final int replicas, final long timeout) {
43544354
return connection.getIntegerReply();
43554355
}
43564356

4357+
@Override
4358+
public KeyValue<Long, Long> waitAOF(long numLocal, long numReplicas, long timeout) {
4359+
checkIsInMultiOrPipeline();
4360+
connection.sendCommand(WAITAOF, toByteArray(numLocal), toByteArray(numReplicas), toByteArray(timeout));
4361+
return BuilderFactory.LONG_LONG_PAIR.build(connection.getOne());
4362+
}
4363+
43574364
@Override
43584365
public long pfadd(final byte[] key, final byte[]... elements) {
43594366
checkIsInMultiOrPipeline();

src/main/java/redis/clients/jedis/MultiNodePipelineBase.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,11 @@ public Response<Long> waitReplicas(String sampleKey, int replicas, long timeout)
16721672
return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout));
16731673
}
16741674

1675+
@Override
1676+
public Response<KeyValue<Long, Long>> waitAOF(String sampleKey, long numLocal, long numReplicas, long timeout) {
1677+
return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout));
1678+
}
1679+
16751680
@Override
16761681
public Response<Object> eval(String script, String sampleKey) {
16771682
return appendCommand(commandObjects.eval(script, sampleKey));
@@ -2485,6 +2490,11 @@ public Response<Long> waitReplicas(byte[] sampleKey, int replicas, long timeout)
24852490
return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout));
24862491
}
24872492

2493+
@Override
2494+
public Response<KeyValue<Long, Long>> waitAOF(byte[] sampleKey, long numLocal, long numReplicas, long timeout) {
2495+
return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout));
2496+
}
2497+
24882498
@Override
24892499
public Response<Object> eval(byte[] script, byte[] sampleKey) {
24902500
return appendCommand(commandObjects.eval(script, sampleKey));

src/main/java/redis/clients/jedis/Pipeline.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,11 @@ public Response<Long> waitReplicas(String sampleKey, int replicas, long timeout)
16251625
return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout));
16261626
}
16271627

1628+
@Override
1629+
public Response<KeyValue<Long, Long>> waitAOF(String sampleKey, long numLocal, long numReplicas, long timeout) {
1630+
return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout));
1631+
}
1632+
16281633
@Override
16291634
public Response<Object> eval(String script, String sampleKey) {
16301635
return appendCommand(commandObjects.eval(script, sampleKey));
@@ -2438,6 +2443,11 @@ public Response<Long> waitReplicas(byte[] sampleKey, int replicas, long timeout)
24382443
return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout));
24392444
}
24402445

2446+
@Override
2447+
public Response<KeyValue<Long, Long>> waitAOF(byte[] sampleKey, long numLocal, long numReplicas, long timeout) {
2448+
return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout));
2449+
}
2450+
24412451
@Override
24422452
public Response<Object> eval(byte[] script, byte[] sampleKey) {
24432453
return appendCommand(commandObjects.eval(script, sampleKey));
@@ -4227,6 +4237,10 @@ public Response<Long> waitReplicas(int replicas, long timeout) {
42274237
return appendCommand(commandObjects.waitReplicas(replicas, timeout));
42284238
}
42294239

4240+
public Response<KeyValue<Long, Long>> waitAOF(long numLocal, long numReplicas, long timeout) {
4241+
return appendCommand(commandObjects.waitAOF(numLocal, numReplicas, timeout));
4242+
}
4243+
42304244
public Response<List<String>> time() {
42314245
return appendCommand(new CommandObject<>(commandObjects.commandArguments(Protocol.Command.TIME), BuilderFactory.STRING_LIST));
42324246
}

src/main/java/redis/clients/jedis/Protocol.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public static enum Command implements ProtocolCommand {
265265
SSUBSCRIBE, SUNSUBSCRIBE, SPUBLISH, // <-- pub sub
266266
SAVE, BGSAVE, BGREWRITEAOF, LASTSAVE, PERSIST, ROLE, FAILOVER, SLOWLOG, OBJECT, CLIENT, TIME,
267267
SCAN, HSCAN, SSCAN, ZSCAN, WAIT, CLUSTER, ASKING, READONLY, READWRITE, SLAVEOF, REPLICAOF, COPY,
268-
SENTINEL, MODULE, ACL, TOUCH, MEMORY, LOLWUT, COMMAND, LATENCY;
268+
SENTINEL, MODULE, ACL, TOUCH, MEMORY, LOLWUT, COMMAND, LATENCY, WAITAOF;
269269

270270
private final byte[] raw;
271271

src/main/java/redis/clients/jedis/ShardedCommandObjects.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import redis.clients.jedis.resps.ScanResult;
1313
import redis.clients.jedis.util.Hashing;
1414
import redis.clients.jedis.util.JedisClusterHashTag;
15+
import redis.clients.jedis.util.KeyValue;
1516

1617
/**
1718
* @deprecated Sharding/Sharded feature will be removed in next major release.
@@ -113,4 +114,9 @@ public final CommandObject<ScanResult<byte[]>> scan(byte[] cursor, ScanParams pa
113114
public final CommandObject<Long> waitReplicas(int replicas, long timeout) {
114115
throw new UnsupportedOperationException();
115116
}
117+
118+
@Override
119+
public CommandObject<KeyValue<Long, Long>> waitAOF(long numLocal, long numReplicas, long timeout) {
120+
throw new UnsupportedOperationException();
121+
}
116122
}

src/main/java/redis/clients/jedis/TransactionBase.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,6 +1722,11 @@ public Response<Long> waitReplicas(String sampleKey, int replicas, long timeout)
17221722
return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout));
17231723
}
17241724

1725+
@Override
1726+
public Response<KeyValue<Long, Long>> waitAOF(String sampleKey, long numLocal, long numReplicas, long timeout) {
1727+
return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout));
1728+
}
1729+
17251730
@Override
17261731
public Response<Object> eval(String script, String sampleKey) {
17271732
return appendCommand(commandObjects.eval(script, sampleKey));
@@ -2535,6 +2540,11 @@ public Response<Long> waitReplicas(byte[] sampleKey, int replicas, long timeout)
25352540
return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout));
25362541
}
25372542

2543+
@Override
2544+
public Response<KeyValue<Long, Long>> waitAOF(byte[] sampleKey, long numLocal, long numReplicas, long timeout) {
2545+
return appendCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout));
2546+
}
2547+
25382548
@Override
25392549
public Response<Object> eval(byte[] script, byte[] sampleKey) {
25402550
return appendCommand(commandObjects.eval(script, sampleKey));

0 commit comments

Comments
 (0)