nedb-engine 1.0.5 → 1.2.0
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 +44 -0
- package/nedb.darwin-arm64.node +0 -0
- package/nedb.linux-x64-gnu.node +0 -0
- package/nedb.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,6 +96,50 @@ MongoClient(db)["users"].find({"status": "active"}).sort("age", -1).to_list()
|
|
|
96
96
|
|
|
97
97
|
---
|
|
98
98
|
|
|
99
|
+
## Redis layer-2 — wrap_redis()
|
|
100
|
+
|
|
101
|
+
Already running on Redis? Wrap your connection in one line and gain NEDB features *alongside* your existing Redis app — no migration required.
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import redis, json
|
|
105
|
+
from nedb import wrap_redis
|
|
106
|
+
|
|
107
|
+
r = wrap_redis(redis.Redis("localhost", 6379), db_name="rideshare")
|
|
108
|
+
|
|
109
|
+
# Step 1 — register: map Redis key globs to NEDB collections (chainable)
|
|
110
|
+
(r.nedb
|
|
111
|
+
.register("driver:*", collection="driver", value_parser=json.loads)
|
|
112
|
+
.register("trip:*", collection="trip", value_type="hash")
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Step 2 — backfill: import all existing Redis data into NEDB in one pass
|
|
116
|
+
imported = r.nedb.backfill() # → int (keys imported)
|
|
117
|
+
|
|
118
|
+
# Step 3 — shadow: all future r.set/hset/... auto-chain into NEDB
|
|
119
|
+
r.nedb.shadow_writes = True
|
|
120
|
+
|
|
121
|
+
# ─── Alice's app keeps running — zero changes ───────────────────────────
|
|
122
|
+
r.set("driver:d1", json.dumps({"name": "Bob", "status": "active"})) # ← shadowed
|
|
123
|
+
r.hset("trip:t1", mapping={"status": "en_route", "driver_id": "d1"}) # ← shadowed
|
|
124
|
+
|
|
125
|
+
# ─── New features available on the same connection ──────────────────────
|
|
126
|
+
r.nedb.query('FROM driver WHERE status = "active" ORDER BY lat ASC')
|
|
127
|
+
r.nedb.verify() # → True (every write chain-verified)
|
|
128
|
+
r.nedb.head() # → 64-char BLAKE2b commitment hash
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Isolation guarantee:** NEDB never writes to Alice's namespace. It owns only:
|
|
132
|
+
|
|
133
|
+
| Key | Type | Purpose |
|
|
134
|
+
|-----|------|---------|
|
|
135
|
+
| `nedb:{db_name}:oplog` | Redis Stream | append-only op log |
|
|
136
|
+
| `nedb:{db_name}:snapshot` | Redis Hash | checkpoint |
|
|
137
|
+
| `nedb:{db_name}:meta` | Redis Hash | index config |
|
|
138
|
+
|
|
139
|
+
See [`examples/fakeredis_demo.py`](examples/fakeredis_demo.py) for a full local demo (no Redis server needed).
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
99
143
|
## Node.js
|
|
100
144
|
|
|
101
145
|
```javascript
|
package/nedb.darwin-arm64.node
CHANGED
|
Binary file
|
package/nedb.linux-x64-gnu.node
CHANGED
|
Binary file
|
package/nedb.win32-x64-msvc.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nedb-engine",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "NEDB — hash-chained, time-traveling, bi-temporal embedded database with Rust native core. SQL, Redis, MongoDB adapters. Causal Write Provenance. RESP2 wire protocol.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|