beagle-turso 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c7ee363f8f6907c44c13643ca8343a1d5f978df82c854bf709e5f62a922373cd
4
+ data.tar.gz: 3de062e24354c15d6d1c59c5015c8171a6457774ee90bfa6e85612212b30ad30
5
+ SHA512:
6
+ metadata.gz: 4012318992c20173ddb5907f7854f565bfcb994fc2585aa0fc47fc9a0a1bb9f01cd2a0405a84d007d5561355d210693ae09b02801765cd94de7e8ffc4480d3b2
7
+ data.tar.gz: 86688686bb548e1ff248ed7edee4ed0ce5864084ae845263a61ce7313db740cb2693cc1631870287a72abe6681931c0b387a33881ab0252fe654e6ea4e48ff2e
data/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # beagle-turso
2
+
3
+ A Ruby driver for [Turso](https://turso.tech)'s database engine, backed by a
4
+ native Rust extension (`beagle_turso_core`, via [Magnus](https://github.com/matsadler/magnus)/[rb_sys](https://github.com/oxidize-rb/rb-sys)).
5
+
6
+ A `Database` can be opened two ways:
7
+
8
+ - **Local-only** — in-memory or an on-disk file, no network involved.
9
+ - **Synced** — a local file kept in sync with a remote Turso database via
10
+ `push`/`pull`.
11
+
12
+ ## Install
13
+
14
+ Add to your `Gemfile`:
15
+
16
+ ```ruby
17
+ gem "beagle-turso"
18
+ ```
19
+
20
+ or install directly:
21
+
22
+ ```sh
23
+ gem install beagle-turso
24
+ ```
25
+
26
+ Installing builds the native extension via `rb_sys`/`rake-compiler`, so a
27
+ Rust toolchain is required unless a precompiled binary gem is available for
28
+ your platform.
29
+
30
+ ## Local example
31
+
32
+ ```ruby
33
+ require "beagle/turso"
34
+
35
+ db = Beagle::Turso::Database.open_local(":memory:")
36
+ conn = db.connect
37
+
38
+ conn.execute("CREATE TABLE users (id INTEGER, name TEXT)", [])
39
+ conn.execute("INSERT INTO users (id, name) VALUES (?, ?)", [1, "Ada"])
40
+
41
+ rows = conn.query("SELECT id, name FROM users", [])
42
+ # => [[1, "Ada"]]
43
+ ```
44
+
45
+ `execute` returns the number of affected rows (an `Integer`); `query`
46
+ returns an `Array` of row `Array`s. Bind parameters may be `nil`, `Integer`,
47
+ `Float`, `String` (bound as `TEXT`), or a binary `String` — one with
48
+ `ASCII-8BIT`/`BINARY` encoding — bound as `BLOB`.
49
+
50
+ ## Synced example
51
+
52
+ ```ruby
53
+ require "beagle/turso"
54
+
55
+ db = Beagle::Turso::Database.open(
56
+ local_path: "/path/to/local.db",
57
+ remote_url: ENV.fetch("TURSO_DATABASE_URL"),
58
+ auth_token: ENV.fetch("TURSO_AUTH_TOKEN")
59
+ )
60
+
61
+ conn = db.connect
62
+ conn.execute("INSERT INTO users (id, name) VALUES (?, ?)", [2, "Grace"])
63
+
64
+ db.push # propagate local writes to the remote
65
+ db.pull # pull remote changes down to the local file (returns true/false)
66
+ ```
67
+
68
+ `Database.open` also accepts `bootstrap_if_empty:` (defaults to `true`),
69
+ which pulls all remote data down on first open if the local file is new/empty.
70
+ Calling `push`/`pull` on a database opened via `open_local` (or via `open`
71
+ without both `remote_url:` and `auth_token:`) raises `RuntimeError`.
72
+
73
+ ### Durability note: writes commit on-sync, not synchronously
74
+
75
+ Writes to a synced database commit to the **local** file immediately, as
76
+ part of `execute` — they do not wait on the network. They are only
77
+ propagated to the remote **on sync**, i.e. whenever `push` is explicitly
78
+ called; `push` is not called automatically after every write. Until a
79
+ `push` succeeds, a write that's durable locally is not yet visible to other
80
+ replicas of the same remote database.
81
+
82
+ ## Credential safety
83
+
84
+ `auth_token` is never included in `inspect` output or in error messages —
85
+ confirmed by this gem's `no_secret_logging_spec.rb`.
86
+
87
+ ## License
88
+
89
+ [MIT](https://opensource.org/licenses/MIT).
@@ -0,0 +1,5 @@
1
+ module Beagle
2
+ module Turso
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ require_relative "turso/version"
2
+ require "beagle_turso/beagle_turso" # native extension
3
+
4
+ module Beagle
5
+ module Turso
6
+ class Database
7
+ # Opens a local-only database, or one synced with a remote Turso
8
+ # database when both `remote_url` and `auth_token` are given (see
9
+ # `#push`/`#pull`). Delegates to the native `_open` primitive, which
10
+ # takes its arguments positionally.
11
+ def self.open(local_path:, remote_url: nil, auth_token: nil, bootstrap_if_empty: true)
12
+ _open(local_path, remote_url, auth_token, bootstrap_if_empty)
13
+ end
14
+
15
+ private_class_method :_open
16
+ end
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: beagle-turso
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: aarch64-linux
6
+ authors:
7
+ - BeagleSoftwareUK
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-08-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ A Ruby driver for Turso's database engine, backed by a native Rust
15
+ extension (beagle_turso_core, via Magnus/rb-sys). Opens a local-only
16
+ database (in-memory or on-disk) or one kept in sync with a remote Turso
17
+ database via explicit push/pull. Writes are durable to the local file
18
+ immediately as they happen; push is what propagates them to the remote
19
+ on sync, not synchronously with every write.
20
+ email:
21
+ executables: []
22
+ extensions: []
23
+ extra_rdoc_files: []
24
+ files:
25
+ - README.md
26
+ - lib/beagle/turso.rb
27
+ - lib/beagle/turso/version.rb
28
+ - lib/beagle_turso/3.3/beagle_turso.so
29
+ - lib/beagle_turso/3.4/beagle_turso.so
30
+ homepage: https://github.com/BeagleSoftwareUK/beagle-turso
31
+ licenses:
32
+ - MIT
33
+ metadata:
34
+ source_code_uri: https://github.com/BeagleSoftwareUK/beagle-turso
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '3.3'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: 3.5.dev
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubygems_version: 3.5.23
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: Ruby driver for Turso's new engine, backed by beagle_turso_core (Rust).
57
+ test_files: []