This Redis command binds the normal Redis command invocation with commands * exported by modules. */
| 711 | /* This Redis command binds the normal Redis command invocation with commands |
| 712 | * exported by modules. */ |
| 713 | void RedisModuleCommandDispatcher(client *c) { |
| 714 | RedisModuleCommandProxy *cp = (RedisModuleCommandProxy*)(unsigned long)c->cmd->getkeys_proc; |
| 715 | RedisModuleCtx ctx = REDISMODULE_CTX_INIT; |
| 716 | |
| 717 | ctx.flags |= REDISMODULE_CTX_MODULE_COMMAND_CALL; |
| 718 | ctx.module = cp->module; |
| 719 | ctx.client = c; |
| 720 | cp->func(&ctx,(void**)c->argv,c->argc); |
| 721 | moduleFreeContext(&ctx); |
| 722 | |
| 723 | /* In some cases processMultibulkBuffer uses sdsMakeRoomFor to |
| 724 | * expand the query buffer, and in order to avoid a big object copy |
| 725 | * the query buffer SDS may be used directly as the SDS string backing |
| 726 | * the client argument vectors: sometimes this will result in the SDS |
| 727 | * string having unused space at the end. Later if a module takes ownership |
| 728 | * of the RedisString, such space will be wasted forever. Inside the |
| 729 | * Redis core this is not a problem because tryObjectEncoding() is called |
| 730 | * before storing strings in the key space. Here we need to do it |
| 731 | * for the module. */ |
| 732 | for (int i = 0; i < c->argc; i++) { |
| 733 | /* Only do the work if the module took ownership of the object: |
| 734 | * in that case the refcount is no longer 1. */ |
| 735 | if (c->argv[i]->getrefcount(std::memory_order_relaxed) > 1) |
| 736 | trimStringObjectIfNeeded(c->argv[i]); |
| 737 | } |
| 738 | } |
| 739 | |
| 740 | /* This function returns the list of keys, with the same interface as the |
| 741 | * 'getkeys' function of the native commands, for module commands that exported |
nothing calls this directly
no test coverage detected