Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: TML <tarantool-patches@dev.tarantool.org>
Cc: Mons Anderson <v.perepelitsa@corp.mail.ru>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [Tarantool-patches] [RFC] cmod user api
Date: Mon, 25 Jan 2021 23:35:50 +0300	[thread overview]
Message-ID: <20210125203550.GH2174@grain> (raw)

Hi guys! Recently I've sent a series which implements that
named "cmod" module which allows to load and run stored C
procedures similar to 'box.func' except they allows to run
such functions even on nodes in read-only mode.

The overall picture of api was not clear from changelog and
here I provide a short description to gather comments.

Entry point of any function comes from "module" instance.
To load a module one have to

    module = require('cmod').load('path-to-module')

Note the path to the module should be shipped without .so
extension (or dylib for macos). I suspect we should support
both variants with and without file extension.

Once module is loaded we can associate a function from
this module with some Lua variable.

    foo = module:load('name-of-function')

Then we can execute it

    res = foo(arguments, ...)

Both function and module supports explicit unloading via
unload method.

    foo:unload()
    module:unload()

When function/module is unloaded any attempt to use this
variable will produce an error. If they are not explicitly
unloaded then GC will reap them.

Module Lua object provides :reload() method which re-reads
the shared library and updates associated functions such than
any new call will be executed via new code. If there are some
already executing functions which are in yield state then such
functions gonna finish execution of old code first and only
next calls will be pacing the new code.

Does such api looks sane or there some other ideas?

	Cyrill

             reply	other threads:[~2021-01-25 20:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 20:35 Cyrill Gorcunov via Tarantool-patches [this message]
2021-01-25 21:08 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-25 21:56   ` Cyrill Gorcunov via Tarantool-patches

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=20210125203550.GH2174@grain \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.perepelitsa@corp.mail.ru \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [RFC] cmod user api' \
    /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