beagle-turso 0.1.2-aarch64-linux → 0.2.0-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +74 -1
- data/lib/beagle/turso/errors.rb +19 -0
- data/lib/beagle/turso/version.rb +1 -1
- data/lib/beagle/turso.rb +1 -0
- data/lib/beagle_turso/3.3/beagle_turso.so +2 -2
- data/lib/beagle_turso/3.4/beagle_turso.so +2 -2
- data/lib/beagle_turso/4.0/beagle_turso.so +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74f1d9beadf880cf80dc6f87f86fca245cbb9fb079948a02bd06fd7678655d08
|
|
4
|
+
data.tar.gz: 4bfdf6b3a4df383494f4deeb2df0acbfbf1f72053e8fe5ca72ec3cf4a6daab31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e02e2aeaa8b306412f3f0a3b9ac6513906268bd5832cccf64a0e607e7615329f41cad314e9e8f3de611b4e194cd06a8a5895a3291d8c8b83fd4136bb94f9222c
|
|
7
|
+
data.tar.gz: ee9b8f7141a2aa0519c499bf220c560460565ac16a1de9c126ec6e64972a21eb957a9836750fae54cff520725a1fa51b54131366138bd3ff00698549987b3912
|
data/README.md
CHANGED
|
@@ -68,7 +68,8 @@ db.pull # pull remote changes down to the local file (returns true/false)
|
|
|
68
68
|
`Database.open` also accepts `bootstrap_if_empty:` (defaults to `true`),
|
|
69
69
|
which pulls all remote data down on first open if the local file is new/empty.
|
|
70
70
|
Calling `push`/`pull` on a database opened via `open_local` (or via `open`
|
|
71
|
-
without both `remote_url:` and `auth_token:`) raises
|
|
71
|
+
without both `remote_url:` and `auth_token:`) raises
|
|
72
|
+
`Beagle::Turso::NotSyncedError`.
|
|
72
73
|
|
|
73
74
|
### Durability note: writes commit on-sync, not synchronously
|
|
74
75
|
|
|
@@ -79,6 +80,78 @@ called; `push` is not called automatically after every write. Until a
|
|
|
79
80
|
`push` succeeds, a write that's durable locally is not yet visible to other
|
|
80
81
|
replicas of the same remote database.
|
|
81
82
|
|
|
83
|
+
## Which Turso database?
|
|
84
|
+
|
|
85
|
+
Point a synced database at a Turso database **dedicated to this engine** —
|
|
86
|
+
ideally a fresh, empty one. On first open of an empty local replica,
|
|
87
|
+
`bootstrap_if_empty` pulls the remote down; against a fresh remote that's a
|
|
88
|
+
clean start, and the engine then manages its own state in that database (it
|
|
89
|
+
creates `turso_cdc`, `__turso_internal_*`, and `turso_sync_last_change_id`
|
|
90
|
+
tables and takes an **exclusive lock** on the local replica file — only one
|
|
91
|
+
OS process may hold a given replica open at a time).
|
|
92
|
+
|
|
93
|
+
Two things to avoid:
|
|
94
|
+
|
|
95
|
+
- **Don't co-host a synced database with the legacy libSQL/Hrana driver.**
|
|
96
|
+
This engine (Turso's newer Rust core) and the classic libSQL client have
|
|
97
|
+
different write/sync models; running both against the same remote database
|
|
98
|
+
at once risks corrupting its sync state. Give this engine its own database.
|
|
99
|
+
- **Migrating an existing, populated libSQL database into the synced engine
|
|
100
|
+
is not validated.** A fresh database is the supported, tested path. If you
|
|
101
|
+
must adopt existing data, treat it as unproven — test push/pull round-trips
|
|
102
|
+
before relying on it.
|
|
103
|
+
|
|
104
|
+
A single remote database, dedicated to this engine and written by one process
|
|
105
|
+
at a time, is the model it's built for.
|
|
106
|
+
|
|
107
|
+
## Errors
|
|
108
|
+
|
|
109
|
+
Every error the driver raises is a `Beagle::Turso::Error`, a `RuntimeError`
|
|
110
|
+
subclass: `OpenError`, `ConnectError`, `QueryError`, `SyncError`,
|
|
111
|
+
`NotSyncedError` (push/pull on a local-only database), `BusyError` (another
|
|
112
|
+
session or process holds the database), `ClosedError` and `ForkedError`. An
|
|
113
|
+
unsupported bind parameter type raises Ruby's `TypeError`. Auth, network and
|
|
114
|
+
protocol failures during sync all arrive as `SyncError` (or `OpenError` at
|
|
115
|
+
open): the engine does not distinguish them. Messages never contain the auth
|
|
116
|
+
token.
|
|
117
|
+
|
|
118
|
+
Busy conditions now raise `BusyError` with a message beginning
|
|
119
|
+
`database is busy:` (0.1.x said `query failed:` / `sync failed:`); it is
|
|
120
|
+
still a `RuntimeError`. A replica file already held by another process raises
|
|
121
|
+
`OpenError` ("... File is locked by another process").
|
|
122
|
+
|
|
123
|
+
## Threads, fibers and fork
|
|
124
|
+
|
|
125
|
+
- One `Database` may be shared by threads. Give each thread its own
|
|
126
|
+
`Connection`; a shared `Connection` works but serializes its callers.
|
|
127
|
+
- `open`, `connect`, `push` and `pull` release the GVL, so other threads keep
|
|
128
|
+
running while they wait on the network. Queries keep it; they are local and
|
|
129
|
+
fast.
|
|
130
|
+
- While one thread pushes, `closed?` returns immediately on other threads, and
|
|
131
|
+
queries on other connections proceed.
|
|
132
|
+
- On a synced database, `connect` called while another thread is pushing waits
|
|
133
|
+
inside the engine until the push finishes (about the push's duration); the
|
|
134
|
+
GVL is released while it waits, so other threads and fibers keep running.
|
|
135
|
+
Open connections up front (e.g. at boot / pool warm-up) rather than per
|
|
136
|
+
request.
|
|
137
|
+
- `close` during an in-flight `push` is safe: the push finishes or raises, and
|
|
138
|
+
later calls raise `ClosedError`.
|
|
139
|
+
- A blocked native call cannot be interrupted: `Timeout` and `Thread#kill`
|
|
140
|
+
take effect when it returns.
|
|
141
|
+
- **Falcon / Async:** on Ruby 4.0+ with `async` 2.25+ (enable its worker pool
|
|
142
|
+
with `ASYNC_SCHEDULER_WORKER_POOL=true` or
|
|
143
|
+
`Async::Scheduler.new(worker_pool: true)`), a fiber scheduler runs these
|
|
144
|
+
calls on a worker thread, so the reactor keeps serving other requests during
|
|
145
|
+
a sync. On Ruby 3.3/3.4 the GVL is still released, but the scheduler's own
|
|
146
|
+
thread blocks. Run sync from a dedicated thread there. Run one Falcon
|
|
147
|
+
process per replica (`--count 1`): the replica file is locked to one
|
|
148
|
+
process.
|
|
149
|
+
- **Fork:** handles are bound to the process that opened them. In a forked
|
|
150
|
+
child, `open`, `connect`, `push`, `pull` and queries on an inherited handle
|
|
151
|
+
raise `ForkedError`; open a new database there. `close` is a no-op and
|
|
152
|
+
`closed?` is safe (it reports the handle as closed if it can't be inspected),
|
|
153
|
+
so inherited handles need no cleanup in the child.
|
|
154
|
+
|
|
82
155
|
## Credential safety
|
|
83
156
|
|
|
84
157
|
`auth_token` is never included in `inspect` output or in error messages —
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Beagle
|
|
2
|
+
module Turso
|
|
3
|
+
# Base class for every error the native driver raises. A RuntimeError so
|
|
4
|
+
# code written against 0.1.x, which raised bare RuntimeErrors, still rescues.
|
|
5
|
+
class Error < RuntimeError; end
|
|
6
|
+
|
|
7
|
+
class OpenError < Error; end
|
|
8
|
+
class ConnectError < Error; end
|
|
9
|
+
class QueryError < Error; end
|
|
10
|
+
class SyncError < Error; end
|
|
11
|
+
# push/pull on a database opened without remote_url:/auth_token:.
|
|
12
|
+
class NotSyncedError < Error; end
|
|
13
|
+
# The engine reported the database busy (another session or process holds it).
|
|
14
|
+
class BusyError < Error; end
|
|
15
|
+
class ClosedError < Error; end
|
|
16
|
+
# A handle opened in a parent process was used after fork; open a new one.
|
|
17
|
+
class ForkedError < Error; end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/beagle/turso/version.rb
CHANGED
data/lib/beagle/turso.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: data/lib/beagle_turso/3.3/beagle_turso.so
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 36921384 bytes
|
|
4
|
+
sha256: 3c379ba925a07c255667fc8e7c9a302b7f673b2e7e3df555714d6012952854e9
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: data/lib/beagle_turso/3.4/beagle_turso.so
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 36936560 bytes
|
|
4
|
+
sha256: e895dfcd90349655853f6578437ca109a18fb6f5154b6cfdac5cf3f3d9c5e822
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: data/lib/beagle_turso/4.0/beagle_turso.so
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 36936552 bytes
|
|
4
|
+
sha256: 9e83259ad535e81fdb327cf808b00d7449da653bcd35a4a1c92d34a585774934
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: beagle-turso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- BeagleSoftwareUK
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
A Ruby driver for Turso's database engine, backed by a native Rust
|
|
@@ -24,6 +24,7 @@ extra_rdoc_files: []
|
|
|
24
24
|
files:
|
|
25
25
|
- README.md
|
|
26
26
|
- lib/beagle/turso.rb
|
|
27
|
+
- lib/beagle/turso/errors.rb
|
|
27
28
|
- lib/beagle/turso/version.rb
|
|
28
29
|
- lib/beagle_turso/3.3/beagle_turso.so
|
|
29
30
|
- lib/beagle_turso/3.4/beagle_turso.so
|