| 10 | #include "../graph/graphcontext.h" |
| 11 | |
| 12 | int 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 |
nothing calls this directly
no test coverage detected