summaryrefslogtreecommitdiff
path: root/src/redismodule.h
diff options
context:
space:
mode:
authorzhenwei pi <pizhenwei@bytedance.com>2022-08-03 09:48:01 +0800
committerzhenwei pi <pizhenwei@bytedance.com>2022-08-22 15:16:42 +0800
commit8a59c193105b6ad4cb2b9cc910f0b1ab34d0a3d8 (patch)
tree7f1f75a5289580a3ce008599542dac28c508dcbf /src/redismodule.h
parent0c4d2fcc8eff5331ab113c5a0e3db0529d7d1e74 (diff)
downloadredis-8a59c193105b6ad4cb2b9cc910f0b1ab34d0a3d8.tar.gz
Introduce redis module ctx flag 'server startup' & 'sentinel'
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. Also introduce 'REDISMODULE_CTX_FLAGS_SENTINEL' context flag to tell the module the sentinel mode or not. Suggested-by: Oran Agra <oran@redislabs.com> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Diffstat (limited to 'src/redismodule.h')
-rw-r--r--src/redismodule.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/redismodule.h b/src/redismodule.h
index 046677eed..80c099100 100644
--- a/src/redismodule.h
+++ b/src/redismodule.h
@@ -162,11 +162,15 @@ typedef struct RedisModuleStreamID {
#define REDISMODULE_CTX_FLAGS_RESP3 (1<<22)
/* Redis is currently async loading database for diskless replication. */
#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<<24)
+#define _REDISMODULE_CTX_FLAGS_NEXT (1<<26)
/* Keyspace changes notification classes. Every class is associated with a
* character for configuration purposes.