@@ -325,9 +325,11 @@ Router public API
325
325
:param argument_list: an array of the function's arguments
326
326
:param options:
327
327
328
- * ``timeout ``— a request timeout, in seconds. The timeout is for the entire ``map_callrw() ``, including all its stages.
328
+ * ``timeout ``--- a request timeout, in seconds. The timeout is for the entire ``map_callrw() ``, including all its stages.
329
329
330
- ``timeout `` is the only supported option.
330
+ * ``return_raw ``---the :ref: `net.box option <net_box-options >` implemented in Tarantool since version 2.10.0.
331
+ If set to ``true ``, ``net.box `` returns the response data wrapped in a :ref: `MessagePack object <msgpack-object-info >` instead of decoding it to Lua.
332
+ For more details, see the **Return ** section below.
331
333
332
334
.. important ::
333
335
@@ -345,6 +347,27 @@ Router public API
345
347
If the function returns ``nil `` or ``box.NULL `` from one of the storages,
346
348
it will not be present in the resulting map.
347
349
350
+ If the ``return_raw `` option is used,
351
+ the result is a map of the following format: ``{[replicaset_uuid] = msgpack.object} ``
352
+ where ``msgpack.object `` is an object that stores a MessagePack array with the results returned from the storage map function.
353
+
354
+ The option use case is the same as in using ``net.box ``: to avoid decoding of the call results into Lua.
355
+ The option can be helpful if a router is used as a proxy and results received from a storage are big.
356
+
357
+ Example:
358
+
359
+ .. code-block :: lua
360
+
361
+ local res = vshard.router.map_callrw('my_func', args, {..., return_raw = true})
362
+
363
+ for replicaset_uuid, msgpack_value in pairs(res) do
364
+ log.info('Replicaset %s returned %s', replicaset_uuid,
365
+ msgpack_value:decode())
366
+ end
367
+
368
+ This is an illustration of the option usage.
369
+ Normally, you don't need to use ``return_raw `` if you call the :ref: `decode() <msgpack-decode_string >` function.
370
+
348
371
* On failure: ``nil ``, error object, and optional replica set UUID where the error occurred.
349
372
UUID will not be returned if the error is not related to a particular replica set.
350
373
For instance, the method fails if not all buckets were found, even if all replica sets were scanned successfully.
@@ -365,6 +388,8 @@ Router public API
365
388
end
366
389
end
367
390
391
+ If the ``return_raw `` option is used, the result on failure is the same as described above.
392
+
368
393
Map-Reduce in vshard can be divided into three stages: Ref, Map, and Reduce.
369
394
370
395
**Ref and Map **. ``map_callrw() `` combines both the Ref and the Map stages.
0 commit comments