nedb-engine 2.6.3 → 2.7.1
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.darwin-x64.node +0 -0
- package/nedb.linux-x64-gnu.node +0 -0
- package/nedb.win32-x64-msvc.node +0 -0
- package/nedbd-v2-darwin-arm64 +0 -0
- package/nedbd-v2-darwin-x64 +0 -0
- package/nedbd-v2-linux-x64 +0 -0
- package/nedbd-v2-win-x64.exe +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,6 +155,50 @@ MongoClient(db)["users"].find({"status": "active"}).sort("age", -1).to_list()
|
|
|
155
155
|
|
|
156
156
|
---
|
|
157
157
|
|
|
158
|
+
## Official Python client — talk to nedbd over HTTP
|
|
159
|
+
|
|
160
|
+
Running the daemon? `nedb.client.NedbClient` is the official client for its
|
|
161
|
+
HTTP API — extracted from the battle-tested clients that ran a production
|
|
162
|
+
Redis→NEDB mainnet migration, speaking the full route surface: queries,
|
|
163
|
+
atomic CAS transactions, TTL, indexes, relations, Merkle proofs, and the
|
|
164
|
+
Mongo-compat endpoint. Env-var defaults (`NEDBD_URL`, `NEDBD_TOKEN`,
|
|
165
|
+
`NEDB_DB`) mirror the daemon's own.
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from nedb import NedbClient, PreconditionFailed, op_put
|
|
169
|
+
|
|
170
|
+
c = NedbClient("http://127.0.0.1:7070", db="app", token="s3cret")
|
|
171
|
+
c.ensure_database()
|
|
172
|
+
|
|
173
|
+
c.put("users", "u1", {"id": "u1", "email": "a@b.c"}, idem="signup-u1")
|
|
174
|
+
c.query('FROM users WHERE email = "a@b.c"') # full NQL rides through
|
|
175
|
+
c.query("FROM users AS OF 41") # time-travel included
|
|
176
|
+
|
|
177
|
+
# Atomic all-or-nothing transaction with engine-checked preconditions —
|
|
178
|
+
# the primitive that replaces Redis Lua scripts (if_seq: N = CAS, -1 = create-once)
|
|
179
|
+
doc = c.get_doc("users", "u1") # docs carry _seq
|
|
180
|
+
c.tx([op_put("users", "u1", {**doc, "plan": "pro"}, if_seq=doc["_seq"])])
|
|
181
|
+
|
|
182
|
+
# Contested writes: retry ONLY on PreconditionFailed, capped backoff
|
|
183
|
+
def bump():
|
|
184
|
+
d = c.get_doc("counters", "hits") or {"n": 0}
|
|
185
|
+
return c.tx([op_put("counters", "hits", {"n": d.get("n", 0) + 1},
|
|
186
|
+
if_seq=d.get("_seq", -1))])
|
|
187
|
+
c.cas_retry(bump)
|
|
188
|
+
|
|
189
|
+
# Integrity, verifiable WITHOUT trusting the server
|
|
190
|
+
proof = c.proof(c.log(limit=1)[0]["hash"])
|
|
191
|
+
from nedb import verify_proof; verify_proof(proof) # -> True, locally
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
A CAS miss raises the **same `PreconditionFailed`** (with the same
|
|
195
|
+
`.failures` shape) the embedded engine raises — code written against
|
|
196
|
+
`NEDB.tx` ports to the HTTP client without changing its except-clauses.
|
|
197
|
+
Typed errors throughout: `NedbAuthError`, `NedbNotFound`, `NedbBadRequest`,
|
|
198
|
+
`NedbConflict`, `CasExhausted`.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
158
202
|
## Redis layer-2 — wrap_redis()
|
|
159
203
|
|
|
160
204
|
Already running on Redis? Wrap your connection in one line and gain NEDB features *alongside* your existing Redis app — no migration required.
|
package/nedb.darwin-arm64.node
CHANGED
|
Binary file
|
package/nedb.darwin-x64.node
CHANGED
|
Binary file
|
package/nedb.linux-x64-gnu.node
CHANGED
|
Binary file
|
package/nedb.win32-x64-msvc.node
CHANGED
|
Binary file
|
package/nedbd-v2-darwin-arm64
CHANGED
|
Binary file
|
package/nedbd-v2-darwin-x64
CHANGED
|
Binary file
|
package/nedbd-v2-linux-x64
CHANGED
|
Binary file
|
package/nedbd-v2-win-x64.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nedb-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
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",
|