[Tarantool-patches] [PATCH 06/20] net.box: rename request.ctx to request.format
Vladimir Davydov
vdavydov at tarantool.org
Thu Jul 29 13:54:59 MSK 2021
On Thu, Jul 29, 2021 at 12:49:39AM +0200, Vladislav Shpilevoy wrote:
> On 23.07.2021 13:07, Vladimir Davydov via Tarantool-patches wrote:
> > Request context only stores tuple format or nil, which is used for
> > decoding a response. Rename it appropriately.
>
> The name ctx was chosen intentionally, because when you pass it to
> method_decoder[request.method](...), you don't know how will it be
> used and what is stores. It was internal for the request sender and
> codec. Why do you need to change it?
For one thing, it's always either nil or format. Naming it ctx is
confusing.
The reason I'm doing this in the scope of this series is that it is
stored in the request class. Lua isn't a strictly typed language so we
can store whatever we want there, but in C we need to know the type to
define the request struct, see netbox_request::format here:
https://github.com/tarantool/tarantool/blob/73cab8402f7e098c8e908af9a2b72695c754c472/src/box/lua/net_box.c#L99
Turning ctx to format solves this problem.
More information about the Tarantool-patches
mailing list