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