From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id DFE7D7030E; Mon, 25 Jan 2021 23:35:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DFE7D7030E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1611606954; bh=CEIgJROgTqkpEKaVpgIUCZF3D6G7DmAMBz/sJcsc2TU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=eMA56DqwnjZfj5VgNyXQ5b059iJW/P9bi1anJJQTH38bwXxtlLzWsR8E6CFX/Y3uF RD+D6YeCgNx09bYRBeNQX58WxXZAZ5Mq/lS/J8+yzhEAujk9dXwjq9xph6bqrMhmwt qwAjdxrKsrIrwYAmdboJuwLmD0U5zUBHC6us1XIQ= Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 231387030E for ; Mon, 25 Jan 2021 23:35:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 231387030E Received: by mail-lf1-f43.google.com with SMTP id v24so19750045lfr.7 for ; Mon, 25 Jan 2021 12:35:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=BwHVx3plMqFfXKJLkOhtS6DDtYRVci8FtYcZavb65WM=; b=YbbThvHA/aEf/4dZ6B15ogdkXm2th/V4ePbdQrYvUkBpDJd1BLhZCVeBT777Ud96yf gW+satGYQ6U3M8PUh47geCgOlcw1kW7VrUZk4b7/TfdfRPr/5HN3/2YlJGnAa4BP4Saz V1zrlV83ear/X9qzuaofiB9EEUXGnC25VCmeYO5c1CQxQBl15phz+Tf2iFqgHey9ywx/ pOLDWTCRgGfDU3/vadNa1L8VwkR3w9hbc2CMGYQpxDy3pkXdnwnoptGRvbGJPK7HSNIj BA41TnoHN3HIUvee4RfcHo+QclCRkKMUr1WG5WEsvQQfNAYZc4zgGCt1Umi96MGuAD62 aaWQ== X-Gm-Message-State: AOAM531lgjrZFovmPvVnrARMuL+AKzMzxx8rdRP9PdwKq7nxgCwHN3lb fdVq7B+MeW4N5Qy3OzZdHH4= X-Google-Smtp-Source: ABdhPJy72x2ahk59t5Ia+lKkZ2f1x1//B9pVQfUacRXvxgIOKYxbJl47VdXDIBs8bo3VD8YjN2Grqw== X-Received: by 2002:a19:8110:: with SMTP id c16mr1024363lfd.150.1611606952623; Mon, 25 Jan 2021 12:35:52 -0800 (PST) Received: from grain.localdomain ([5.18.91.94]) by smtp.gmail.com with ESMTPSA id j8sm818784lfm.79.2021.01.25.12.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 12:35:51 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id 304BA560113; Mon, 25 Jan 2021 23:35:50 +0300 (MSK) Date: Mon, 25 Jan 2021 23:35:50 +0300 To: TML Message-ID: <20210125203550.GH2174@grain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.14.6 (2020-07-11) Subject: [Tarantool-patches] [RFC] cmod user api X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: Mons Anderson , Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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