@reddb-io/cli 1.21.0 → 1.22.0-rc.197
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.
- package/README.md +162 -157
- package/drivers/js/package.json +1 -1
- package/drivers/js/src/documents.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<p align="center">Tables. Documents. Graphs. Vectors. KV. One engine. Ask it anything.</p>
|
|
5
|
-
</p>
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="docs/hero.svg" alt="RedDB — the AI-first multi-model database. Tables, documents, graphs, vectors, KV, time-series and queues in one engine. Ask it anything." width="100%" />
|
|
6
4
|
|
|
7
|
-
<p
|
|
8
|
-
<a href="https://github.com/reddb-io/reddb/releases"><img src="https://img.shields.io/github/v/release/reddb-io/reddb?style=
|
|
9
|
-
<a href="
|
|
10
|
-
<a href="
|
|
5
|
+
<p>
|
|
6
|
+
<a href="https://github.com/reddb-io/reddb/releases"><img src="https://img.shields.io/github/v/release/reddb-io/reddb?style=for-the-badge&color=ff2056&labelColor=0b0b0d" alt="Release"></a>
|
|
7
|
+
<a href="https://github.com/reddb-io/reddb/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/reddb-io/reddb/ci.yml?branch=main&style=for-the-badge&label=CI&labelColor=0b0b0d" alt="CI"></a>
|
|
8
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-BSL%201.1-blue?style=for-the-badge&labelColor=0b0b0d" alt="License"></a>
|
|
9
|
+
<img src="https://img.shields.io/badge/rust%20·%20sql%20·%20typescript-555?style=for-the-badge&labelColor=0b0b0d&label=built%20with" alt="Built with">
|
|
11
10
|
</p>
|
|
12
11
|
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🎯 Why RedDB?
|
|
17
|
+
|
|
18
|
+
Stop running Postgres + Neo4j + Pinecone + Redis + Mongo + InfluxDB + RabbitMQ. One file. One engine. One query language. All seven models work together seamlessly.
|
|
19
|
+
|
|
13
20
|
> [!IMPORTANT]
|
|
14
|
-
> In RedDB, a `collection` is the named logical container for data. Tables, documents, key-value, graphs,
|
|
15
|
-
> vectors, time-series, and queues are the user-facing models or semantics you use on top of collections.
|
|
16
|
-
> A collection is not a separate hierarchy layer that contains multiple tables and documents beneath it.
|
|
17
|
-
> Instead, `users` can be a collection used as a table, `events` can be a collection used for documents,
|
|
18
|
-
> and `config` can be a collection used as KV. Some models can also coexist in the same collection.
|
|
21
|
+
> **Collections:** In RedDB, a `collection` is the named logical container for data. Tables, documents, key-value, graphs, vectors, time-series, and queues are the models you layer on top. `users` can be a table, `events` can be documents, `config` can be KV — in the same collection or spread across many. Choose your model; collections unite them.
|
|
19
22
|
|
|
20
23
|
---
|
|
21
24
|
|
|
22
|
-
## The Killer Feature: `ASK`
|
|
25
|
+
## ✨ The Killer Feature: `ASK`
|
|
23
26
|
|
|
24
27
|
```sql
|
|
25
28
|
ASK 'who owns passport AB1234567 and what services do they use?'
|
|
26
29
|
```
|
|
27
30
|
|
|
28
|
-
One command. RedDB searches across tables, graphs, vectors, documents, and key-value stores
|
|
31
|
+
One command. RedDB searches across tables, graphs, vectors, documents, and key-value stores — builds context — calls an LLM — returns a natural-language answer. No pipelines. No glue code. No other database does this.
|
|
29
32
|
|
|
30
33
|
---
|
|
31
34
|
|
|
32
|
-
## 7 Data Models, 1 Engine
|
|
35
|
+
## 📊 7 Data Models, 1 Engine
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
The key mental model is simple: the model is how you work with the data, and the collection is where
|
|
37
|
-
that data lives.
|
|
37
|
+
The mental model: your **model** is how you query (table, graph, vector, etc.), your **collection** is where the data lives. Mix and match freely.
|
|
38
38
|
|
|
39
39
|
```sql
|
|
40
|
-
-- Relational rows
|
|
40
|
+
-- 📋 Relational rows
|
|
41
41
|
INSERT INTO users (name, email) VALUES ('Alice', 'alice@co.com')
|
|
42
42
|
|
|
43
|
-
-- JSON documents
|
|
44
|
-
INSERT INTO logs DOCUMENT VALUES ({"level":"info","msg":"login"})
|
|
43
|
+
-- 📄 JSON documents — inline JSON syntax
|
|
44
|
+
INSERT INTO logs DOCUMENT VALUES ({"level": "info", "msg": "login"})
|
|
45
45
|
|
|
46
|
-
-- Graph edges
|
|
46
|
+
-- 🔗 Graph edges
|
|
47
47
|
INSERT INTO network EDGE (label, from_rid, to_rid) VALUES ('CONNECTS', 102, 103)
|
|
48
48
|
|
|
49
|
-
-- Vector similarity search
|
|
49
|
+
-- 🎯 Vector similarity search
|
|
50
50
|
SEARCH SIMILAR TEXT 'anomaly detected' COLLECTION events
|
|
51
51
|
|
|
52
|
-
-- Key-value
|
|
52
|
+
-- 🔑 Key-value
|
|
53
53
|
KV PUT config.theme = 'dark'
|
|
54
54
|
|
|
55
|
-
-- Time-series
|
|
55
|
+
-- ⏱️ Time-series (retention & downsampling)
|
|
56
56
|
CREATE TIMESERIES cpu_metrics RETENTION 90 d
|
|
57
|
-
INSERT INTO cpu_metrics (metric, value, tags) VALUES ('cpu.idle', 95.2, {"host":"srv1"})
|
|
57
|
+
INSERT INTO cpu_metrics (metric, value, tags) VALUES ('cpu.idle', 95.2, {"host": "srv1"})
|
|
58
58
|
|
|
59
|
-
-- Hypertables
|
|
59
|
+
-- 📦 Hypertables (logs, events, telemetry)
|
|
60
60
|
CREATE HYPERTABLE access_log TIME_COLUMN ts CHUNK_INTERVAL '1d' TTL '90d'
|
|
61
61
|
|
|
62
|
-
-- Append-only
|
|
62
|
+
-- 📑 Append-only (audit, ledger, immutable)
|
|
63
63
|
CREATE TABLE audit_log (id BIGINT, action TEXT) APPEND ONLY
|
|
64
64
|
|
|
65
|
-
-- Message queues (FIFO, priority, consumer groups)
|
|
65
|
+
-- 📨 Message queues (FIFO, priority, consumer groups)
|
|
66
66
|
CREATE QUEUE tasks MAX_SIZE 10000
|
|
67
|
-
QUEUE PUSH tasks {"job":"process","id":123}
|
|
67
|
+
QUEUE PUSH tasks {"job": "process", "id": 123}
|
|
68
68
|
QUEUE POP tasks
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
Same file. Same engine. Same query language.
|
|
71
|
+
Same file. Same engine. Same query language — everything lives in one `.rdb` file.
|
|
72
72
|
|
|
73
73
|
Want to use RedDB as your log store? Start with the
|
|
74
74
|
[Logs Quickstart](./docs/guides/logs-quickstart.md) or the full
|
|
@@ -76,44 +76,46 @@ Want to use RedDB as your log store? Start with the
|
|
|
76
76
|
|
|
77
77
|
---
|
|
78
78
|
|
|
79
|
-
## AI-Native From Day One
|
|
79
|
+
## 🧠 AI-Native From Day One
|
|
80
80
|
|
|
81
81
|
```sql
|
|
82
82
|
-- Semantic search without managing vectors yourself
|
|
83
83
|
SEARCH SIMILAR TEXT 'suspicious login' COLLECTION logs USING groq
|
|
84
84
|
|
|
85
|
-
-- Auto-embed on insert
|
|
85
|
+
-- Auto-embed on insert — vectors are created automatically
|
|
86
86
|
INSERT INTO articles (title, body) VALUES ('AI Safety', 'Alignment research...')
|
|
87
87
|
WITH AUTO EMBED (body) USING openai
|
|
88
88
|
|
|
89
|
-
-- Context search
|
|
89
|
+
-- Context search across all data models
|
|
90
90
|
SEARCH CONTEXT '192.168.1.1' FIELD ip DEPTH 2
|
|
91
91
|
|
|
92
|
-
-- Ask questions in plain English
|
|
92
|
+
-- Ask questions in plain English, get grounded answers
|
|
93
93
|
ASK 'what vulnerabilities affect host 10.0.0.1?' USING anthropic
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
RedDB retrieves context from every data model
|
|
96
|
+
RAG built into the database layer. RedDB retrieves context from every data model and feeds it to the LLM.
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
100
|
-
## 11 AI Providers
|
|
100
|
+
## 🤖 11 AI Providers
|
|
101
|
+
|
|
102
|
+
Swap providers with a keyword. No code changes. Full parity across ASK, embeddings, and model selection.
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
| Provider | Keyword | API Key | ASK / Prompt | Embeddings |
|
|
105
|
+
|:---------|:--------|:-------:|:------------:|:----------:|
|
|
106
|
+
| **OpenAI** | `openai` | ✅ | ✅ | ✅ |
|
|
107
|
+
| **Anthropic** | `anthropic` | ✅ | ✅ | —* |
|
|
108
|
+
| **Groq** | `groq` | ✅ | ✅ | ✅ |
|
|
109
|
+
| **OpenRouter** | `openrouter` | ✅ | ✅ | ✅ |
|
|
110
|
+
| **Together** | `together` | ✅ | ✅ | ✅ |
|
|
111
|
+
| **Venice** | `venice` | ✅ | ✅ | ✅ |
|
|
112
|
+
| **DeepSeek** | `deepseek` | ✅ | ✅ | ✅ |
|
|
113
|
+
| **HuggingFace** | `huggingface` | ✅ | ✅ | ✅ |
|
|
114
|
+
| **Ollama** | `ollama` | — | ✅ | ✅ |
|
|
115
|
+
| **Local** | `local` | — | feature-gated | feature-gated |
|
|
116
|
+
| **Custom URL** | `https://...` | varies | ✅ | ✅ |
|
|
103
117
|
|
|
104
|
-
|
|
105
|
-
|:------------|:---------------|:-------:|:------------:|:----------:|
|
|
106
|
-
| OpenAI | `openai` | Yes | ✅ | ✅ |
|
|
107
|
-
| Anthropic | `anthropic` | Yes | ✅ | rejected |
|
|
108
|
-
| Groq | `groq` | Yes | ✅ | ✅ |
|
|
109
|
-
| OpenRouter | `openrouter` | Yes | ✅ | ✅ |
|
|
110
|
-
| Together | `together` | Yes | ✅ | ✅ |
|
|
111
|
-
| Venice | `venice` | Yes | ✅ | ✅ |
|
|
112
|
-
| DeepSeek | `deepseek` | Yes | ✅ | ✅ |
|
|
113
|
-
| HuggingFace | `huggingface` | Yes | ✅ | ✅ |
|
|
114
|
-
| Ollama | `ollama` | No | ✅ | ✅ |
|
|
115
|
-
| Local | `local` | No | feature-gated | feature-gated |
|
|
116
|
-
| Custom URL | `https://...` | depends | ✅ | ✅ |
|
|
118
|
+
*Anthropic does not offer embeddings; RedDB rejects embedding calls explicitly rather than re-routing to another provider.
|
|
117
119
|
|
|
118
120
|
Most providers speak the OpenAI-compatible `POST /embeddings` shape;
|
|
119
121
|
HuggingFace has its own (`POST /pipeline/feature-extraction/{model}`)
|
|
@@ -152,12 +154,12 @@ curl http://127.0.0.1:5000/config
|
|
|
152
154
|
|
|
153
155
|
---
|
|
154
156
|
|
|
155
|
-
## Probabilistic Data Structures
|
|
157
|
+
## 🎲 Probabilistic Data Structures
|
|
156
158
|
|
|
157
|
-
Built-in approximate data structures for real-time analytics at scale.
|
|
159
|
+
Built-in approximate data structures for real-time analytics at scale. Cardinality estimation, frequency analysis, and set membership all in one engine.
|
|
158
160
|
|
|
159
161
|
```sql
|
|
160
|
-
-- HyperLogLog:
|
|
162
|
+
-- HyperLogLog: unique visitor count (~0.8% error, 16KB memory)
|
|
161
163
|
CREATE HLL visitors
|
|
162
164
|
HLL ADD visitors 'user1' 'user2' 'user3'
|
|
163
165
|
HLL COUNT visitors
|
|
@@ -167,7 +169,7 @@ CREATE SKETCH click_counter WIDTH 2000 DEPTH 7
|
|
|
167
169
|
SKETCH ADD click_counter 'button_a' 5
|
|
168
170
|
SKETCH COUNT click_counter 'button_a'
|
|
169
171
|
|
|
170
|
-
-- Cuckoo Filter: membership
|
|
172
|
+
-- Cuckoo Filter: membership + deletion (unlike Bloom)
|
|
171
173
|
CREATE FILTER active_sessions CAPACITY 500000
|
|
172
174
|
FILTER ADD active_sessions 'session_abc'
|
|
173
175
|
FILTER CHECK active_sessions 'session_abc'
|
|
@@ -176,18 +178,18 @@ FILTER DELETE active_sessions 'session_abc'
|
|
|
176
178
|
|
|
177
179
|
---
|
|
178
180
|
|
|
179
|
-
## Advanced Indexes
|
|
181
|
+
## 🗂️ Advanced Indexes
|
|
180
182
|
|
|
181
|
-
Beyond B-tree.
|
|
183
|
+
Beyond B-tree. Pick the right index for your access pattern.
|
|
182
184
|
|
|
183
185
|
```sql
|
|
184
|
-
-- Hash
|
|
186
|
+
-- Hash: O(1) exact-match lookups
|
|
185
187
|
CREATE INDEX idx_email ON users (email) USING HASH
|
|
186
188
|
|
|
187
|
-
-- Bitmap
|
|
189
|
+
-- Bitmap: analytical queries on low-cardinality columns
|
|
188
190
|
CREATE INDEX idx_status ON orders (status) USING BITMAP
|
|
189
191
|
|
|
190
|
-
-- R-Tree: spatial
|
|
192
|
+
-- R-Tree: spatial & geographic queries
|
|
191
193
|
CREATE INDEX idx_loc ON sites (location) USING RTREE
|
|
192
194
|
SEARCH SPATIAL RADIUS 48.8566 2.3522 10.0 COLLECTION sites COLUMN location LIMIT 50
|
|
193
195
|
SEARCH SPATIAL NEAREST 48.8566 2.3522 K 5 COLLECTION sites COLUMN location
|
|
@@ -195,7 +197,7 @@ SEARCH SPATIAL NEAREST 48.8566 2.3522 K 5 COLLECTION sites COLUMN location
|
|
|
195
197
|
|
|
196
198
|
---
|
|
197
199
|
|
|
198
|
-
## SQL Extensions
|
|
200
|
+
## 🔧 SQL Extensions
|
|
199
201
|
|
|
200
202
|
RedDB extends SQL with `WITH` clauses for operational semantics:
|
|
201
203
|
|
|
@@ -218,7 +220,7 @@ INSERT INTO events (name) VALUES ('launch') WITH EXPIRES AT 1735689600000
|
|
|
218
220
|
|
|
219
221
|
---
|
|
220
222
|
|
|
221
|
-
## 6 Query Languages
|
|
223
|
+
## 🔤 6 Query Languages
|
|
222
224
|
|
|
223
225
|
Write in whatever you think in. The engine auto-detects the language.
|
|
224
226
|
|
|
@@ -235,9 +237,9 @@ All six hit the same engine, same data, same indexes.
|
|
|
235
237
|
|
|
236
238
|
---
|
|
237
239
|
|
|
238
|
-
## Native Migrations — No External Tools
|
|
240
|
+
## 🔄 Native Migrations — No External Tools
|
|
239
241
|
|
|
240
|
-
Stop reaching for Flyway, Liquibase, Drizzle Migrate, or Sequelize
|
|
242
|
+
Stop reaching for Flyway, Liquibase, Drizzle Migrate, or Sequelize. RedDB handles schema and data migrations as first-class SQL commands — all in one transaction log.
|
|
241
243
|
|
|
242
244
|
```sql
|
|
243
245
|
-- Register a migration
|
|
@@ -268,26 +270,26 @@ Every applied migration creates a **VCS commit** (RedDB's "Git for Data"). Rollb
|
|
|
268
270
|
|
|
269
271
|
---
|
|
270
272
|
|
|
271
|
-
## 48 Built-in Types
|
|
272
|
-
|
|
273
|
-
Not just `TEXT` and `INTEGER`. RedDB understands your domain.
|
|
273
|
+
## 📦 48 Built-in Types
|
|
274
274
|
|
|
275
|
-
|
|
276
|
-
**Geo:** `Latitude`, `Longitude`, `GeoPoint`
|
|
277
|
-
**Locale:** `Country2`, `Country3`, `Lang2`, `Lang5`, `Currency`
|
|
278
|
-
**Identity:** `Uuid`, `Email`, `Url`, `Phone`, `Semver`
|
|
279
|
-
**Visual:** `Color`, `ColorAlpha`
|
|
280
|
-
**Cross-model refs:** `NodeRef`, `EdgeRef`, `VectorRef`, `RowRef`, `KeyRef`, `DocRef`, `TableRef`, `PageRef`
|
|
281
|
-
**Primitives:** `Integer`, `UnsignedInteger`, `Float`, `Decimal`, `BigInt`, `Text`, `Blob`, `Boolean`, `Json`, `Array`, `Enum`
|
|
282
|
-
**Temporal:** `Timestamp`, `TimestampMs`, `Date`, `Time`, `Duration`
|
|
275
|
+
Not just `TEXT` and `INTEGER`. RedDB understands your domain — validation on write, no parsing in your app.
|
|
283
276
|
|
|
284
|
-
|
|
277
|
+
| Category | Types |
|
|
278
|
+
|:---------|:------|
|
|
279
|
+
| **Network** | `IpAddr`, `Ipv4`, `Ipv6`, `MacAddr`, `Cidr`, `Subnet`, `Port` |
|
|
280
|
+
| **Geographic** | `Latitude`, `Longitude`, `GeoPoint` |
|
|
281
|
+
| **Locale** | `Country2`, `Country3`, `Lang2`, `Lang5`, `Currency` |
|
|
282
|
+
| **Identity** | `Uuid`, `Email`, `Url`, `Phone`, `Semver` |
|
|
283
|
+
| **Visual** | `Color`, `ColorAlpha` |
|
|
284
|
+
| **Cross-model Refs** | `NodeRef`, `EdgeRef`, `VectorRef`, `RowRef`, `KeyRef`, `DocRef`, `TableRef`, `PageRef` |
|
|
285
|
+
| **Primitives** | `Integer`, `UnsignedInteger`, `Float`, `Decimal`, `BigInt`, `Text`, `Blob`, `Boolean`, `Json`, `Array`, `Enum` |
|
|
286
|
+
| **Temporal** | `Timestamp`, `TimestampMs`, `Date`, `Time`, `Duration` |
|
|
285
287
|
|
|
286
288
|
---
|
|
287
289
|
|
|
288
|
-
## Backup & Recovery
|
|
290
|
+
## 💾 Backup & Recovery
|
|
289
291
|
|
|
290
|
-
Built-in backup scheduler, WAL archiving,
|
|
292
|
+
Built-in backup scheduler, WAL archiving, CDC, and Point-in-Time Recovery — no sidecars required:
|
|
291
293
|
|
|
292
294
|
```bash
|
|
293
295
|
# Poll real-time changes
|
|
@@ -308,7 +310,7 @@ PITR rollback, replica promotion), see
|
|
|
308
310
|
|
|
309
311
|
---
|
|
310
312
|
|
|
311
|
-
## KV REST API
|
|
313
|
+
## 🔌 KV REST API
|
|
312
314
|
|
|
313
315
|
Every collection doubles as a key-value store with dedicated REST endpoints:
|
|
314
316
|
|
|
@@ -341,32 +343,26 @@ SHOW CONFIG red.ai
|
|
|
341
343
|
|
|
342
344
|
---
|
|
343
345
|
|
|
344
|
-
## 3 Deployment Modes
|
|
346
|
+
## 🌍 3 Deployment Modes
|
|
345
347
|
|
|
346
|
-
| Mode |
|
|
347
|
-
|
|
348
|
-
| **Embedded** | SQLite | Rust API
|
|
349
|
-
| **Server** | Postgres | RedWire + gRPC + HTTP
|
|
350
|
-
| **Agent** | MCP
|
|
348
|
+
| Mode | Like | Access | Use Case |
|
|
349
|
+
|:-----|:-----|:-------|:---------|
|
|
350
|
+
| **Embedded** | SQLite | Rust API (`RedDB::open("data.rdb")`) | In-process, single machine |
|
|
351
|
+
| **Server** | Postgres | RedWire + gRPC + HTTP | Multi-client, networked |
|
|
352
|
+
| **Agent** | MCP Server | `red mcp` | Claude Code / AI agents |
|
|
351
353
|
|
|
352
|
-
Same storage format
|
|
354
|
+
Same storage format. Start embedded, scale to server, expose to agents — zero migration.
|
|
353
355
|
|
|
354
356
|
---
|
|
355
357
|
|
|
356
|
-
## Performance
|
|
358
|
+
## ⚡ Performance
|
|
357
359
|
|
|
358
|
-
> **Where RedDB wins
|
|
359
|
-
> benchmark show measurable wins over Postgres and Mongo today:
|
|
360
|
+
> **Where RedDB wins:** benchmarks show measurable wins over Postgres and Mongo today:
|
|
360
361
|
>
|
|
361
|
-
> - `typed_insert` —
|
|
362
|
-
>
|
|
363
|
-
> - `disk_usage` — RedDB ≈ **1.5× faster** than MongoDB on the
|
|
364
|
-
> compact-write path.
|
|
362
|
+
> - `typed_insert` — **16× faster** than PostgreSQL on typed single-row inserts
|
|
363
|
+
> - `disk_usage` — **1.5× faster** than MongoDB on compact-write workloads
|
|
365
364
|
>
|
|
366
|
-
> See [`docs/perf/wins.md`](docs/perf/wins.md) for the
|
|
367
|
-
> and reproducible commands. The honest counterpart — gaps where RedDB
|
|
368
|
-
> is still behind — lives at
|
|
369
|
-
> [`docs/perf/when-not-reddb.md`](docs/perf/when-not-reddb.md).
|
|
365
|
+
> See [`docs/perf/wins.md`](docs/perf/wins.md) for reproducible benchmarks and [`docs/perf/when-not-reddb.md`](docs/perf/when-not-reddb.md) for the honest gaps where we're still behind.
|
|
370
366
|
|
|
371
367
|
RedDB uses multiple optimization techniques for fast queries at scale:
|
|
372
368
|
|
|
@@ -386,25 +382,23 @@ RedDB uses multiple optimization techniques for fast queries at scale:
|
|
|
386
382
|
|
|
387
383
|
---
|
|
388
384
|
|
|
389
|
-
## Durability & Corruption Defense
|
|
385
|
+
## 🛡️ Durability & Corruption Defense
|
|
390
386
|
|
|
391
|
-
|
|
387
|
+
Seven layers of protection — tested and proven against power loss, torn writes, and crashes:
|
|
392
388
|
|
|
393
|
-
| Layer |
|
|
394
|
-
|
|
395
|
-
| **File Lock** | Exclusive `flock` prevents
|
|
396
|
-
| **Double-Write Buffer** | Pages
|
|
397
|
-
| **Header Shadow** |
|
|
398
|
-
| **Metadata Shadow** |
|
|
399
|
-
| **fsync Discipline** |
|
|
400
|
-
| **Two-Phase Checkpoint** |
|
|
401
|
-
| **
|
|
402
|
-
|
|
403
|
-
Every page has a CRC32 checksum (verified on read). Every WAL record has a CRC32 checksum. The binary store format (V3) includes a full-file CRC32 footer.
|
|
389
|
+
| Layer | Defense |
|
|
390
|
+
|:------|:---------|
|
|
391
|
+
| **File Lock** | Exclusive `flock` — prevents concurrent writes to `.rdb` |
|
|
392
|
+
| **Double-Write Buffer** | Pages in `.rdb-dwb` first — survives power loss |
|
|
393
|
+
| **Header Shadow** | Backup page 0 in `.rdb-hdr` — auto-recovers corruption |
|
|
394
|
+
| **Metadata Shadow** | Backup page 1 in `.rdb-meta` — recovers collection registry |
|
|
395
|
+
| **fsync Discipline** | `sync_all()` after every critical write — no flush-only shortcuts |
|
|
396
|
+
| **Two-Phase Checkpoint** | WAL→DB with `checkpoint_in_progress` flag — crash-safe |
|
|
397
|
+
| **CRC32 Checksum** | Every page, every WAL record, full-file footer — detects bitrot |
|
|
404
398
|
|
|
405
399
|
---
|
|
406
400
|
|
|
407
|
-
## Eventual Consistency
|
|
401
|
+
## 🔀 Eventual Consistency
|
|
408
402
|
|
|
409
403
|
RedDB supports per-field eventual consistency via an append-only transaction log with periodic consolidation. Inspired by CRDT principles (commutative, associative reducers), it enables high-throughput write patterns while guaranteeing convergence.
|
|
410
404
|
|
|
@@ -429,7 +423,7 @@ See the [Eventual Consistency Guide](https://reddb-io.github.io/reddb/#/guides/e
|
|
|
429
423
|
|
|
430
424
|
---
|
|
431
425
|
|
|
432
|
-
## Geographic Operations
|
|
426
|
+
## 🗺️ Geographic Operations
|
|
433
427
|
|
|
434
428
|
Built-in geo functions with no external dependencies. Supports both spherical (Haversine) and ellipsoidal (Vincenty/WGS-84) models.
|
|
435
429
|
|
|
@@ -462,7 +456,7 @@ Also available: destination point, bounding box, polygon area, spatial search (R
|
|
|
462
456
|
|
|
463
457
|
---
|
|
464
458
|
|
|
465
|
-
## Vector Clustering
|
|
459
|
+
## 📈 Vector Clustering
|
|
466
460
|
|
|
467
461
|
Standalone K-Means and DBSCAN clustering on vector collections, with SIMD-accelerated distance computation and automatic parallelization.
|
|
468
462
|
|
|
@@ -482,11 +476,9 @@ K-Means uses parallel assignment (multi-threaded for datasets > 1K vectors). DBS
|
|
|
482
476
|
|
|
483
477
|
---
|
|
484
478
|
|
|
485
|
-
## Native Drivers
|
|
479
|
+
## 🚀 Native Drivers
|
|
486
480
|
|
|
487
|
-
One connection-string API,
|
|
488
|
-
`connect(uri)` contract so application code ports across runtimes with zero
|
|
489
|
-
ceremony.
|
|
481
|
+
One connection-string API, multiple languages. Same `connect(uri)` everywhere — code ports across runtimes with zero ceremony.
|
|
490
482
|
|
|
491
483
|
| Language | Package | Install | Backends |
|
|
492
484
|
|-------------------|------------------|--------------------------------|-------------------------------------|
|
|
@@ -567,74 +559,87 @@ npx @reddb-io/cli@latest server --wire-bind 127.0.0.1:5050 --http-bind 127.0.0.1
|
|
|
567
559
|
|
|
568
560
|
---
|
|
569
561
|
|
|
570
|
-
## Quick Start
|
|
562
|
+
## 🚀 Quick Start
|
|
563
|
+
|
|
564
|
+
**Install the `red` binary:**
|
|
571
565
|
|
|
572
566
|
```bash
|
|
573
|
-
# Install
|
|
574
567
|
curl -fsSL https://raw.githubusercontent.com/reddb-io/reddb/main/install.sh | bash
|
|
575
|
-
#
|
|
568
|
+
# Verifies SHA256 before install • auto-detects your OS + arch
|
|
569
|
+
```
|
|
576
570
|
|
|
577
|
-
|
|
578
|
-
red server --wire-bind 127.0.0.1:5050 --grpc-bind 127.0.0.1:55055 --http-bind 127.0.0.1:5000 --path ./data.rdb
|
|
571
|
+
**Start the server:**
|
|
579
572
|
|
|
580
|
-
|
|
573
|
+
```bash
|
|
574
|
+
red server --wire-bind 127.0.0.1:5050 --http-bind 127.0.0.1:5000 --path ./data.rdb
|
|
575
|
+
# RedWire: 5050 · gRPC: 55055 · HTTP: 5000
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
**Insert and query via HTTP:**
|
|
579
|
+
|
|
580
|
+
```bash
|
|
581
581
|
curl -X POST http://127.0.0.1:5000/query \
|
|
582
582
|
-H 'content-type: application/json' \
|
|
583
|
-
-d '{"query":"INSERT INTO hosts (ip, os) VALUES ('
|
|
583
|
+
-d '{"query":"INSERT INTO hosts (ip, os) VALUES ('"'"'10.0.0.1'"'"', '"'"'linux'"'"')"}'
|
|
584
584
|
|
|
585
|
-
# Query it
|
|
586
585
|
curl -X POST http://127.0.0.1:5000/query \
|
|
587
586
|
-H 'content-type: application/json' \
|
|
588
587
|
-d '{"query":"SELECT * FROM hosts"}'
|
|
589
588
|
```
|
|
590
589
|
|
|
591
|
-
Or via npm
|
|
590
|
+
**Or via npm (no separate install):**
|
|
592
591
|
|
|
593
592
|
```bash
|
|
594
|
-
npx @reddb-io/cli@latest server --
|
|
593
|
+
npx @reddb-io/cli@latest server --http-bind 127.0.0.1:5000
|
|
595
594
|
```
|
|
596
595
|
|
|
597
|
-
Or
|
|
596
|
+
**Or Docker:**
|
|
598
597
|
|
|
599
598
|
```bash
|
|
600
|
-
|
|
601
|
-
|
|
599
|
+
docker run --rm -p 5050:5050 -p 55055:55055 -p 5000:5000 \
|
|
600
|
+
ghcr.io/reddb-io/reddb:latest
|
|
602
601
|
```
|
|
603
602
|
|
|
604
|
-
|
|
603
|
+
→ See [`docs/deployment/docker.md`](./docs/deployment/docker.md) and [`docs/security/vault.md`](./docs/security/vault.md) for production setups.
|
|
605
604
|
|
|
606
|
-
|
|
607
|
-
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USER" --password-stdin # if GHCR requires auth
|
|
608
|
-
docker run --rm ghcr.io/reddb-io/reddb-client:latest red://reddb.example.com:5050 -c "SELECT 1"
|
|
609
|
-
```
|
|
605
|
+
---
|
|
610
606
|
|
|
611
|
-
|
|
612
|
-
[`docs/deployment/docker.md`](./docs/deployment/docker.md)
|
|
613
|
-
and [`docs/security/vault.md`](./docs/security/vault.md).
|
|
607
|
+
## 📂 Architecture
|
|
614
608
|
|
|
615
|
-
|
|
609
|
+
RedDB ships as a Cargo workspace:
|
|
616
610
|
|
|
617
|
-
|
|
611
|
+
| Crate | Role |
|
|
612
|
+
|:------|:-----|
|
|
613
|
+
| `reddb` | Binary umbrella; houses the `red` CLI |
|
|
614
|
+
| `reddb-io-engine` | Storage engine, indexes, query execution |
|
|
615
|
+
| `reddb-io-client` | Rust driver with embedded, gRPC, HTTP transports |
|
|
616
|
+
| `reddb-io-wire` | RedWire protocol vocabulary & framing |
|
|
617
|
+
| `reddb-io-rql` | RQL parser and semantic analyzer |
|
|
618
|
+
| `reddb-io-types` | Type system, value codec, cross-model refs |
|
|
618
619
|
|
|
619
|
-
|
|
620
|
-
umbrella that hosts the `red` binary; the engine, thin client,
|
|
621
|
-
gRPC stubs, and wire vocabulary live in sibling crates.
|
|
620
|
+
---
|
|
622
621
|
|
|
623
|
-
##
|
|
622
|
+
## 📚 Resources
|
|
624
623
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
624
|
+
| Resource | Purpose |
|
|
625
|
+
|:---------|:---------|
|
|
626
|
+
| 📖 [Documentation](https://reddb-io.github.io/reddb) | Full guides, API reference, tutorials |
|
|
627
|
+
| 🐙 [GitHub](https://github.com/reddb-io/reddb) | Source code, issues, discussions |
|
|
628
|
+
| 📦 [npm CLI](https://www.npmjs.com/package/@reddb-io/cli) | Install & run via `npx` |
|
|
629
|
+
| 📤 [npm Drivers](https://www.npmjs.com/package/@reddb-io/sdk) | Node/Bun/Deno SDK |
|
|
630
|
+
| 📋 [Release Notes](./docs/release-policy.md) | Version history & changelog |
|
|
631
|
+
| 🛡️ [Security Policy](./SECURITY.md) | Reporting vulnerabilities |
|
|
632
|
+
| ✅ [Contract Matrix](./docs/reference/contract-matrix.md) | Every promise → test or plan |
|
|
634
633
|
|
|
635
634
|
---
|
|
636
635
|
|
|
637
|
-
|
|
636
|
+
<div align="center">
|
|
637
|
+
|
|
638
|
+
**Business Source License 1.1** — source-available; free for self-hosted & internal use. Managed services require a commercial license. Converts to AGPL-3.0 on June 22, 2030. See [LICENSE](./LICENSE).
|
|
639
|
+
|
|
640
|
+
Built by [RedDB.io](https://github.com/reddb-io)
|
|
641
|
+
|
|
642
|
+
</div>
|
|
638
643
|
|
|
639
644
|
<!-- contract-matrix:begin -->
|
|
640
645
|
## Public-surface support
|
package/drivers/js/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reddb-io/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0-rc.197",
|
|
4
4
|
"description": "Official embedded RedDB SDK — launches a local red binary over stdio JSON-RPC. Use @reddb-io/client for remote HTTP, gRPC, and RedWire.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -57,7 +57,7 @@ export class DocumentClient {
|
|
|
57
57
|
.map(([field, value]) => `${sqlIdentifier(field)} = ${sqlValueLiteral(value)}`)
|
|
58
58
|
.join(', ')
|
|
59
59
|
const result = await this.db.query(
|
|
60
|
-
`UPDATE ${sqlIdentifierPath(collection)}
|
|
60
|
+
`UPDATE ${sqlIdentifierPath(collection)} SET ${assignments} WHERE rid = $1 RETURNING *`,
|
|
61
61
|
rid,
|
|
62
62
|
)
|
|
63
63
|
const item = result.rows?.[0]
|