Commit Graph

1065 Commits

Author SHA1 Message Date
Diego Reis
7a56c93b81 Makes clippy happy 2025-09-25 10:42:14 -03:00
Nikita Sivukhin
27a7f7faa7 fix clippy 2025-09-25 12:12:39 +04:00
Nikita Sivukhin
3c0b04b530 fix clippy 2025-09-25 12:08:10 +04:00
Nikita Sivukhin
a938bdcf09 fix exec to run over multiple statements in the string 2025-09-25 12:03:52 +04:00
Nikita Sivukhin
ddfa77997d adjust sync package napi-rs code 2025-09-25 10:54:50 +04:00
Nikita Sivukhin
f8d077c24b replace cell with mutex 2025-09-25 10:54:31 +04:00
Nikita Sivukhin
6fe5a0b61e add comments and small test adjustments 2025-09-25 10:52:18 +04:00
Nikita Sivukhin
d08bcb6a17 adjust sync package 2025-09-25 10:52:05 +04:00
Nikita Sivukhin
afbfa98a8d adjust sync native package 2025-09-24 18:43:50 +04:00
Nikita Sivukhin
28c9850b57 properly guard access to the private fields 2025-09-24 17:24:27 +04:00
Nikita Sivukhin
cd9cf71568 cleanup napi-rs bindings Rust code 2025-09-24 17:06:52 +04:00
Nikita Sivukhin
2ccd50ad69 add explicit async connect method to the database instance 2025-09-24 17:06:23 +04:00
Nikita Sivukhin
a5c2d5beb7 get rid of global module variable - otherwise there will be a race when both database-browser and sync-browser are used 2025-09-24 12:01:27 +04:00
Pekka Enberg
f72600431b Turso 0.2.0-pre.8 2025-09-24 09:08:34 +03:00
Nikita Sivukhin
1faafdb57e use wasm-runtime from NPM instead of patched sources 2025-09-23 12:28:16 +04:00
Pekka Enberg
f6e3beda45 Turso 0.2.0-pre.7 2025-09-22 20:44:08 +03:00
TcMits
17c91c1fe2 resolve conflicts 2025-09-22 16:03:52 +07:00
Pekka Enberg
26f90257a6 Turso 0.2.0-pre.6 2025-09-22 11:44:21 +03:00
Pekka Enberg
f4b0fb17f7 Turso 0.2.0-pre.5 2025-09-22 11:34:22 +03:00
Pekka Enberg
fbad158213 Turso 0.2.0-pre.4 2025-09-22 09:15:55 +03:00
Pekka Enberg
6280cfc59d Merge branch 'main' into sync-improvements 2025-09-22 07:35:39 +03:00
Pekka Enberg
54176d4548 Merge 'Add encryption throughput test' from Avinash Sajjanshetty
```
cargo run --release -- -b 100 -i 100000 --read-ratio 75

cargo run --release -- -b 100 -i 100000 --read-ratio 75 --encryption
```
```
Total time: 629.51s

Transaction throughput: 158.85 txns/sec
Operation throughput: 15885.37 ops/sec
  - Read operations: 7500165 (7500165 found, 0 not found)
  - Read throughput: 11914.29 reads/sec
  - Write operations: 2499835
  - Write throughput: 3971.08 writes/sec
```
vs
```
Total time: 665.05s

Transaction throughput: 150.36 txns/sec
Operation throughput: 15036.47 ops/sec
  - Read operations: 7500165 (7500165 found, 0 not found)
  - Read throughput: 11277.60 reads/sec
  - Write operations: 2499835
  - Write throughput: 3758.87 writes/sec
```

Closes #3230
2025-09-22 07:34:29 +03:00
Avinash Sajjanshetty
0597ea722a Add encryption throughput test 2025-09-20 21:56:58 +05:30
Nikita Sivukhin
c63c820bb7 add busy_timeout pragma 2025-09-19 16:48:12 +04:00
Nikita Sivukhin
c24e5219d2 remove log file 2025-09-19 14:24:42 +04:00
Nikita Sivukhin
cfc8728774 fix clippy 2025-09-19 14:15:04 +04:00
Nikita Sivukhin
7049f3ddae fix clock implementation for OPFS IO 2025-09-19 13:21:00 +04:00
Nikita Sivukhin
bc2dbe9025 fix bug 2025-09-19 13:21:00 +04:00
Nikita Sivukhin
1d3c823c7b wip 2025-09-19 13:19:30 +04:00
Nikita Sivukhin
66de28d84b wip 2025-09-19 13:19:30 +04:00
Nikita Sivukhin
e68b642f4f set longPollTimeoutMs from js bindings 2025-09-19 13:19:30 +04:00
Nikita Sivukhin
83303b8c5b properly guard access to the sync engine with locks 2025-09-19 13:19:30 +04:00
Nikita Sivukhin
acc536d542 use global opfs IO in the sync 2025-09-19 13:19:30 +04:00
Nikita Sivukhin
974feac27b move compute to the main thread for browser and node
- now, most of the work is happening on the main thread
- for database in browser, we still have dedicated WebWorker - but it is used only for OPFS access and only for that
- for syn in browser we still offload sync operations to the WebWorker
2025-09-19 13:19:30 +04:00
TcMits
96e4c5d241 fix issue 3144 2025-09-16 18:39:45 +07:00
pedrocarlo
3c91ae206b move as many dependencies as possible to workspace to avoid multiple versions of the same dependency 2025-09-15 17:19:36 -03:00
Pekka Enberg
244458199f Merge 'Various fixes to sync' from Nikita Sivukhin
This PR fixes incorrect path registration for sync in browser, add tests
and also expose revision string in the `stats()` method of synced
database

Closes #3124
2025-09-15 14:24:02 +03:00
Nikita Sivukhin
9b5656d4dc fix stats method 2025-09-15 11:05:49 +04:00
Nikita Sivukhin
23e8204bfc yarn build 2025-09-15 10:57:03 +04:00
Nikita Sivukhin
e8b076ebe5 export SyncEngineStats type 2025-09-15 10:56:44 +04:00
Nikita Sivukhin
527d0cb1f3 expose revision in the stats method 2025-09-15 10:56:13 +04:00
Nikita Sivukhin
ebf042cf6b refine error message 2025-09-15 10:55:43 +04:00
Nikita Sivukhin
aa65c910bf fix sync-browser bug and add more tests 2025-09-15 10:55:01 +04:00
pedrocarlo
3d265489dc modify semantics of busy_timeout to be more on par with sqlite 2025-09-15 02:20:32 -03:00
pedrocarlo
0586b75fbe expose function to set busy timeout duration 2025-09-15 02:20:32 -03:00
Pekka Enberg
5df05e05f8 Turso 0.2.0-pre.3 2025-09-12 18:40:06 +03:00
Nikita Sivukhin
99759b9efd fix wasm-runtime package.json 2025-09-12 19:28:30 +04:00
Pekka Enberg
2651b597c6 Turso 0.2.0-pre.2 2025-09-12 17:38:30 +03:00
Jussi Saurio
b5f3da100b Merge 'fix CI for apple builds' from Nikita Sivukhin
Intel MAC builds were removed in https://github.com/tursodatabase/turso/
commit/3547bd10931e030a372bedb4968404301c2936c6 but arm builds were
broken after that.
This PR returns back proper ARM builds for Apple

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3054
2025-09-12 16:19:05 +03:00
Jussi Saurio
6559f23f85 Merge 'hack imports of wasm due to the issues in Vite and Next.js build systems' from Nikita Sivukhin
This tries to establish smooth as possible experience for browser
packages in web.
In order to do that this PR do the following tricks:
1. export `./vite` entry-point which should be used like `import {
connect } from "@tursodatabase/database-browser/vite"` for Vite bundler
   * This entrypoint has fix for the issue
https://github.com/vitejs/vite/issues/8427 which breaks package in the
dev-server mode
   * In order to overcome this we do 2 tricks:
     - Inline WASM module in order to avoid loading it from the separate
file
     - Use same file as entry-point for main thread and for the web
worker
   * Note, that we do these tricks only for `development` build and
produce build will be chunked and optimized as usual with Vite and will
treat worker and WASM modules as separate fiels
3. export `./turbopack` entry-point which should be used like `import {
connect } from @tursodatabase/database-browser/turbopack"` for Turbopack
(Next.js) bundler
   * This entrypoint has fix for the issue
https://github.com/vercel/next.js/issues/82520'
   * In order to overcome this for now we always inline WASM for Next.js
4. Bundle browser libraries in order to easily consume them without need
for bundlers:
   * e.g. `import { connect } from
"https://unpkg.com/@tursodatabase/database-browser/bundle/main.es.js";`
5. We vendor `@napi-rs/wasm-runtime` for now in order to fix runtime
errors due to accesses to `process.env.NODE_DEBUG_NATIVE` env var (not
defined in web)
   * This should be very temporary solution because I already fixed
wasm-util dependency which cause this error
(https://github.com/toyobayashi/wasm-util/issues/4) and hope that napi-
rs PR will be merged soon: https://github.com/napi-rs/napi-rs/pull/2921

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3017
2025-09-12 16:18:47 +03:00