summaryrefslogtreecommitdiff
path: root/redis/commands/cluster.py
diff options
context:
space:
mode:
authorAnurag Bandyopadhyay <angbpy@gmail.com>2023-05-08 13:31:57 +0530
committerGitHub <noreply@github.com>2023-05-08 11:01:57 +0300
commitcfdcfd87acdc10bedba6230b0cbe7dcf44b4652a (patch)
tree441cd541023347c2ac3b2c161fc93c64970b3865 /redis/commands/cluster.py
parent906e41349d8751f721c452494cdcdb5455258719 (diff)
downloadredis-py-cfdcfd87acdc10bedba6230b0cbe7dcf44b4652a.tar.gz
Add support for cluster myshardid (#2704)
* feat: adding support for cluster myshardid * lint fix * fix: comment fix and async test * fix: adding version check * fix lint: * linters --------- Co-authored-by: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com> Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> Co-authored-by: dvora-h <dvora.heller@redis.com>
Diffstat (limited to 'redis/commands/cluster.py')
-rw-r--r--redis/commands/cluster.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/redis/commands/cluster.py b/redis/commands/cluster.py
index a23a94a..cd93a85 100644
--- a/redis/commands/cluster.py
+++ b/redis/commands/cluster.py
@@ -45,7 +45,6 @@ from .redismodules import RedisModuleCommands
if TYPE_CHECKING:
from redis.asyncio.cluster import TargetNodesT
-
# Not complete, but covers the major ones
# https://redis.io/commands
READ_COMMANDS = frozenset(
@@ -634,6 +633,14 @@ class ClusterManagementCommands(ManagementCommands):
"""
return self.execute_command("CLUSTER SHARDS", target_nodes=target_nodes)
+ def cluster_myshardid(self, target_nodes=None):
+ """
+ Returns the shard ID of the node.
+
+ For more information see https://redis.io/commands/cluster-myshardid/
+ """
+ return self.execute_command("CLUSTER MYSHARDID", target_nodes=target_nodes)
+
def cluster_links(self, target_node: "TargetNodesT") -> ResponseT:
"""
Each node in a Redis Cluster maintains a pair of long-lived TCP link with each