nedb-engine 2.0.5__tar.gz → 2.0.7__tar.gz

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.
Files changed (27) hide show
  1. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/PKG-INFO +98 -12
  2. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/README.md +97 -11
  3. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/pyproject.toml +1 -1
  4. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/__init__.py +1 -1
  5. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/.gitignore +0 -0
  6. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/LICENSE +0 -0
  7. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/client/python/README.md +0 -0
  8. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/autoindex.py +0 -0
  9. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/backends/__init__.py +0 -0
  10. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/backends/redis_backend.py +0 -0
  11. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/cascade.py +0 -0
  12. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/concurrent.py +0 -0
  13. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/crypto.py +0 -0
  14. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/engine.py +0 -0
  15. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/index.py +0 -0
  16. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/log.py +0 -0
  17. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/merkle.py +0 -0
  18. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/mongo.py +0 -0
  19. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/query.py +0 -0
  20. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/redis_compat.py +0 -0
  21. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/relations.py +0 -0
  22. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/resp2.py +0 -0
  23. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/server.py +0 -0
  24. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/snapshot.py +0 -0
  25. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/sql.py +0 -0
  26. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/store.py +0 -0
  27. {nedb_engine-2.0.5 → nedb_engine-2.0.7}/python/nedb/wrap_redis.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nedb-engine
3
- Version: 2.0.5
3
+ Version: 2.0.7
4
4
  Summary: NEDB — a versioned, self-compressing, time-traveling embedded database (replay-protected, idempotent, relational, searchable) with durable AOF persistence and a server daemon (nedbd).
5
5
  Project-URL: Homepage, https://github.com/Eth-Interchained/nedb
6
6
  Project-URL: Repository, https://github.com/Eth-Interchained/nedb
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
21
21
 
22
22
  # NEDB
23
23
 
24
- **Hash-chained · time-traveling · bi-temporal · causally-provable embedded database.**
24
+ **Content-addressed Merkle DAG · Hash-chained · Time-traveling · Bi-temporal · Causally-provable embedded database.**
25
25
 
26
26
  Replay-protected · idempotent · relational · filterable · sortable · searchable · concurrent.
27
27
  One Rust core → ships to **PyPI** and **npm** from a single source.
@@ -29,6 +29,8 @@ One Rust core → ships to **PyPI** and **npm** from a single source.
29
29
  [![PyPI](https://img.shields.io/pypi/v/nedb-engine?label=PyPI&color=6366f1)](https://pypi.org/project/nedb-engine/)
30
30
  [![npm](https://img.shields.io/npm/v/nedb-engine?label=npm&color=00d4ff)](https://www.npmjs.com/package/nedb-engine)
31
31
  [![Tests](https://img.shields.io/badge/tests-266%20passing-34d399)](https://github.com/Eth-Interchained/nedb/actions)
32
+ [![nedb-engine-client PyPI](https://img.shields.io/pypi/v/nedb-engine-client?label=nedb-engine-client&color=34d399)](https://pypi.org/project/nedb-engine-client/)
33
+ [![nedb-engine-client npm](https://img.shields.io/npm/v/nedb-engine-client?label=nedb-engine-client&color=34d399)](https://www.npmjs.com/package/nedb-engine-client)
32
34
 
33
35
  **[Studio → studio.interchained.org](https://studio.interchained.org)** · **[nedb.aiassist.net](https://nedb.aiassist.net)**
34
36
 
@@ -36,6 +38,34 @@ One Rust core → ships to **PyPI** and **npm** from a single source.
36
38
 
37
39
  ---
38
40
 
41
+ ## v2 — The DAG Engine (new in 2.0.5)
42
+
43
+ NEDB v2 replaces the append-only log (AOF) with a **content-addressed Merkle DAG**. Every document version is an immutable, BLAKE2b-verified object. Nothing is ever overwritten.
44
+
45
+ ```bash
46
+ # Run the v2 DAG engine — ships inside pip install nedb-engine
47
+ nedbd --dag --data ./data
48
+ # or
49
+ NEDBD_DAG=1 NEDB_TMK=<32-byte-hex> nedbd --data ./data
50
+
51
+ curl http://127.0.0.1:7070/health
52
+ # {"ok":true,"version":"2.0.5","service":"nedbd","encrypted":true}
53
+ ```
54
+
55
+ | Property | v2 DAG | v1 AOF |
56
+ |---|:---:|:---:|
57
+ | Uncorruptable (atomic writes, hash-verified reads) | ✅ | ⚠️ |
58
+ | Instant cold start (no AOF replay) | ✅ | ❌ |
59
+ | Parallel writes (no global lock) | ✅ | ❌ |
60
+ | BLAKE2b Merkle head on every response | ✅ | ❌ |
61
+ | Tombstone deletes (history preserved) | ✅ | ✅ |
62
+ | Auto-migrates v1 AOF → v2 DAG on startup | ✅ | — |
63
+ | Same HTTP API — Vision, Studio, all clients unchanged | ✅ | ✅ |
64
+
65
+ **v1 AOF engine is still shipped and unchanged** — `nedbd` (no flag) runs v1.
66
+
67
+ ---
68
+
39
69
  ## What makes NEDB different
40
70
 
41
71
  Every database stores *what*. NEDB stores *what*, *when*, *when it was true*, and *why* — all sealed in a cryptographic hash chain that proves none of it was tampered with.
@@ -252,15 +282,28 @@ db.query('FROM policy AS OF 200 VALID AS OF "2024-02-15"')
252
282
 
253
283
  ---
254
284
 
255
- ## Performance (v1.0.x · Rust native · Linux x86_64 VPS)
285
+ ## Performance
256
286
 
257
- | Operation | Throughput | Notes |
287
+ **v1 Python server (baseline single-threaded AOF):**
288
+
289
+ | Operation | Throughput | p99 latency |
258
290
  |---|---|---|
259
- | PUT (Rust napi, per-op FFI) | ~70K/s | FFI-bound; batch path: ~15K writes/s group-commit |
260
- | GET (Rust napi, per-op FFI) | ~330K/s | FFI-bound |
261
- | NQL query (Rust engine) | ~23 µs | faster than pure-Python (~120 µs) |
262
- | Python PUT (AOF + fsync) | ~7K/s | Durable, per-op |
263
- | Python GET (in-process) | ~1.3M/s | Zero socket hop |
291
+ | Sequential PUT | ~23/s | 44 ms |
292
+ | Concurrent PUT (16 workers) | ~92/s | 48 ms |
293
+ | Batch PUT (500 ops/request) | ~520 ops/s | 1.9 ms/op |
294
+ | Point-lookup read (NQL) | ~23/s | 44 ms |
295
+ | Rust napi PUT (FFI) | ~70K/s | |
296
+ | Rust napi GET (FFI) | ~330K/s | — |
297
+
298
+ **v2 DAG Rust server — tokio/axum, no GIL, lock-free per-doc writes:**
299
+ > Benchmarks in progress — target 5,000–50,000 ops/s. Run `python3 tests/test_dag_perf.py` against your own instance.
300
+
301
+ Reproduce with the included benchmark:
302
+
303
+ ```bash
304
+ NEDBD_DAG=1 nedbd --data /tmp/perf &
305
+ python3 tests/test_dag_perf.py --n 10000 --reads 100000
306
+ ```
264
307
 
265
308
  ---
266
309
 
@@ -290,16 +333,49 @@ Encryption: AES-256-GCM at-rest (TMK/DEK double-envelope)
290
333
 
291
334
  ---
292
335
 
336
+ ## nedb-client — lightweight HTTP client
337
+
338
+ Connect to any running nedbd instance from Python or TypeScript without embedding the engine:
339
+
340
+ ```bash
341
+ pip install nedb-engine-client # async Python
342
+ npm install nedb-engine-client # TypeScript / Node.js 18+
343
+ ```
344
+
345
+ ```python
346
+ from nedb_client import NedbClient
347
+
348
+ async with NedbClient("http://127.0.0.1:7070", db="mydb") as db:
349
+ await db.put("blocks", "618000", {"height": 618000})
350
+ rows = await db.query("FROM blocks ORDER BY height DESC LIMIT 10")
351
+ head = await db.head() # BLAKE2b Merkle root — changes on every write
352
+ ok = await db.verify() # tamper-evidence check across all objects
353
+ ```
354
+
355
+ ```typescript
356
+ import { NedbClient } from "nedb-engine-client";
357
+ const db = new NedbClient({ url: "http://127.0.0.1:7070", db: "mydb" });
358
+ await db.put("blocks", "618000", { height: 618000 });
359
+ const rows = await db.query("FROM blocks LIMIT 10");
360
+ ```
361
+
362
+ ---
363
+
293
364
  ## Repo layout
294
365
 
295
366
  ```
296
367
  python/nedb/ reference engine (pure Python — always-works baseline)
297
368
  rust/
298
- nedb-core/ production Rust engine (shared by both runtimes)
369
+ nedb-core/ v1 production Rust engine (shared by both runtimes)
299
370
  nedb-py/ maturin PyO3 binding → PyPI native wheels
300
371
  nedb-node/ napi-rs binding → npm native addons
301
- tests/ engine + concurrent + causal + bitemporal + deploy tests
372
+ nedb-v2/ v2 DAG engine (tokio + axum + BLAKE2b DAG)
373
+ client/
374
+ python/ nedb-client — async Python HTTP client (pip install nedb-engine-client)
375
+ node/ nedb-client — TypeScript HTTP client (npm install nedb-client)
376
+ tests/ engine + concurrent + causal + bitemporal + deploy + perf benchmarks
302
377
  examples/ resp2_python.py resp2_demo.sh
378
+ docs/ index.html reference.html SPEC.md
303
379
  ```
304
380
 
305
381
  ---
@@ -316,7 +392,17 @@ examples/ resp2_python.py resp2_demo.sh
316
392
  - [x] SQL / Redis / MongoDB compatibility adapters
317
393
  - [x] RESP2 wire protocol (redis-cli / redis-benchmark compatible)
318
394
  - [x] Rust native core — napi-rs (npm) + maturin PyO3 (PyPI)
319
- - [x] Self-healing chains (auto-repair structural gaps, detect real tampering)
395
+ - [x] Self-healing AOF auto-truncates corrupt tail on startup, never hangs
396
+ - [x] **v2 DAG engine** — content-addressed Merkle DAG, atomic writes, instant cold start
397
+ - [x] **`nedbd --dag`** — one flag switches to v2 Rust engine; v1 untouched
398
+ - [x] **BLAKE2b Merkle head** — tamper-evident root on every response
399
+ - [x] **Tombstone deletes** — history preserved in DAG, live id removed from index
400
+ - [x] **Auto-migration** — v1 AOF → v2 DAG on first `--dag` startup
401
+ - [x] **nedb-client** — async Python + TypeScript HTTP client (`pip/npm install nedb-client`)
402
+ - [x] **Intel Mac support** — native wheels for `aarch64` + `x86_64` Apple Darwin
403
+ - [ ] In-memory DAG mode — `Db::in_memory()` for zero-disk ephemeral sessions
404
+ - [ ] PyO3 + napi-rs bindings updated to v2 DAG API
405
+ - [ ] NEDB Studio DAG mode toggle
320
406
  - [ ] Merkle inclusion proofs — prove a document existed at a specific time to a third party
321
407
  - [ ] Git-style branching — fork database state, experiment, merge or discard
322
408
  - [ ] Agent Memory SDK — `Memory.remember()` / `Memory.recall()` / `Memory.trace()`
@@ -2,7 +2,7 @@
2
2
 
3
3
  # NEDB
4
4
 
5
- **Hash-chained · time-traveling · bi-temporal · causally-provable embedded database.**
5
+ **Content-addressed Merkle DAG · Hash-chained · Time-traveling · Bi-temporal · Causally-provable embedded database.**
6
6
 
7
7
  Replay-protected · idempotent · relational · filterable · sortable · searchable · concurrent.
8
8
  One Rust core → ships to **PyPI** and **npm** from a single source.
@@ -10,6 +10,8 @@ One Rust core → ships to **PyPI** and **npm** from a single source.
10
10
  [![PyPI](https://img.shields.io/pypi/v/nedb-engine?label=PyPI&color=6366f1)](https://pypi.org/project/nedb-engine/)
11
11
  [![npm](https://img.shields.io/npm/v/nedb-engine?label=npm&color=00d4ff)](https://www.npmjs.com/package/nedb-engine)
12
12
  [![Tests](https://img.shields.io/badge/tests-266%20passing-34d399)](https://github.com/Eth-Interchained/nedb/actions)
13
+ [![nedb-engine-client PyPI](https://img.shields.io/pypi/v/nedb-engine-client?label=nedb-engine-client&color=34d399)](https://pypi.org/project/nedb-engine-client/)
14
+ [![nedb-engine-client npm](https://img.shields.io/npm/v/nedb-engine-client?label=nedb-engine-client&color=34d399)](https://www.npmjs.com/package/nedb-engine-client)
13
15
 
14
16
  **[Studio → studio.interchained.org](https://studio.interchained.org)** · **[nedb.aiassist.net](https://nedb.aiassist.net)**
15
17
 
@@ -17,6 +19,34 @@ One Rust core → ships to **PyPI** and **npm** from a single source.
17
19
 
18
20
  ---
19
21
 
22
+ ## v2 — The DAG Engine (new in 2.0.5)
23
+
24
+ NEDB v2 replaces the append-only log (AOF) with a **content-addressed Merkle DAG**. Every document version is an immutable, BLAKE2b-verified object. Nothing is ever overwritten.
25
+
26
+ ```bash
27
+ # Run the v2 DAG engine — ships inside pip install nedb-engine
28
+ nedbd --dag --data ./data
29
+ # or
30
+ NEDBD_DAG=1 NEDB_TMK=<32-byte-hex> nedbd --data ./data
31
+
32
+ curl http://127.0.0.1:7070/health
33
+ # {"ok":true,"version":"2.0.5","service":"nedbd","encrypted":true}
34
+ ```
35
+
36
+ | Property | v2 DAG | v1 AOF |
37
+ |---|:---:|:---:|
38
+ | Uncorruptable (atomic writes, hash-verified reads) | ✅ | ⚠️ |
39
+ | Instant cold start (no AOF replay) | ✅ | ❌ |
40
+ | Parallel writes (no global lock) | ✅ | ❌ |
41
+ | BLAKE2b Merkle head on every response | ✅ | ❌ |
42
+ | Tombstone deletes (history preserved) | ✅ | ✅ |
43
+ | Auto-migrates v1 AOF → v2 DAG on startup | ✅ | — |
44
+ | Same HTTP API — Vision, Studio, all clients unchanged | ✅ | ✅ |
45
+
46
+ **v1 AOF engine is still shipped and unchanged** — `nedbd` (no flag) runs v1.
47
+
48
+ ---
49
+
20
50
  ## What makes NEDB different
21
51
 
22
52
  Every database stores *what*. NEDB stores *what*, *when*, *when it was true*, and *why* — all sealed in a cryptographic hash chain that proves none of it was tampered with.
@@ -233,15 +263,28 @@ db.query('FROM policy AS OF 200 VALID AS OF "2024-02-15"')
233
263
 
234
264
  ---
235
265
 
236
- ## Performance (v1.0.x · Rust native · Linux x86_64 VPS)
266
+ ## Performance
237
267
 
238
- | Operation | Throughput | Notes |
268
+ **v1 Python server (baseline single-threaded AOF):**
269
+
270
+ | Operation | Throughput | p99 latency |
239
271
  |---|---|---|
240
- | PUT (Rust napi, per-op FFI) | ~70K/s | FFI-bound; batch path: ~15K writes/s group-commit |
241
- | GET (Rust napi, per-op FFI) | ~330K/s | FFI-bound |
242
- | NQL query (Rust engine) | ~23 µs | faster than pure-Python (~120 µs) |
243
- | Python PUT (AOF + fsync) | ~7K/s | Durable, per-op |
244
- | Python GET (in-process) | ~1.3M/s | Zero socket hop |
272
+ | Sequential PUT | ~23/s | 44 ms |
273
+ | Concurrent PUT (16 workers) | ~92/s | 48 ms |
274
+ | Batch PUT (500 ops/request) | ~520 ops/s | 1.9 ms/op |
275
+ | Point-lookup read (NQL) | ~23/s | 44 ms |
276
+ | Rust napi PUT (FFI) | ~70K/s | |
277
+ | Rust napi GET (FFI) | ~330K/s | — |
278
+
279
+ **v2 DAG Rust server — tokio/axum, no GIL, lock-free per-doc writes:**
280
+ > Benchmarks in progress — target 5,000–50,000 ops/s. Run `python3 tests/test_dag_perf.py` against your own instance.
281
+
282
+ Reproduce with the included benchmark:
283
+
284
+ ```bash
285
+ NEDBD_DAG=1 nedbd --data /tmp/perf &
286
+ python3 tests/test_dag_perf.py --n 10000 --reads 100000
287
+ ```
245
288
 
246
289
  ---
247
290
 
@@ -271,16 +314,49 @@ Encryption: AES-256-GCM at-rest (TMK/DEK double-envelope)
271
314
 
272
315
  ---
273
316
 
317
+ ## nedb-client — lightweight HTTP client
318
+
319
+ Connect to any running nedbd instance from Python or TypeScript without embedding the engine:
320
+
321
+ ```bash
322
+ pip install nedb-engine-client # async Python
323
+ npm install nedb-engine-client # TypeScript / Node.js 18+
324
+ ```
325
+
326
+ ```python
327
+ from nedb_client import NedbClient
328
+
329
+ async with NedbClient("http://127.0.0.1:7070", db="mydb") as db:
330
+ await db.put("blocks", "618000", {"height": 618000})
331
+ rows = await db.query("FROM blocks ORDER BY height DESC LIMIT 10")
332
+ head = await db.head() # BLAKE2b Merkle root — changes on every write
333
+ ok = await db.verify() # tamper-evidence check across all objects
334
+ ```
335
+
336
+ ```typescript
337
+ import { NedbClient } from "nedb-engine-client";
338
+ const db = new NedbClient({ url: "http://127.0.0.1:7070", db: "mydb" });
339
+ await db.put("blocks", "618000", { height: 618000 });
340
+ const rows = await db.query("FROM blocks LIMIT 10");
341
+ ```
342
+
343
+ ---
344
+
274
345
  ## Repo layout
275
346
 
276
347
  ```
277
348
  python/nedb/ reference engine (pure Python — always-works baseline)
278
349
  rust/
279
- nedb-core/ production Rust engine (shared by both runtimes)
350
+ nedb-core/ v1 production Rust engine (shared by both runtimes)
280
351
  nedb-py/ maturin PyO3 binding → PyPI native wheels
281
352
  nedb-node/ napi-rs binding → npm native addons
282
- tests/ engine + concurrent + causal + bitemporal + deploy tests
353
+ nedb-v2/ v2 DAG engine (tokio + axum + BLAKE2b DAG)
354
+ client/
355
+ python/ nedb-client — async Python HTTP client (pip install nedb-engine-client)
356
+ node/ nedb-client — TypeScript HTTP client (npm install nedb-client)
357
+ tests/ engine + concurrent + causal + bitemporal + deploy + perf benchmarks
283
358
  examples/ resp2_python.py resp2_demo.sh
359
+ docs/ index.html reference.html SPEC.md
284
360
  ```
285
361
 
286
362
  ---
@@ -297,7 +373,17 @@ examples/ resp2_python.py resp2_demo.sh
297
373
  - [x] SQL / Redis / MongoDB compatibility adapters
298
374
  - [x] RESP2 wire protocol (redis-cli / redis-benchmark compatible)
299
375
  - [x] Rust native core — napi-rs (npm) + maturin PyO3 (PyPI)
300
- - [x] Self-healing chains (auto-repair structural gaps, detect real tampering)
376
+ - [x] Self-healing AOF auto-truncates corrupt tail on startup, never hangs
377
+ - [x] **v2 DAG engine** — content-addressed Merkle DAG, atomic writes, instant cold start
378
+ - [x] **`nedbd --dag`** — one flag switches to v2 Rust engine; v1 untouched
379
+ - [x] **BLAKE2b Merkle head** — tamper-evident root on every response
380
+ - [x] **Tombstone deletes** — history preserved in DAG, live id removed from index
381
+ - [x] **Auto-migration** — v1 AOF → v2 DAG on first `--dag` startup
382
+ - [x] **nedb-client** — async Python + TypeScript HTTP client (`pip/npm install nedb-client`)
383
+ - [x] **Intel Mac support** — native wheels for `aarch64` + `x86_64` Apple Darwin
384
+ - [ ] In-memory DAG mode — `Db::in_memory()` for zero-disk ephemeral sessions
385
+ - [ ] PyO3 + napi-rs bindings updated to v2 DAG API
386
+ - [ ] NEDB Studio DAG mode toggle
301
387
  - [ ] Merkle inclusion proofs — prove a document existed at a specific time to a third party
302
388
  - [ ] Git-style branching — fork database state, experiment, merge or discard
303
389
  - [ ] Agent Memory SDK — `Memory.remember()` / `Memory.recall()` / `Memory.trace()`
@@ -10,7 +10,7 @@ build-backend = "hatchling.build"
10
10
 
11
11
  [project]
12
12
  name = "nedb-engine"
13
- version = "2.0.5"
13
+ version = "2.0.7"
14
14
  description = "NEDB — a versioned, self-compressing, time-traveling embedded database (replay-protected, idempotent, relational, searchable) with durable AOF persistence and a server daemon (nedbd)."
15
15
  readme = "README.md"
16
16
  requires-python = ">=3.8"
@@ -47,4 +47,4 @@ __all__ = [
47
47
  "wrap_redis", "WrappedRedis",
48
48
  "_native", "__has_native__",
49
49
  ]
50
- __version__ = "2.0.5"
50
+ __version__ = "2.0.7"
File without changes
File without changes