Add CLUSTER INFO, CLUSTER SETSLOT and CLUSTER GETKEYSINSLOT commands
This commit is contained in:
@@ -3100,4 +3100,35 @@ public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommand
|
||||
client.cluster(Protocol.CLUSTER_DELSLOTS, slots);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public String clusterInfo() {
|
||||
checkIsInMulti();
|
||||
client.cluster(Protocol.CLUSTER_INFO);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public List<String> clusterGetKeysInSlot(final int slot, final int count) {
|
||||
checkIsInMulti();
|
||||
final int[] args = new int[]{ slot, count };
|
||||
client.cluster(Protocol.CLUSTER_GETKEYSINSLOT, args);
|
||||
return client.getMultiBulkReply();
|
||||
}
|
||||
|
||||
public String clusterSetSlotNode(final int slot, final String nodeId) {
|
||||
checkIsInMulti();
|
||||
client.cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot), Protocol.CLUSTER_SETSLOT_NODE, nodeId);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public String clusterSetSlotMigrating(final int slot, final String nodeId) {
|
||||
checkIsInMulti();
|
||||
client.cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot), Protocol.CLUSTER_SETSLOT_MIGRATING, nodeId);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
|
||||
public String clusterSetSlotImporting(final int slot, final String nodeId) {
|
||||
checkIsInMulti();
|
||||
client.cluster(Protocol.CLUSTER_SETSLOT, String.valueOf(slot), Protocol.CLUSTER_SETSLOT_IMPORTING, nodeId);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,12 @@ public final class Protocol {
|
||||
public static final String CLUSTER_MEET = "meet";
|
||||
public static final String CLUSTER_ADDSLOTS = "addslots";
|
||||
public static final String CLUSTER_DELSLOTS = "delslots";
|
||||
public static final String CLUSTER_INFO = "info";
|
||||
public static final String CLUSTER_GETKEYSINSLOT = "getkeysinslot";
|
||||
public static final String CLUSTER_SETSLOT = "setslot";
|
||||
public static final String CLUSTER_SETSLOT_NODE = "node";
|
||||
public static final String CLUSTER_SETSLOT_MIGRATING = "migrating";
|
||||
public static final String CLUSTER_SETSLOT_IMPORTING = "importing";
|
||||
|
||||
private Protocol() {
|
||||
// this prevent the class from instantiation
|
||||
|
||||
Reference in New Issue
Block a user