Commit Graph

95 Commits

Author SHA1 Message Date
김선우
370e1ca5c2 Add support Java bindings
This add support for Java bindings in the bindings/java directory.
2025-01-05 10:28:05 +02:00
Pekka Enberg
c4b0eb398c Limbo 0.0.11 2024-12-31 10:43:24 +02:00
JeanArhancet
9a70dc8f78 fix: clippy error 2024-12-30 10:22:36 +01:00
JeanArhancet
2a0402ce7f fix: python lint 2024-12-30 10:21:11 +01:00
JeanArhancet
cb69d8b0dd feat(python): add in-memory mode 2024-12-30 10:21:11 +01:00
PThorpe92
f6cd707544 Add clippy CI, fix or ignore warnings where appropriate 2024-12-29 10:25:41 -05:00
adamnemecek
97647ff056 Clean up code to use Self
Closes #556
2024-12-29 10:07:38 +02:00
Pekka Enberg
f2ecebc357 Rename RowResult to StepResult
The name "row result" is confusing because it really *is* a result from
a step() call. The only difference is how a row is represented as we
return from VDBE or from a statement.

Therefore, rename RowResult to StepResult.
2024-12-27 10:20:41 +02:00
Pere Diaz Bou
aed14117c9 core: transaction support 2024-12-24 18:04:30 +01:00
amuldotexe
b7b22f303f ran cargofmt 2024-12-20 20:36:35 +05:30
amuldotexe
f912771ae6 gracefully handling errors for issue https://github.com/tursodatabase/limbo/issues/494 , changes made 5 places where todo macros were replaced with relevant errors 2024-12-20 20:32:03 +05:30
jussisaurio
acdfe2be0c Merge 'cleanup: replace &(*x) with x.as_ref() for smart pointer derefs' from Ziyak Jehangir
The only instances of the &(*x) dereferencing pattern in the codebase,
is used with Completion smart pointers. Changed it to use as_ref(). No
functional changes.

Closes #516
2024-12-19 17:43:59 +02:00
Pekka Enberg
91a5994eac Merge 'Fix Python binding packaging' from Gökmen Görgen
Somehow the `make` command does not work because of the name
mismatching. This PR will fix only this issue.
For reproducing the issue:
```
$ make

Checking requirements files...
mkdir -p .tmp
pip-compile pyproject.toml --quiet             --output-file=.tmp/requirements.txt
pip-compile pyproject.toml --quiet --extra=dev --output-file=.tmp/requirements-dev.txt
diff -u requirements.txt     .tmp/requirements.txt     || (echo "requirements.txt doesn't match pyproject.toml"     && exit 1)
--- requirements.txt    2024-12-17 02:19:29.887227723 +0000
+++ .tmp/requirements.txt       2024-12-17 02:19:38.046065295 +0000
@@ -1,2 +1,2 @@
 typing-extensions==4.12.2
-    # via limbo (pyproject.toml)
+    # via pylimbo (pyproject.toml)
requirements.txt doesn't match pyproject.toml
make: *** [Makefile:28: check-requirements] Error 1
```
## Another issue...
`maturin` is still not in requirements dev list. Shall we continue to
install it manually or add it to dev list?

Closes #495
2024-12-19 17:13:52 +02:00
Ziyak Jehangir
99d1b0e5a3 cleanup: replace &(*x) with x.as_ref() for smart pointer derefs 2024-12-19 19:36:04 +05:30
Pekka Enberg
e93ac38e55 Add statement interruption support
This adds an interrupt() method to Statement that allows apps to
interrupt a running statement. Please note that this is different from
`sqlite3_interrupt()` which interrupts all ongoing operations in a
database. Although we want to support that too, per statement interrupt
is much more useful to apps.
2024-12-19 12:30:32 +02:00
Gökmen Görgen
682f014817 add maturin as dev dependency. 2024-12-18 21:14:58 +00:00
Pekka Enberg
69e3dd28f7 Limbo 0.0.10 2024-12-18 20:45:55 +02:00
Gökmen Görgen
3252ab542b fix project name in txt files. 2024-12-17 01:33:54 +00:00
Pekka Enberg
7943fa1e35 bindings/wasm: Add API reference document
The aim is towards libSQL/better-sqlite3 compatibility. Lift the API
reference document from libsql-js.git and update it accordingly to what
`limbo-wasm` supports.
2024-12-16 18:45:18 +02:00
Pere Diaz Bou
39a75147d4 Page cache by page_number and frame_number
Since page cache is now shared by default, we need to cache pages by
page number and something else. I chose to go with max_frame of
connection, because this connection will have a max_frame set until from
the start of a transaction until the end of it.

With key pairs of (pgno, max_frame) we make sure each connection is
caching based on the snapshot it is at as two different connections
might have the same pageno being using but a different frame. If both
have same max_frame then they will share same page.
2024-12-13 21:57:27 +01:00
Pere Diaz Bou
3fda2d09b9 Extract multi threaded part from WalFile to WalFileShared
Since we expect to ensure thread safety between multiple threads in the
future, we extract what is important to be shared between multiple
connections with regards to WAL.

This is WIP so I just put whatever feels like important behind a RwLock
but expect this to change to Atomics in the future as needed. Maybe even
these locks might disappear because they will be better served with
transaction locks.
2024-12-13 13:09:13 +01:00
Pere Diaz Bou
a4297702bd extract page cache to be multi threaded 2024-12-13 13:09:13 +01:00
Pekka Enberg
3023d228c7 Limbo 0.0.9 2024-12-12 18:49:05 +02:00
Pekka Enberg
36f9565910 Merge 'feat(wasm): add get and iterate func' from Jean Arhancet
Add `get` and `iterate` functions to the wasm module

Closes #421
2024-12-09 17:28:43 +02:00
JeanArhancet
5693cd1ae0 feat(wasm): add get and iterate func 2024-11-29 21:48:20 +01:00
Lauri Virtanen
a7100d8e9b Autofix clippy issues with cargo fix --clippy 2024-11-24 20:24:47 +02:00
Pekka Enberg
e1b2d043be Limbo 0.0.8 2024-11-20 19:16:11 +02:00
Pekka Enberg
229e62704b bindings/python: Add Python example 2024-11-20 19:10:02 +02:00
Pekka Enberg
a18f33f93b bindings/wasm: Add example using Drizzle ORM 2024-11-20 18:20:39 +02:00
Pekka Enberg
81b68b7047 Limbo 0.0.7 2024-11-20 18:15:36 +02:00
Pekka Enberg
20340038a5 bindings/wasm: Add integration tests 2024-11-20 11:54:34 +02:00
Pekka Enberg
bfce49c7eb bindings/wasm: Fix conversion to JsValue 2024-11-20 11:54:34 +02:00
Pekka Enberg
b65d0a72ba bindings/wasm: Implement Statement.raw() 2024-11-20 11:47:28 +02:00
Pekka Enberg
0fb1e59c9a Limbo 0.0.6 2024-11-18 19:16:15 +02:00
Pekka Enberg
e818bdb3ef Merge 'open file in append mode' from Pere Diaz Bou
Closes #409
2024-11-18 19:15:05 +02:00
Pere Diaz Bou
2cc89f712e open file in append mode 2024-11-18 18:06:01 +01:00
Pekka Enberg
a83e62f6f4 Limbo 0.0.5 2024-11-18 14:57:00 +02:00
Pekka Enberg
8efeb16b82 Merge 'bindings/wasm: "SELECT 1" benchmark' from Pekka Enberg
This adds a benchmark for "SELECT 1" that essentially just evaluates the
overhead of calling into the library. Looks like WebAssembly adds 2.5x
overhead compared to native code...
```
penberg@vonneumann perf % node perf-limbo.js
cpu: Apple M1
runtime: node v18.19.0 (arm64-darwin)

benchmark      time (avg)             (min … max)       p75       p99      p999
------------------------------------------------- -----------------------------
• Statement
------------------------------------------------- -----------------------------
SELECT 1      771 ns/iter     (624 ns … 2'183 µs)    750 ns  1'085 ns  1'750 ns

summary for Statement
  SELECT 1
penberg@vonneumann perf % node perf-better-sqlite3.js
cpu: Apple M1
runtime: node v18.19.0 (arm64-darwin)

benchmark      time (avg)             (min … max)       p75       p99      p999
------------------------------------------------- -----------------------------
• Statement
------------------------------------------------- -----------------------------
SELECT 1      302 ns/iter       (166 ns … 779 µs)    292 ns    375 ns  1'000 ns

summary for Statement
  SELECT 1
```

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #394
2024-11-16 19:00:39 +02:00
Pekka Enberg
60cc8c0347 bindings/wasm: "SELECT 1" benchmark
This adds a benchmark for "SELECT 1" that essentially just evaluates the
overhead of calling into the library. Looks like WebAssembly adds 2.5x
overhead compared to native code...

```
penberg@vonneumann perf % node perf-limbo.js
cpu: Apple M1
runtime: node v18.19.0 (arm64-darwin)

benchmark      time (avg)             (min … max)       p75       p99      p999
------------------------------------------------- -----------------------------
• Statement
------------------------------------------------- -----------------------------
SELECT 1      771 ns/iter     (624 ns … 2'183 µs)    750 ns  1'085 ns  1'750 ns

summary for Statement
  SELECT 1
penberg@vonneumann perf % node perf-better-sqlite3.js
cpu: Apple M1
runtime: node v18.19.0 (arm64-darwin)

benchmark      time (avg)             (min … max)       p75       p99      p999
------------------------------------------------- -----------------------------
• Statement
------------------------------------------------- -----------------------------
SELECT 1      302 ns/iter       (166 ns … 779 µs)    292 ns    375 ns  1'000 ns

summary for Statement
  SELECT 1
```
2024-11-16 13:10:23 +02:00
Pekka Enberg
82ec900b07 bindings/wasm: Fix VFS.sync() function signature
We don't expect any return value from the underlying `fsync()` so fix
the function signature accordingly.

Fixes the following obscure error:

```
TypeError: Cannot convert undefined to a BigInt
    at wasm://wasm/00942492:wasm-function[1501]:0x1c4dc1
    at wasm://wasm/00942492:wasm-function[694]:0x189586
    at wasm://wasm/00942492:wasm-function[50]:0x143d7
    at wasm://wasm/00942492:wasm-function[60]:0x3f91a
    at new Database (/Users/penberg/src/penberg/limbo/bindings/wasm/pkg/limbo_wasm.js:162:26)
    at file:///Users/penberg/src/penberg/limbo/bindings/wasm/perf/perf-limbo.js:5:12
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
    at async loadESM (node:internal/process/esm_loader:34:7)
    at async handleMainPromise (node:internal/modules/run_main:106:12)
```
2024-11-16 13:07:32 +02:00
Pekka Enberg
851ea65530 Bump PyO3 dependency
Github's bot reports a use-after-free issue so let's bump up the
version:

https://github.com/penberg/limbo/security/dependabot/4
2024-11-15 16:14:34 +02:00
Pere Diaz Bou
6cd0f03643 core: create databases from limbo 2024-11-15 12:09:07 +01:00
Pere Diaz Bou
87c80b2a07 use core wal file for wasm 2024-11-14 17:54:20 +01:00
Pere Diaz Bou
71ac1eacb7 Merge 'btree: cursor with lineal stack structure' from Pere Diaz Bou
Removed MemPage from the code in favor of an array to encode the stack
of the cursor. This is both simpler and better in terms of memory
access.
O_DIRECT was removed from WAL file as it introduces alignment
constraints that are too hard to follow in regular appends. Maybe in the
future?

Closes #378
2024-11-13 18:23:31 +01:00
Pere Diaz Bou
e2276c2e9d O_DIRECT disable on WAL 2024-11-13 13:45:42 +00:00
Pekka Enberg
b7ca2c9823 bindings/wasm: Add Database.prepare() and Statement.all()
This adds `Database.prepare()` and `Statement.all()` APIs to the Wasm
bindings so that you can actually get something useful out of the
library.
2024-11-13 12:22:35 +02:00
Pekka Enberg
40f517b03f Fix Wasm packaging
The `wasm-pack` too has a known bug where it forgets to add snippets to
`package.json`:

https://github.com/rustwasm/wasm-pack/issues/1206

Let's fix that with some bash magic.
2024-11-13 11:28:22 +02:00
Pere Diaz Bou
19f1a00ca4 bindings/python: update bindings requirements-dev 2024-11-12 17:09:41 +01:00
Pere Diaz Bou
ce8378793e btree: run until finished or IO + bug fixes 2024-11-11 17:03:15 +01:00
Pere Diaz Bou
ce1367b76a move wal creation 2024-11-07 13:51:02 +01:00