From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tarantool-patches@freelists.org,
Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: Re: [tarantool-patches] [PATCH v3 4/7] lua: add non-recursive msgpack decoding functions
Date: Thu, 18 Apr 2019 21:30:22 +0300 [thread overview]
Message-ID: <20190418183019.nolq3dprawgeubxw@tkn_work_nb> (raw)
In-Reply-To: <20190418173528.GL13022@chai>
In short:
* The behaviour is what I need (I cannot skip data).
* The names are confusing, but I don't see better variants. These ones
at least consistent with others.
I posted below relevant discussions, old variants, possible variants,
usage examples and so on.
WBR, Alexander Turenko.
On Thu, Apr 18, 2019 at 08:35:28PM +0300, Konstantin Osipov wrote:
> * Alexander Turenko <alexander.turenko@tarantool.org> [19/04/10 18:23]:
> > Contracts:
> >
> > ```
> > msgpack.decode_array(buf.rpos, buf:size()) -> arr_len, new_rpos
> > msgpack.decode_map(buf.rpos, buf:size()) -> map_len, new_rpos
> > ```
>
> From what they do, they actually neither decode nor skip an
> array/map. They decode array/map header only. I know that msgpuck
> uses this naming, but it is actually confusing.
Yep, names are most hard part of the patch. They were check_array/map(),
then were renamed to decode_array/map(). The relevant parts from the
previous discussion:
Vladimir:
> Not sure about the name either, because it doesn't just checks the
> msgpack - it decodes it, but can't come up with anything substantially
> better. May be, msgpack.decode_array?
>
> https://www.freelists.org/post/tarantool-patches/PATCH-v2-56-netbox-add-helpers-to-decode-msgpack-headers,1
Me:
> Re name: now I understood: decode_unchecked() is like mp_decode(),
> decode() is like mp_check() + mp_decode(). So it worth to rename it to
> decode_array(). Done.
>
> https://www.freelists.org/post/tarantool-patches/PATCH-v2-56-netbox-add-helpers-to-decode-msgpack-headers,2
All the words 'check', 'skip' and 'decode' are assumed intuitively as
something related to the whole array/map. The only thing we able to do
here is to add '_header' postfix (it would look a bit weird, IMHO).
Should I do?
> Why not just encode array/map header, but skip array/map data in
> these functions and and call them msgpack.skip_array(),
> msgpack.skip_map() respectively?
I need to skip an array/map header (and save length), but feed bare data
to a source constructor.
Initially I had a parameter in merger (now it would be in a source
constructor) that say how much array headers it need to skip before
actually read tuples. AFAIR, the option values were BUFFER_RAW,
BUFFER_SELECT, BUFFER_CALL, BUFFER_CHUNKED.
Then we decided to factor it our from merger and then splitted to
msgpack helpers and a net.box option.
> > +
> > + uint32_t len = mp_decode_array(&data);
>
> This doesn't actually skip array members, does it.
This is exactly what I need.
Don't know how to describe it in short. I receive [[tuple, tuple, ...],
[tuple, tuple, ...]] in a buffer and need to feed each [tuple, tuple,
...] part to merger.
The following sections of merger's examples should shed light on that I
hope:
https://github.com/Totktonada/tarantool-merger-examples/tree/695fc9511685033f4b4b22c0df537a12ddf2eaf6#preparing-buffers
https://github.com/Totktonada/tarantool-merger-examples/tree/695fc9511685033f4b4b22c0df537a12ddf2eaf6#multiplexing-requests
The usage example itself is here:
https://github.com/Totktonada/tarantool-merger-examples/blob/695fc9511685033f4b4b22c0df537a12ddf2eaf6/multiplexed_example/frontend.lua#L38-L46
WBR, Alexander Turenko.
next prev parent reply other threads:[~2019-04-18 18:30 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-10 15:21 [PATCH v3 0/7] Merger Alexander Turenko
2019-04-10 15:21 ` [PATCH v3 1/7] Add luaL_iscallable with support of cdata metatype Alexander Turenko
2019-04-18 17:30 ` [tarantool-patches] " Konstantin Osipov
2019-04-30 12:45 ` Vladimir Davydov
2019-04-10 15:21 ` [PATCH v3 2/7] Add functions to ease using Lua iterators from C Alexander Turenko
2019-04-18 17:31 ` [tarantool-patches] " Konstantin Osipov
2019-04-30 12:46 ` Vladimir Davydov
2019-04-10 15:21 ` [PATCH v3 3/7] lua: optimize creation of a tuple from a tuple Alexander Turenko
2019-04-18 17:32 ` [tarantool-patches] " Konstantin Osipov
2019-04-30 12:50 ` Vladimir Davydov
2019-04-30 15:07 ` Alexander Turenko
2019-04-10 15:21 ` [PATCH v3 4/7] lua: add non-recursive msgpack decoding functions Alexander Turenko
2019-04-18 17:35 ` [tarantool-patches] " Konstantin Osipov
2019-04-18 18:30 ` Alexander Turenko [this message]
2019-04-18 18:33 ` Konstantin Osipov
2019-04-18 18:44 ` Alexander Turenko
2019-04-30 13:03 ` Vladimir Davydov
2019-04-30 18:38 ` Alexander Turenko
2019-04-10 15:21 ` [PATCH v3 5/7] net.box: add skip_header option to use with buffer Alexander Turenko
2019-04-18 17:37 ` [tarantool-patches] " Konstantin Osipov
2019-04-18 18:39 ` Alexander Turenko
2019-04-30 13:16 ` Vladimir Davydov
2019-04-30 18:39 ` Alexander Turenko
2019-04-10 15:21 ` [PATCH v3 6/7] Add merger for tuples streams (C part) Alexander Turenko
2019-04-25 11:43 ` [tarantool-patches] " Konstantin Osipov
2019-04-25 13:32 ` Alexander Turenko
2019-04-25 13:45 ` Konstantin Osipov
2019-04-25 15:32 ` [tarantool-patches] " Alexander Turenko
2019-04-25 16:42 ` Konstantin Osipov
2019-04-30 15:34 ` Vladimir Davydov
2019-05-07 22:14 ` Alexander Turenko
2019-04-10 15:21 ` [PATCH v3 7/7] Add merger for tuple streams (Lua part) Alexander Turenko
2019-04-25 11:46 ` [tarantool-patches] " Konstantin Osipov
2019-04-25 12:53 ` Alexander Turenko
2019-04-25 13:30 ` Konstantin Osipov
2019-04-30 17:37 ` Vladimir Davydov
2019-04-30 21:09 ` [tarantool-patches] " Konstantin Osipov
2019-05-02 9:48 ` Vladimir Davydov
2019-05-07 22:14 ` Alexander Turenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190418183019.nolq3dprawgeubxw@tkn_work_nb \
--to=alexander.turenko@tarantool.org \
--cc=kostja@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=vdavydov.dev@gmail.com \
--subject='Re: [tarantool-patches] [PATCH v3 4/7] lua: add non-recursive msgpack decoding functions' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox