beagle-turso 0.1.3-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c85e31d72fe11ab6eb70dc416b1fa4b3782e541955746f4290a7009c3443868
4
- data.tar.gz: 199dd3f0118dcde3a7ca0455ef48e21aed47e1e207eb3821868b6be9a04f57a3
3
+ metadata.gz: 74f1d9beadf880cf80dc6f87f86fca245cbb9fb079948a02bd06fd7678655d08
4
+ data.tar.gz: 4bfdf6b3a4df383494f4deeb2df0acbfbf1f72053e8fe5ca72ec3cf4a6daab31
5
5
  SHA512:
6
- metadata.gz: aa4f7a9c455413d71e5bd7ebd635314de450f3a5ae2a6c88b5fd7adcf3cb149a627337855a3b517589f99b9c8399acd3b5738b5f7191aa0c594168379a512500
7
- data.tar.gz: 631490722ccb8880afe922e511153a693710f8fa6250e3ddf9e21f09c155e03db7b6551616742e7bda1e93b7db8482f1dc8aa3a0adba651898d7bb88bc71a9c0
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 `RuntimeError`.
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
 
@@ -103,6 +104,54 @@ Two things to avoid:
103
104
  A single remote database, dedicated to this engine and written by one process
104
105
  at a time, is the model it's built for.
105
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
+
106
155
  ## Credential safety
107
156
 
108
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
@@ -1,5 +1,5 @@
1
1
  module Beagle
2
2
  module Turso
3
- VERSION = "0.1.3"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data/lib/beagle/turso.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require_relative "turso/version"
2
+ require_relative "turso/errors"
2
3
 
3
4
  # Load the native extension. Precompiled ("fat") gems ship the .so under a
4
5
  # per-Ruby-ABI subdir (lib/beagle_turso/<major.minor>/beagle_turso.so); a
@@ -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: 33948440 bytes
4
- sha256: 4e3148bc3815a445f488d3bd1afc1cb91050b2cfc71154dc868145efc652b5f2
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: 33959928 bytes
4
- sha256: e2e827d0c6af79868e9f9ae1a4371289ecffa4e59ea4fc9ba37652cb2632ec67
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: 33964040 bytes
4
- sha256: f7decb8dfd30f52e2a849920478513e5d45b295c9c1ed46f2ef48b797e0712ab
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.1.3
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-08-09 00:00:00.000000000 Z
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