wormhole Storage Engine

What's the deal ? The wormhole SE is a lua-based storage engine. The data is "stored" in a script-language. ... Ok, this explaination doesn't help very much. Let's take a look at an example:

The CREATE TABLE for a wormhole table is pretty simple. No magic:

root@127.0.0.1:test> show create table t1\G
CREATE TABLE `t1` (
  `id` int(11) DEFAULT NULL
) ENGINE=WORMHOLE DEFAULT CHARSET=latin1

You can select from it as usual:

root@127.0.0.1:test> select * from t1;
+------+
| id   |
+------+
|    5 | 
|    7 | 
|    3 | 
|   92 | 
+------+
4 rows in set (0.13 sec)

root@127.0.0.1:test> select * from t1;
+------+
| id   |
+------+
|    5 | 
|    7 | 
|    3 | 
|   20 | 
+------+
4 rows in set (0.11 sec)

But hey, we never wrote to it, but the data is changing. Let's take a look at the storage:

$ cd test/
$ cat t1.lua
return { { 5 }, { 7 }, { 3 }, { math.random(1, 100)} }

A lua-script, the last field is generated at run-time. Now that this works, what is it good for ?

Coming up

For me this is more an experiment on how to write a storage engine. So, we will see some more stuff getting implemented other than just table-scans. Next is table-discovery to generate the .frm at runtime from the lua-script.