MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _Config_get

Function _Config_get

src/commands/cmd_config.c:34–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void _Config_get
35(
36 RedisModuleCtx *ctx,
37 RedisModuleString **argv,
38 int argc
39) {
40 // return the given config's value to the user
41 Config_Option_Field config_field;
42 const char *config_name = RedisModule_StringPtrLen(argv[2], NULL);
43
44 // return entire configuration
45 if(!strcmp(config_name, "*")) {
46 _Config_get_all(ctx);
47 return;
48 }
49
50 // return specific configuration field
51 if(!Config_Contains_field(config_name, &config_field)) {
52 RedisModule_ReplyWithError(ctx, "Unknown configuration field");
53 return;
54 }
55
56 long long value = 0;
57
58 if(Config_Option_get(config_field, &value)) {
59 RedisModule_ReplyWithArray(ctx, 2);
60 RedisModule_ReplyWithCString(ctx, config_name);
61 RedisModule_ReplyWithLongLong(ctx, value);
62 } else {
63 RedisModule_ReplyWithError(ctx, "Configuration field was not found");
64 }
65}
66
67void _Config_set
68(

Callers 1

Graph_ConfigFunction · 0.85

Calls 3

_Config_get_allFunction · 0.85
Config_Contains_fieldFunction · 0.85
Config_Option_getFunction · 0.85

Tested by

no test coverage detected