Merge branch 'cluster' of github.com:marcosnils/jedis into marcosnils-cluster
Conflicts: src/main/java/redis/clients/jedis/BinaryClient.java src/main/java/redis/clients/jedis/Client.java src/main/java/redis/clients/jedis/Jedis.java src/main/java/redis/clients/jedis/Protocol.java
This commit is contained in:
@@ -820,4 +820,65 @@ public class Client extends BinaryClient implements Commands {
|
||||
public void zscan(final String key, int cursor, final ScanParams params) {
|
||||
zscan(SafeEncoder.encode(key), cursor, params);
|
||||
}
|
||||
|
||||
public void cluster(final String subcommand, final int... args) {
|
||||
final byte[][] arg = new byte[args.length+1][];
|
||||
for (int i = 1; i < arg.length; i++) {
|
||||
arg[i] = toByteArray(args[i-1]);
|
||||
}
|
||||
arg[0] = SafeEncoder.encode(subcommand);
|
||||
cluster(arg);
|
||||
}
|
||||
|
||||
public void cluster(final String subcommand, final String... args) {
|
||||
final byte[][] arg = new byte[args.length+1][];
|
||||
for (int i = 1; i < arg.length; i++) {
|
||||
arg[i] = SafeEncoder.encode(args[i-1]);
|
||||
}
|
||||
arg[0] = SafeEncoder.encode(subcommand);
|
||||
cluster(arg);
|
||||
}
|
||||
|
||||
public void cluster(final String subcommand) {
|
||||
final byte[][] arg = new byte[1][];
|
||||
arg[0] = SafeEncoder.encode(subcommand);
|
||||
cluster(arg);
|
||||
}
|
||||
|
||||
public void clusterNodes() {
|
||||
cluster(Protocol.CLUSTER_NODES);
|
||||
}
|
||||
|
||||
public void clusterMeet(final String ip, final int port) {
|
||||
cluster(Protocol.CLUSTER_MEET, ip, String.valueOf(port));
|
||||
}
|
||||
|
||||
public void clusterAddSlots(final int ...slots) {
|
||||
cluster(Protocol.CLUSTER_ADDSLOTS, slots);
|
||||
}
|
||||
|
||||
public void clusterDelSlots(final int ...slots) {
|
||||
cluster(Protocol.CLUSTER_DELSLOTS, slots);
|
||||
}
|
||||
|
||||
public void clusterInfo() {
|
||||
cluster(Protocol.CLUSTER_INFO);
|
||||
}
|
||||
|
||||
public void clusterGetKeysInSlot(final int slot, final int count) {
|
||||
final int[] args = new int[]{ slot, count };
|
||||
cluster(Protocol.CLUSTER_GETKEYSINSLOT, args);
|
||||
}
|
||||
|
||||
public void clusterSetSlotNode(final int slot, final String nodeId) {
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot), Protocol.CLUSTER_SETSLOT_NODE, nodeId);
|
||||
}
|
||||
|
||||
public void clusterSetSlotMigrating(final int slot, final String nodeId) {
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot), Protocol.CLUSTER_SETSLOT_MIGRATING, nodeId);
|
||||
}
|
||||
|
||||
public void clusterSetSlotImporting(final int slot, final String nodeId) {
|
||||
cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot), Protocol.CLUSTER_SETSLOT_IMPORTING, nodeId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user