kvrocks
kvrocks copied to clipboard
Add support for `flags` parameter of `redis.register_function`
Search before asking
https://redis.io/docs/interact/programmability/functions-intro/#function-flags
Motivation
compatibility
Solution
No response
Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
@PragmaTwice
-
flagsparameter inredis.register_function - will allow
no-writesflag - do we need to support other flags? like
allow-oom,admin
Possible implementation:
-
RedisRegisterFunctionparsesflagstable and checks forno-writessrc/storage/scripting.cc - if invalid flag, raise error, else store as constant (or something else)
- check function flags before execution
FunctionCallsrc/storage/scripting.cc
if (read_only && !(flags & redis::kFunctionNoWrites)) {
return {Status::NotOK, "Can not execute a function with write flag using fcall_ro."};
}