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 D35DF645E6; Mon, 18 Jan 2021 23:36:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D35DF645E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1611002163; bh=Mo9PVZRleXl0wF2CIRbYjYxyUaFkNxACp+NHkOKpLOc=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Lccl62XfuHgfo3tRoddTv3zFzZAtb5TcII04MhuCICJlNz3Aj7rqhZpaMZxqgE84W tDuEaVXq0ShWGKy0Mew8RbfJSxzG/AH/KPTZ1J7sKtRyvtPUBDeYBWss9TLwn2hSoS a19e1Po+zeNbs0uWjiqR5ndjNPHqnoc35a1MpHWw= Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 804D4645E6 for ; Mon, 18 Jan 2021 23:36:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 804D4645E6 Received: by mail-lj1-f171.google.com with SMTP id p13so19621499ljg.2 for ; Mon, 18 Jan 2021 12:36:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sPgUGOQ8CnsTr4r6UuK54hmvJa/6mRaM9j5v66PrKhU=; b=cVvnCBuFXNQWbIgYYeD1ds4T8gebBtQLCDTCofeUhDw7K9gknwQRVgT+qEhhlbA0OQ 5Tw1KB0jSplDtmk/knpoBA+P+dMIgd9oKzS04csORrBaENp6j/cJUl5v+QAl3D3qxERW NJxlfv/Am86oSPGdTJHteTOVIjfw+kd9f2/DHmNzMrvkNlgHxJgqtuwrgPpQijOWsHb8 PnB6+yP/uoOZXWFoBauxXxdYnfvjBgWGp/YN/ywqgAywLhyMiZ6CpEg/r6y7ofY6n5Pg ZFGny2ncepI8Pjx2vYHYFxnoubP0bXkW+hocM9Z7druvCta6TfpeR8IqrO5CiVI6+Ygw TNAw== X-Gm-Message-State: AOAM531i/lnKMa7n7se3hpDrPY8e6kikEzsShVS3sQGysyCRSU2t8b9M bbRLmdKgiAUJQB9AJ5uZc+ZUgEC3gX4= X-Google-Smtp-Source: ABdhPJwRXGZFqjFAwyAmcn2FKf5VpYFfwb3NWwTGKOiQ0e3BRD8fGNSigxmx1TZijD5LCAZrZBnh2w== X-Received: by 2002:a2e:b610:: with SMTP id r16mr561620ljn.470.1611002161275; Mon, 18 Jan 2021 12:36:01 -0800 (PST) Received: from grain.localdomain ([5.18.91.94]) by smtp.gmail.com with ESMTPSA id f3sm1771014ljn.129.2021.01.18.12.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jan 2021 12:36:00 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id 5C433560088; Mon, 18 Jan 2021 23:35:59 +0300 (MSK) To: tml Date: Mon, 18 Jan 2021 23:35:48 +0300 Message-Id: <20210118203556.281700-1-gorcunov@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v12 0/8] box: implement cmod Lua module 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: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" The cmod module provide a way to execute C stored procedures on read only nodes without registering them in `_func` system space. The series implements a bare minimum. Vlad, please take a look once time permit. v1-v3 are development ones and not sent. v5 (by vlad): - drop exists, list methods: they are redundant - rename cfunc to cbox - when create a function make it callable Lua object - initialize cbox out of modules - fix error in passing module name for reloading - make api been cbox.func.[create|drop] and cbox.module.reload - fix test for OSX sake v6 (by vlad): - move module handling into module_cache file. v7: - development v8: - use rbtree for function instance storage, since i don't like the idea of unexpected rehashing of values in case of massive number of functions allocated - use reference counter and free function instance if only load/unload are coupled - keep a pointer to the function inside Lua object so we don't need to lookup on every function call. this force us to implement __gc method - use new API and update docs v9: - development v10: - use hashes for function names lookup - simply function loads counting - use luaL_register_module and luaL_register_type for easier methods registering - carry functions as userdata object v11: - development v12: - switch to new API as been discussed in https://lists.tarantool.org/tarantool-patches/e186c454-6765-4776-6433-f3f791ff4c27@tarantool.org/ branch gorcunov/gh-4642-func-ro-12 issue https://github.com/tarantool/tarantool/issues/4642 Cyrill Gorcunov (8): box/func: factor out c function entry structure module_cache: move module handling into own subsystem module_cache: improve naming module_cache: direct update a cache value on reload module_cache: rename calls to ref in module structure module_cache: provide helpers to load and unload modules box/cmod: implement cmod Lua module test: box/cfunc -- add cmod test src/box/CMakeLists.txt | 2 + src/box/func.c | 491 +-------------------------- src/box/func.h | 41 +-- src/box/func_def.h | 14 - src/box/lua/cmod.c | 718 ++++++++++++++++++++++++++++++++++++++++ src/box/lua/cmod.h | 24 ++ src/box/lua/init.c | 2 + src/box/module_cache.c | 557 +++++++++++++++++++++++++++++++ src/box/module_cache.h | 158 +++++++++ test/box/CMakeLists.txt | 2 + test/box/cfunc1.c | 58 ++++ test/box/cfunc2.c | 132 ++++++++ test/box/cmod.result | 199 +++++++++++ test/box/cmod.test.lua | 70 ++++ test/box/suite.ini | 2 +- 15 files changed, 1933 insertions(+), 537 deletions(-) create mode 100644 src/box/lua/cmod.c create mode 100644 src/box/lua/cmod.h create mode 100644 src/box/module_cache.c create mode 100644 src/box/module_cache.h create mode 100644 test/box/cfunc1.c create mode 100644 test/box/cfunc2.c create mode 100644 test/box/cmod.result create mode 100644 test/box/cmod.test.lua base-commit: d712f83c105d107bac2491703fef5e154f54f55d -- 2.29.2