summaryrefslogtreecommitdiff
path: root/tests/support
diff options
context:
space:
mode:
authorMeir Shpilraien (Spielrein) <meir@redis.com>2022-04-05 10:27:24 +0300
committerGitHub <noreply@github.com>2022-04-05 10:27:24 +0300
commitae020e3d5665e46dbd2704b46b6ad207dd4471d9 (patch)
tree607ca81a18206b91131b94f34d25c596d30f3a88 /tests/support
parent2db0d898f8d9daef34a6b9678a905a51cc43c298 (diff)
downloadredis-ae020e3d5665e46dbd2704b46b6ad207dd4471d9.tar.gz
Functions: Move library meta data to be part of the library payload. (#10500)
## Move library meta data to be part of the library payload. Following the discussion on https://github.com/redis/redis/issues/10429 and the intention to add (in the future) library versioning support, we believe that the entire library metadata (like name and engine) should be part of the library payload and not provided by the `FUNCTION LOAD` command. The reasoning behind this is that the programmer who developed the library should be the one who set those values (name, engine, and in the future also version). **It is not the responsibility of the admin who load the library into the database.** The PR moves all the library metadata (engine and function name) to be part of the library payload. The metadata needs to be provided on the first line of the payload using the shebang format (`#!<engine> name=<name>`), example: ```lua #!lua name=test redis.register_function('foo', function() return 1 end) ``` The above script will run on the Lua engine and will create a library called `test`. ## API Changes (compare to 7.0 rc2) * `FUNCTION LOAD` command was change and now it simply gets the library payload and extract the engine and name from the payload. In addition, the command will now return the function name which can later be used on `FUNCTION DELETE` and `FUNCTION LIST`. * The description field was completely removed from`FUNCTION LOAD`, and `FUNCTION LIST` ## Breaking Changes (compare to 7.0 rc2) * Library description was removed (we can re-add it in the future either as part of the shebang line or an additional line). * Loading an AOF file that was generated by either 7.0 rc1 or 7.0 rc2 will fail because the old command syntax is invalid. ## Notes * Loading an RDB file that was generated by rc1 / rc2 **is** supported, Redis will automatically add the shebang to the libraries payloads (we can probably delete that code after 7.0.3 or so since there's no need to keep supporting upgrades from an RC build).
Diffstat (limited to 'tests/support')
-rw-r--r--tests/support/redis.tcl4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/support/redis.tcl b/tests/support/redis.tcl
index 5743be5f4..edcc1fb48 100644
--- a/tests/support/redis.tcl
+++ b/tests/support/redis.tcl
@@ -188,6 +188,10 @@ proc ::redis::__method__readraw {id fd val} {
set ::redis::readraw($id) $val
}
+proc ::redis::__method__readingraw {id fd} {
+ return $::redis::readraw($id)
+}
+
proc ::redis::__method__attributes {id fd} {
set _ $::redis::attributes($id)
}