valkey-io / valkey

A new project to resume development on the formerly open-source Redis project. We're calling it Valkey, since it's a twist on the key-value datastore.

Home Page:https://valkey.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[NEW]module filter support CommandFilterKeyAtPos

artikell opened this issue · comments

The problem/use-case that the feature addresses

In the current module implementation, this filter cannot effectively locate the position of the key. We have several APIs, such as:
-ValkeyModule_CommandFilterArgsCount
-ValkeyModule_CommandFilterArgGet
-ValkeyModule_CommandFilterArgInsert
...

However, this does not effectively locate the index of the command's key.

Description of the feature

If ValkeyModule_KeyAtPos can support filters in this area, then filters will be greatly expanded.
For example, supporting an API for ValkeyModule_CommandFilterKeyAtPos

Alternatives you've considered

Without this feature, it is difficult to achieve precise positioning and replacement of command keys. To achieve the same function, we can only enumerate the keys of all commands to implement this function.

Additional information

Perhaps we can consider the usage scenarios of the module filter function now.

Do you know longer need these APIs?

Do you know longer need these APIs?

This is actually a ValkeyModuleCtx added to the API of ValkeyModule_GetCommandKeys, but the API is not used. It can still be used in module filters, but if ValkeyModuleCtx is used in the future, module filters will not be able to obtain key information. Perhaps we need to remove the dependency of ValkeyModule_GetCommandKeys on ValkeyModuleCtx.