summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzhenwei pi <pizhenwei@bytedance.com>2022-08-22 19:44:55 +0800
committerzhenwei pi <pizhenwei@bytedance.com>2022-08-22 19:44:55 +0800
commit89e11486880a59dad3857499e69e54c0b27be689 (patch)
tree5df2d05c00a0ba8a73dec33e3c0e2ab11d5838d9 /src
parent8a59c193105b6ad4cb2b9cc910f0b1ab34d0a3d8 (diff)
downloadredis-89e11486880a59dad3857499e69e54c0b27be689.tar.gz
Introduce redis module ctx flag 'server startup'
A module may be loaded only during initial stage, a typical case is connection type shared library. Introduce REDISMODULE_CTX_FLAGS_SERVER_STARTUP context flag to tell the module the stage of Redis. Then the module gets the flag by RedisModule_GetContextFlags(ctx), tests flags and returns error in onload handler. Suggested-by: Oran Agra <oran@redislabs.com> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Diffstat (limited to 'src')
-rw-r--r--src/module.c5
-rw-r--r--src/redismodule.h4
2 files changed, 1 insertions, 8 deletions
diff --git a/src/module.c b/src/module.c
index 4f0f99d22..7644e2c77 100644
--- a/src/module.c
+++ b/src/module.c
@@ -3531,8 +3531,6 @@ int RM_GetSelectedDb(RedisModuleCtx *ctx) {
* context is using RESP3.
*
* * REDISMODULE_CTX_FLAGS_SERVER_STARTUP: The Redis instance is starting
- *
- * * REDISMODULE_CTX_FLAGS_SENTINEL: The Redis instance is in sentinel mode
*/
int RM_GetContextFlags(RedisModuleCtx *ctx) {
int flags = 0;
@@ -3622,9 +3620,6 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
if (listLength(server.loadmodule_queue) > 0)
flags |= REDISMODULE_CTX_FLAGS_SERVER_STARTUP;
- if (server.sentinel_mode)
- flags |= REDISMODULE_CTX_FLAGS_SENTINEL;
-
return flags;
}
diff --git a/src/redismodule.h b/src/redismodule.h
index 80c099100..6397e704e 100644
--- a/src/redismodule.h
+++ b/src/redismodule.h
@@ -164,13 +164,11 @@ typedef struct RedisModuleStreamID {
#define REDISMODULE_CTX_FLAGS_ASYNC_LOADING (1<<23)
/* Redis is starting. */
#define REDISMODULE_CTX_FLAGS_SERVER_STARTUP (1<<24)
-/* The instance is running in sentinel mode */
-#define REDISMODULE_CTX_FLAGS_SENTINEL (1<<25)
/* Next context flag, must be updated when adding new flags above!
This flag should not be used directly by the module.
* Use RedisModule_GetContextFlagsAll instead. */
-#define _REDISMODULE_CTX_FLAGS_NEXT (1<<26)
+#define _REDISMODULE_CTX_FLAGS_NEXT (1<<25)
/* Keyspace changes notification classes. Every class is associated with a
* character for configuration purposes.