summaryrefslogtreecommitdiff
path: root/src/redismodule.h
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2022-04-26 20:29:20 +0300
committerGitHub <noreply@github.com>2022-04-26 20:29:20 +0300
commit81926254586f64fc6a9b393bf9afb0d2eacc5234 (patch)
tree51e28f518fc8f6219fd82395f76df3266b5ed3d1 /src/redismodule.h
parent46ec6ad98e6d118bd98a447dcd2307e80bb0fcd6 (diff)
downloadredis-81926254586f64fc6a9b393bf9afb0d2eacc5234.tar.gz
Add module API flag for using enum configs as bit flags (#10643)
Enables registration of an enum config that'll let the user pass multiple keywords that will be combined with `|` as flags into the integer config value. ``` const char *enum_vals[] = {"none", "one", "two", "three"}; const int int_vals[] = {0, 1, 2, 4}; if (RedisModule_RegisterEnumConfig(ctx, "flags", 3, REDISMODULE_CONFIG_DEFAULT | REDISMODULE_CONFIG_BITFLAGS, enum_vals, int_vals, 4, getFlagsConfigCommand, setFlagsConfigCommand, NULL, NULL) == REDISMODULE_ERR) { return REDISMODULE_ERR; } ``` doing: `config set moduleconfigs.flags "two three"` will result in 6 being passed to`setFlagsConfigCommand`.
Diffstat (limited to 'src/redismodule.h')
-rw-r--r--src/redismodule.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/redismodule.h b/src/redismodule.h
index e72f5f7bc..cd389dd00 100644
--- a/src/redismodule.h
+++ b/src/redismodule.h
@@ -88,6 +88,7 @@
#define REDISMODULE_CONFIG_DENY_LOADING (1ULL<<6) /* This config is forbidden during loading. */
#define REDISMODULE_CONFIG_MEMORY (1ULL<<7) /* Indicates if this value can be set as a memory value */
+#define REDISMODULE_CONFIG_BITFLAGS (1ULL<<8) /* Indicates if this value can be set as a multiple enum values */
/* StreamID type. */
typedef struct RedisModuleStreamID {