| 9 | #include "./ops/ops.h" |
| 10 | |
| 11 | void _ExecutionPlan_Print(const OpBase *op, RedisModuleCtx *ctx, sds *buffer, |
| 12 | int ident, int *op_count) { |
| 13 | if(!op) return; |
| 14 | |
| 15 | *op_count += 1; // account for current operation. |
| 16 | |
| 17 | // Construct operation string representation. |
| 18 | sdsclear(*buffer); |
| 19 | *buffer = sdscatprintf(*buffer, "%*s", ident, ""); |
| 20 | OpBase_ToString(op, buffer); |
| 21 | |
| 22 | RedisModule_ReplyWithStringBuffer(ctx, *buffer, sdslen(*buffer)); |
| 23 | |
| 24 | // Recurse over child operations. |
| 25 | for(int i = 0; i < op->childCount; i++) { |
| 26 | _ExecutionPlan_Print(op->children[i], ctx, buffer, ident + 4, op_count); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | // Reply with a string representation of given execution plan. |
| 31 | void ExecutionPlan_Print(const ExecutionPlan *plan, RedisModuleCtx *ctx) { |
no test coverage detected