You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2022/12/12 23:33:22 UTC

[couchdb] 01/01: Let's try Lua for a change

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch luerl
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit b1083d1a0ab2f98be138fe074ccfd70a00845d31
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Mon Dec 12 18:30:17 2022 -0500

    Let's try Lua for a change
    
    So far can start a cluster `./dev/run ...` then in a remsh can test the sandbox feature:
    
    1) No reductions, use all the CPUs:
    
    ```
    f(), {R, _} = luerl_sandbox:run("a={}; for i=1,100 do a[i] = 5 end; return 'foo'", luerl_sandbox:init(), _Reductions = 10000), R.
    [<<"foo">>]
    ```
    
    2) Slow down, pardner!
    ```
     f(), luerl_sandbox:run("a={}; for i=1,100 do a[i] = 5 end; return 'foo'", luerl_sandbox:init(), _Reductions = 500).
    {error,{reductions,4000}}
    ```
---
 .gitignore                  | 1 +
 rebar.config.script         | 1 +
 rel/reltool.config          | 2 ++
 src/couch/src/couch.app.src | 1 +
 4 files changed, 5 insertions(+)

diff --git a/.gitignore b/.gitignore
index 816ece6d4..c468e00c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -73,6 +73,7 @@ src/unicode_util_compat/
 src/file_system/
 src/rebar3/
 src/erlfmt/
+src/luerl/
 tmp/
 
 src/couch/*.o
diff --git a/rebar.config.script b/rebar.config.script
index 3952ad857..4a5b247eb 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -151,6 +151,7 @@ DepDescs = [
 {fauxton,          {url, "https://github.com/apache/couchdb-fauxton"},
                    {tag, "v1.2.8"}, [raw]},
 %% Third party deps
+{luerl,            {url, "https://github.com/rvirding/luerl.git"}, {branch, "develop"}},
 {folsom,           "folsom",           {tag, "CouchDB-0.8.4"}},
 {hyper,            "hyper",            {tag, "CouchDB-2.2.0-7"}},
 {ibrowse,          "ibrowse",          {tag, "CouchDB-4.4.2-5"}},
diff --git a/rel/reltool.config b/rel/reltool.config
index ab26fb2ed..00ce8b063 100644
--- a/rel/reltool.config
+++ b/rel/reltool.config
@@ -25,6 +25,7 @@
         stdlib,
         syntax_tools,
         xmerl,
+        luerl,
         %% couchdb
         b64url,
         bear,
@@ -90,6 +91,7 @@
     {app, xmerl, [{incl_cond, include}]},
 
     %% couchdb
+    {app, luerl, [{incl_cond, include}]},
     {app, b64url, [{incl_cond, include}]},
     {app, bear, [{incl_cond, include}]},
     {app, chttpd, [{incl_cond, include}]},
diff --git a/src/couch/src/couch.app.src b/src/couch/src/couch.app.src
index 951cb1e37..38cbae674 100644
--- a/src/couch/src/couch.app.src
+++ b/src/couch/src/couch.app.src
@@ -37,6 +37,7 @@
         % Upstream deps
         ibrowse,
         mochiweb,
+        luerl,
 
         % ASF deps
         couch_epi,