net.box: add return_raw request option
Closes #4861 @TarantoolBot document Title: Document return_raw net.box option If the `return_raw` flag is set, net.box will return response data wrapped in a msgpack object (see `msgpack.object()`) instead of decoding it to Lua. This can be useful when a response is supposed to be passed through without decoding or with partial decoding - creating a msgpack object can reduce pressure on the Lua garbage collector in this case. Example: ```lua local c = require('net.box').connect(uri) local mp = c.eval('eval ...', {1, 2, 3}, {return_raw = true}) mp:decode() -- {1, 2, 3} ``` The option is ignored for methods that return nil (`begin`, `commit`, `rollback`, `upsert`, `prepare` will return nil even if `return_raw` is set) and for `index.count` (it returns a number). For `execute`, the option is applied only to data (`rows`) while metadata is decoded irrespective of the value of `return_raw`.
Showing
- changelogs/unreleased/gh-4861-net-box-return-raw.md 4 additions, 0 deletionschangelogs/unreleased/gh-4861-net-box-return-raw.md
- src/box/lua/net_box.c 96 additions, 34 deletionssrc/box/lua/net_box.c
- src/box/lua/net_box.lua 6 additions, 5 deletionssrc/box/lua/net_box.lua
- src/lua/msgpack.c 9 additions, 0 deletionssrc/lua/msgpack.c
- src/lua/msgpack.h 7 additions, 0 deletionssrc/lua/msgpack.h
- test/box-luatest/net_box_test.lua 122 additions, 0 deletionstest/box-luatest/net_box_test.lua
Loading
Please register or sign in to comment