1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/* vector set module configuration.
*
* Copyright (c) 2009-Present, Redis Ltd.
* All rights reserved.
*
* Licensed under your choice of (a) the Redis Source Available License 2.0
* (RSALv2); or (b) the Server Side Public License v1 (SSPLv1); or (c) the
* GNU Affero General Public License v3 (AGPLv3).
*/
#include "vset_config.h"
/* Define __STRING macro for portability (not available in all environments) */
#ifndef __STRING
#define __STRING(x) #x
#endif
#define RM_TRY(expr) \
if (expr == REDISMODULE_ERR) { \
RedisModule_Log(ctx, "warning", "Could not run " __STRING(expr)); \
return REDISMODULE_ERR; \
}
VSConfig VSGlobalConfig;
int set_bool_config(const char *name, int val, void *privdata,
RedisModuleString **err) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(err);
*(int *)privdata = val;
return REDISMODULE_OK;
}
int get_bool_config(const char *name, void *privdata) {
REDISMODULE_NOT_USED(name);
return *(int *)privdata;
}
int RegisterModuleConfig(RedisModuleCtx *ctx) {
// Numeric parameters
RM_TRY(
RedisModule_RegisterBoolConfig(
ctx, "vset-force-single-threaded-execution", 0,
REDISMODULE_CONFIG_UNPREFIXED,
get_bool_config, set_bool_config, NULL,
(void *)&(VSGlobalConfig.forceSingleThreadExec)
)
)
return REDISMODULE_OK;
}
|