Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: imeevma@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH v1 1/2] netbox: store method_encoder args in request
Date: Tue, 11 Jun 2019 11:15:06 +0300	[thread overview]
Message-ID: <20190611081506.6b3jftczzd4kmhrl@esperanza> (raw)
In-Reply-To: <048ffe41499516502f00d8576d647f50d8596d66.1560160282.git.imeevma@gmail.com>

On Mon, Jun 10, 2019 at 01:02:23PM +0300, imeevma@tarantool.org wrote:
> This patch changes the way arguments are passed to functions in
> the array method_encoder, and saves these arguments in REQUEST.
> This is necessary to establish a connection between netbox space
> objects and the tuples obtained through the netbox
> 
> Needed for #2978
> ---
>  src/box/lua/net_box.lua   | 179 +++++++++++++++++++++++++++++++---------------
>  test/box/access.result    |  15 +++-
>  test/box/access.test.lua  |   9 ++-
>  test/box/net.box.result   |   6 +-
>  test/box/net.box.test.lua |   6 +-
>  5 files changed, 146 insertions(+), 69 deletions(-)
> 
> diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
> index 251ad40..8d42fb4 100644
> --- a/src/box/lua/net_box.lua
> +++ b/src/box/lua/net_box.lua
> @@ -25,7 +25,6 @@ local check_primary_index = box.internal.check_primary_index
>  
>  local communicate     = internal.communicate
>  local encode_auth     = internal.encode_auth
> -local encode_select   = internal.encode_select
>  local decode_greeting = internal.decode_greeting
>  
>  local TIMEOUT_INFINITY = 500 * 365 * 86400
> @@ -84,22 +83,70 @@ local function decode_push(raw_data)
>      return response[IPROTO_DATA_KEY][1], raw_end
>  end
>  
> +local function encode_call(send_buf, id, method_args)
> +    return internal.encode_call(send_buf, id, method_args.func_name,
> +                                method_args.args)
> +end
> +local function encode_call_16(send_buf, id, method_args)
> +    return internal.encode_call_16(send_buf, id, method_args.func_name,
> +                                   method_args.args)
> +end
> +local function encode_ping(send_buf, id, ...)
> +    return internal.encode_ping(send_buf, id, ...)
> +end
> +local function encode_eval(send_buf, id, method_args)
> +    return internal.encode_eval(send_buf, id, method_args.code,
> +                                method_args.args)
> +end
> +local function encode_insert(send_buf, id, method_args)
> +    return internal.encode_insert(send_buf, id, method_args.space_id,
> +                                  method_args.tuple)
> +end
> +local function encode_replace(send_buf, id, method_args)
> +    return internal.encode_replace(send_buf, id, method_args.space_id,
> +                                   method_args.tuple)
> +end
> +local function encode_delete(send_buf, id, method_args)
> +    return internal.encode_delete(send_buf, id, method_args.space_id,
> +                                  method_args.index_id, method_args.key)
> +end
> +local function encode_update(send_buf, id, method_args)
> +    return internal.encode_update(send_buf, id, method_args.space_id,
> +                                  method_args.index_id, method_args.key,
> +                                  method_args.oplist)
> +end
> +local function encode_upsert(send_buf, id, method_args)
> +    return internal.encode_upsert(send_buf, id, method_args.space_id,
> +                                  method_args.key, method_args.oplist)
> +end
> +local function encode_select(send_buf, id, method_args)
> +    return internal.encode_select(send_buf, id, method_args.space_id,
> +                                  method_args.index_id, method_args.iterator,
> +                                  method_args.offset, method_args.limit,
> +                                  method_args.key)
> +end
> +local function encode_execute(send_buf, id, method_args)
> +    return internal.encode_execute(send_buf, id, method_args.query,
> +                                   method_args.parameters, method_args.sql_opts)
> +end

Why not call it simply 'args'?

> @@ -1150,14 +1201,16 @@ end
>  -- @deprecated since 1.7.4
>  function remote_methods:eval_16(code, ...)
>      check_remote_arg(self, 'eval')
> -    return unpack((self:_request('eval', nil, code, {...})))
> +    local method_args = {code=code, args={...}}
> +    return unpack((self:_request('eval', nil, method_args)))
>  end
>  
>  function remote_methods:eval(code, args, opts)
>      check_remote_arg(self, 'eval')
>      check_eval_args(args)
>      args = args or {}
> -    local res = self:_request('eval', opts, code, args)
> +    local method_args = {code=code, args=args}

Coding style: we add a space before and after '=':

	local method_args = {code = code, args = args}

Please fix here and everywhere else.

Other than that this patch looks okay to me.

  reply	other threads:[~2019-06-11  8:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 10:02 [PATCH v1 0/2] netbox: define formats for tuple from netbox imeevma
2019-06-10 10:02 ` [PATCH v1 1/2] netbox: store method_encoder args in request imeevma
2019-06-11  8:15   ` Vladimir Davydov [this message]
2019-06-14 11:50     ` Mergen Imeev
2019-06-18  8:38       ` Vladimir Davydov
2019-06-10 10:02 ` [PATCH v1 2/2] netbox: define formats for tuple from netbox imeevma
2019-06-11  8:55   ` Vladimir Davydov
2019-06-14 12:29     ` Mergen Imeev
2019-06-18  8:55       ` Vladimir Davydov
2019-06-18  9:00       ` Vladimir Davydov
2019-06-11  8:55 ` [PATCH v1 0/2] " Vladimir Davydov
2019-06-14 12:32   ` Mergen Imeev

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=20190611081506.6b3jftczzd4kmhrl@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v1 1/2] netbox: store method_encoder args in request' \
    /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