MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / RM_ServerInfoGetFieldSigned

Function RM_ServerInfoGetFieldSigned

src/module.cpp:7350–7363  ·  view source on GitHub ↗

Get the value of a field from data collected with RM_GetServerInfo(). If the * field is not found, or is not numerical or out of range, return value will be * 0, and the optional out_err argument will be set to REDISMODULE_ERR. */

Source from the content-addressed store, hash-verified

7348 * field is not found, or is not numerical or out of range, return value will be
7349 * 0, and the optional out_err argument will be set to REDISMODULE_ERR. */
7350long long RM_ServerInfoGetFieldSigned(RedisModuleServerInfoData *data, const char* field, int *out_err) {
7351 long long ll;
7352 sds val = (sds)raxFind(data->rax, (unsigned char *)field, strlen(field));
7353 if (val == raxNotFound) {
7354 if (out_err) *out_err = REDISMODULE_ERR;
7355 return 0;
7356 }
7357 if (!string2ll(val,sdslen(val),&ll)) {
7358 if (out_err) *out_err = REDISMODULE_ERR;
7359 return 0;
7360 }
7361 if (out_err) *out_err = REDISMODULE_OK;
7362 return ll;
7363}
7364
7365/* Get the value of a field from data collected with RM_GetServerInfo(). If the
7366 * field is not found, or is not numerical or out of range, return value will be

Callers

nothing calls this directly

Calls 3

raxFindFunction · 0.85
sdslenFunction · 0.85
string2llFunction · 0.70

Tested by

no test coverage detected