From 26b1e77eafd1a9367e3be0f90be9d65ff4afaa90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= Date: Tue, 22 Aug 2023 09:22:57 +0200 Subject: [PATCH] Rename cluster_update_route to redisClusterUpdateSlotmap --- hircluster.c | 12 ++++++------ hircluster.h | 5 ++++- hiredis_cluster.def | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/hircluster.c b/hircluster.c index d354025..74f2220 100644 --- a/hircluster.c +++ b/hircluster.c @@ -1436,7 +1436,7 @@ static int updateNodesAndSlotmap(redisClusterContext *cc, dict *nodes) { return REDIS_ERR; } -int cluster_update_route(redisClusterContext *cc) { +int redisClusterUpdateSlotmap(redisClusterContext *cc) { int ret; int flag_err_not_set = 1; redisClusterNode *node; @@ -1547,7 +1547,7 @@ static int _redisClusterConnect2(redisClusterContext *cc) { return REDIS_ERR; } - return cluster_update_route(cc); + return redisClusterUpdateSlotmap(cc); } /* Connect to a Redis cluster. On error the field error in the returned @@ -1563,7 +1563,7 @@ static redisClusterContext *_redisClusterConnect(redisClusterContext *cc, return cc; } - cluster_update_route(cc); + redisClusterUpdateSlotmap(cc); return cc; } @@ -2333,7 +2333,7 @@ static void *redis_cluster_command_execute(redisClusterContext *cc, /* Deferred update route using the node that sent the * redirect. */ c_updating_route = c; - } else if (cluster_update_route(cc) == REDIS_OK) { + } else if (redisClusterUpdateSlotmap(cc) == REDIS_OK) { /* Synchronous update route successful using new connection. */ cc->err = 0; cc->errstr[0] = '\0'; @@ -2412,7 +2412,7 @@ static void *redis_cluster_command_execute(redisClusterContext *cc, /* Clear error and update synchronously using another node. */ cc->err = 0; cc->errstr[0] = '\0'; - if (cluster_update_route(cc) != REDIS_OK) { + if (redisClusterUpdateSlotmap(cc) != REDIS_OK) { /* Clear the reply to indicate failure. */ freeReplyObject(reply); reply = NULL; @@ -3535,7 +3535,7 @@ void redisClusterReset(redisClusterContext *cc) { } if (cc->need_update_route) { - status = cluster_update_route(cc); + status = redisClusterUpdateSlotmap(cc); if (status != REDIS_OK) { /* Specific error already set */ return; diff --git a/hircluster.h b/hircluster.h index cb09c16..806816e 100644 --- a/hircluster.h +++ b/hircluster.h @@ -267,8 +267,10 @@ int redisClusterGetReply(redisClusterContext *cc, void **reply); /* Reset context after a performed pipelining */ void redisClusterReset(redisClusterContext *cc); +/* Update the slotmap by querying any node. */ +int redisClusterUpdateSlotmap(redisClusterContext *cc); + /* Internal functions */ -int cluster_update_route(redisClusterContext *cc); redisContext *ctx_get_by_node(redisClusterContext *cc, redisClusterNode *node); struct dict *parse_cluster_nodes(redisClusterContext *cc, char *str, int str_len, int flags); @@ -337,6 +339,7 @@ redisClusterNode *redisClusterGetNodeByKey(redisClusterContext *cc, char *key); /* Old names of renamed functions and types, kept for backward compatibility. */ #ifndef HIRCLUSTER_NO_OLD_NAMES +#define cluster_update_route redisClusterUpdateSlotmap #define initNodeIterator redisClusterInitNodeIterator #define nodeNext redisClusterNodeNext #define redisClusterConnectNonBlock redisClusterConnect diff --git a/hiredis_cluster.def b/hiredis_cluster.def index 213320c..56d99a6 100644 --- a/hiredis_cluster.def +++ b/hiredis_cluster.def @@ -1,6 +1,5 @@ EXPORTS actx_get_by_node - cluster_update_route command_destroy command_get ctx_get_by_node @@ -55,6 +54,7 @@ redisClusterSetOptionTimeout redisClusterSetOptionUsername redisClusterSetOptionPassword + redisClusterUpdateSlotmap redisClustervAppendCommand redisClustervAsyncCommand redisClustervCommand