Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>,
	tml <tarantool-patches@dev.tarantool.org>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v4 0/6] box/func: implement cfunc Lua module
Date: Sat, 3 Oct 2020 15:55:23 +0200	[thread overview]
Message-ID: <de1971ce-b290-1e23-ff30-d21de85a125d@tarantool.org> (raw)
In-Reply-To: <20201001135113.329664-1-gorcunov@gmail.com>

Hi! Thanks for the patchset!

On 01.10.2020 15:51, Cyrill Gorcunov wrote:
> The cfunc module provide a way to execute C stored procedures
> on read only nodes without registring them in `_func` system space.
> 
> The series implements a bare minimum. There was a request to make
> cfunc been Lua object with appropriate methods. If this is really
> preferred then I'll implement this wrapping Lua code on top. I mean
> that currently all operations are done via
> 
>  > require('cfunc').[create|drop|call|reload]
> 
> interface while there was a proposal to operate as
> 
>  > a = require('cfunc').create
>  > a:call(args)

No, the proposal was rather

	cfunc = require('cfunc')
	f = cfunc.load('test_box_c_function')
	f(1, 2, 3)

Sorry I didn't describe it properly anywhere. But it is easy to fix
anyway.

In Lua you can define __call and make an object look exactly
like a function. That is the idea behind making it possible to
use Lua and C functions in the same way.

	if load_c then
		f = cfunc.load('test_box_c_function')
	else
		f = function(a, b, c) return a + b + c end
	end
	f(1, 2, 3) -- Works and looks the same for C and Lua.

With this way even IPROTO_CALL should work on such functions, if the
function object is global and the user has access to executing everything
here.

  parent reply	other threads:[~2020-10-03 13:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 13:51 Cyrill Gorcunov
2020-10-01 13:51 ` [Tarantool-patches] [PATCH v4 1/6] box/func: factor out c function entry structure Cyrill Gorcunov
2020-10-01 13:51 ` [Tarantool-patches] [PATCH v4 2/6] box/func: provide module_sym_call Cyrill Gorcunov
2020-10-01 13:51 ` [Tarantool-patches] [PATCH v4 3/6] box/func: more detailed error in module reloading Cyrill Gorcunov
2020-10-01 13:51 ` [Tarantool-patches] [PATCH v4 4/6] box/func: export func_split_name helper Cyrill Gorcunov
2020-10-01 13:51 ` [Tarantool-patches] [PATCH v4 5/6] box/func: implement cfunc Lua module Cyrill Gorcunov
2020-10-03 13:55   ` Vladislav Shpilevoy
2020-10-05 10:31     ` Cyrill Gorcunov
2020-10-05 21:59       ` Vladislav Shpilevoy
2020-10-06 12:55         ` Cyrill Gorcunov
2020-10-01 13:51 ` [Tarantool-patches] [PATCH v4 6/6] test: box/cfunc -- add simple module test Cyrill Gorcunov
2020-10-03 13:55   ` Vladislav Shpilevoy
2020-10-03 13:55 ` Vladislav Shpilevoy [this message]
2020-10-05 11:51   ` [Tarantool-patches] [PATCH v4 0/6] box/func: implement cfunc Lua module Cyrill Gorcunov
2020-10-05 21:59     ` Vladislav Shpilevoy

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=de1971ce-b290-1e23-ff30-d21de85a125d@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v4 0/6] box/func: implement cfunc Lua module' \
    /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