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

Function Graph_Effect

src/commands/cmd_effect.c:12–47  ·  view source on GitHub ↗

GRAPH.EFFECT command handler

Source from the content-addressed store, hash-verified

10
11// GRAPH.EFFECT command handler
12int 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

Callers

nothing calls this directly

Calls 3

GraphContext_RetrieveFunction · 0.85
Effects_ApplyFunction · 0.85

Tested by

no test coverage detected