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

Function Graph_List

src/commands/cmd_list.c:12–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "../graph/graphcontext.h"
11
12int Graph_List
13(
14 RedisModuleCtx *ctx,
15 RedisModuleString **argv,
16 int argc
17) {
18 ASSERT(ctx != NULL);
19
20 if(argc != 1) {
21 return RedisModule_WrongArity(ctx);
22 }
23
24 KeySpaceGraphIterator it;
25 Globals_ScanGraphs(&it);
26 RedisModule_ReplyWithArray(ctx, REDISMODULE_POSTPONED_LEN);
27
28 // reply with each graph name
29 uint64_t n = 0;
30 GraphContext *gc = NULL;
31
32 while((gc = GraphIterator_Next(&it)) != NULL) {
33 const char *name = GraphContext_GetName(gc);
34 RedisModule_ReplyWithStringBuffer(ctx, name, strlen(name));
35 n++;
36 GraphContext_DecreaseRefCount(gc);
37 }
38
39 RedisModule_ReplySetArrayLength(ctx, n);
40
41 return REDISMODULE_OK;
42}
43

Callers

nothing calls this directly

Calls 4

Globals_ScanGraphsFunction · 0.85
GraphIterator_NextFunction · 0.85
GraphContext_GetNameFunction · 0.85

Tested by

no test coverage detected