GRAPH.EFFECT command handler
| 10 | |
| 11 | // GRAPH.EFFECT command handler |
| 12 | int Graph_Effect |
| 13 | ( |
| 14 | RedisModuleCtx *ctx, // redis module context |
| 15 | RedisModuleString **argv, // command arguments |
| 16 | int argc // number of arguments |
| 17 | ) { |
| 18 | // GRAPH.EFFECT <key> <effects> |
| 19 | if(argc != 3) { |
| 20 | return RedisModule_WrongArity(ctx); |
| 21 | } |
| 22 | |
| 23 | // get graph context |
| 24 | GraphContext *gc = GraphContext_Retrieve(ctx, argv[1], false, true); |
| 25 | ASSERT(gc != NULL); |
| 26 | |
| 27 | //-------------------------------------------------------------------------- |
| 28 | // process effects |
| 29 | //-------------------------------------------------------------------------- |
| 30 | |
| 31 | size_t l = 0; // effects buffer length |
| 32 | const char *effects_buff = RedisModule_StringPtrLen(argv[2], &l); |
| 33 | |
| 34 | // apply effects |
| 35 | Effects_Apply(gc, effects_buff, l); |
| 36 | |
| 37 | // release GraphContext |
| 38 | GraphContext_DecreaseRefCount(gc); |
| 39 | |
| 40 | // replicate effect |
| 41 | RedisModule_ReplicateVerbatim(ctx); |
| 42 | |
| 43 | // reply back to caller |
| 44 | RedisModule_ReplyWithSimpleString(ctx, "OK"); |
| 45 | |
| 46 | return REDISMODULE_OK; |
| 47 | } |
| 48 |
nothing calls this directly
no test coverage detected