picovolt 1.7.0 → 1.8.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  # PicoVolt (PVDB)
2
2
 
3
3
  [![CI](https://github.com/MiniJe/picovolt/actions/workflows/ci.yml/badge.svg)](https://github.com/MiniJe/picovolt/actions/workflows/ci.yml)
4
- [![Version](https://img.shields.io/badge/version-1.7.0-blue.svg)](CHANGELOG.md)
4
+ [![crates.io](https://img.shields.io/crates/v/picovolt.svg)](https://crates.io/crates/picovolt)
5
5
  [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
6
- ![Status: 1.0 stable](https://img.shields.io/badge/status-1.0%20stable-brightgreen.svg)
6
+ ![Status: stable 1.x](https://img.shields.io/badge/status-stable%201.x-brightgreen.svg)
7
7
  [![GitHub stars](https://img.shields.io/github/stars/MiniJe/picovolt?style=social)](https://github.com/MiniJe/picovolt)
8
8
 
9
- PicoVolt is an embedded database engine written from scratch in Rust. As of 1.0
10
- its public API and on-disk format are stable under Semantic Versioning. It is
11
- young software and has not had an external security audit, so review it and keep
12
- backups before trusting it with data you cannot regenerate.
9
+ PicoVolt is an embedded database engine written in Rust. Its 1.x public API and
10
+ on-disk format are stable under Semantic Versioning. It is young software and
11
+ has not had an external security audit, so review it and keep backups before
12
+ trusting it with data you cannot regenerate.
13
13
 
14
14
  If PicoVolt is useful to you, consider starring the repository on GitHub. It is
15
15
  the simplest way to help others discover the project.
@@ -18,26 +18,20 @@ The engine decouples query logic from storage representation through a
18
18
  Virtualization Layer Engine (VLE) that shifts between two on-disk shapes:
19
19
 
20
20
  - **Development mode:** a `.pv/` workspace of mutable, append-only chunk files
21
- plus a content-addressed blob store, friendly to git and code review.
21
+ plus a content-addressed blob store and inspectable manifest.
22
22
  - **Production mode:** a single contiguous, memory-mappable `.pvdb` file produced
23
23
  by `pv_bake()`.
24
24
 
25
- Pages are chameleon. Hot data lands in a slotted row layout for O(1) appends, and
26
- idle pages can be transposed into a packed columnar layout for compression and
27
- cache efficiency.
25
+ New records use a slotted row layout for O(1) appends. Idle pages can be
26
+ transposed into a packed columnar layout for compression and cache efficiency.
28
27
 
29
28
  ## Status
30
29
 
31
- The engine is built out across four phases, all implemented, with over 180 unit and
32
- integration tests plus doctests passing and a clean `cargo clippy -D warnings` on
33
- Linux and Windows. Changes are tracked in [CHANGELOG.md](CHANGELOG.md).
34
-
35
- | Phase | Scope | Status |
36
- |-------|-------|--------|
37
- | 1 | Core memory layouts and error taxonomy | Done |
38
- | 2 | Page engine, CAS dedup, compression, VLE router | Done |
39
- | 3 | MVCC and snapshot isolation, WASM runtime | Done |
40
- | 4 | Public surface (`pv_open_dev` / `pv_open_prod` / `query` / `pv_bake`) | Done |
30
+ The current stable release is exercised by a 240+ test Rust suite plus doctests
31
+ and maintained-binding integration tests. CI also enforces formatting and
32
+ warning-free Clippy builds on Linux and Windows. Shipped changes are tracked in
33
+ [CHANGELOG.md](CHANGELOG.md), and the remaining work toward 2.0 is tracked in
34
+ [ROADMAP.md](ROADMAP.md).
41
35
 
42
36
  ### Module map
43
37
 
@@ -50,7 +44,7 @@ Linux and Windows. Changes are tracked in [CHANGELOG.md](CHANGELOG.md).
50
44
  | [`storage/cache.rs`](src/storage/cache.rs) | bounded LRU buffer pool (enables larger-than-RAM reads) |
51
45
  | [`storage/cas.rs`](src/storage/cas.rs) | BLAKE3 content-addressable dedup (memory, dev-files, mmap) |
52
46
  | [`storage/compress.rs`](src/storage/compress.rs) | Delta-Z, LEB128 varints, dictionary bit-packing |
53
- | [`storage/index.rs`](src/storage/index.rs) | in-memory ordered secondary index (value to record addresses; point and range) |
47
+ | [`storage/index.rs`](src/storage/index.rs) | ordered secondary-index query structure and its persisted value/address encoding (point and range) |
54
48
  | [`storage/record.rs`](src/storage/record.rs) | row and record-body serialization with CAS interception |
55
49
  | [`storage/vle.rs`](src/storage/vle.rs) | dev directory store, owned prod snapshot, streamed reads, `bake` |
56
50
  | [`engine/mvcc.rs`](src/engine/mvcc.rs) | transaction clock and snapshot visibility |
@@ -117,18 +111,33 @@ cargo run --release --example repl # interactive SQL shell (pvsql)
117
111
  cargo run --release --example bench # evaluation harness across modes and workloads
118
112
  ```
119
113
 
120
- Install the first-class CLI with `cargo install picovolt`, then use `pv query`,
121
- `pv inspect`, `pv history`, `pv import`, `pv export`, and `pv bake`. Copyable
122
- Rust, Python, Go, Node, and browser projects are in [`starters/`](starters/README.md); supported adapters
123
- are catalogued in [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md).
114
+ Install the full CLI with `cargo install picovolt --features data-tools`, then use `pv query`,
115
+ `pv inspect`, `pv history`, `pv diff`, `pv import`, `pv export`, and `pv bake`.
116
+ Parquet/SQLite conversion, query explanations, inspection, resumable baking,
117
+ and dataset signing are documented in [Data tools](docs/DATA_TOOLS.md).
118
+
119
+ Compare two MVCC snapshots with:
120
+
121
+ ```sh
122
+ pv diff ./data users --from 42 --to 57
123
+ pv diff ./data users --from 42 --to 57 --format jsonl
124
+ ```
125
+
126
+ CSV is the default and identifies each row with an `_change` column. JSONL uses
127
+ `{"change":"added|removed","row":{...}}`. The diff is deterministic and
128
+ duplicate-aware; an update is represented as a removed row followed by an added
129
+ row. Copyable Rust, Python, Go, Node, and browser projects are in
130
+ [`starters/`](starters/README.md); supported adapters are catalogued in
131
+ [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md).
124
132
 
125
133
  SQL supports the normal PicoVolt CRUD and schema statements plus projection,
126
- filters, aggregates, grouping, time travel, ordering, and pagination. The 1.7
127
- query surface adds `AS`/bare table aliases, N-table equality `INNER`/`LEFT`
128
- joins, searched `CASE WHEN`, and the focused `LOWER`, `UPPER`, `TRIM`, `LENGTH`,
129
- `ABS`, `COALESCE`, and `NULLIF` scalar functions. Schema-light types, literal
130
- defaults, named inserts, and persisted `CHECK` constraints cover common adapter
131
- DDL. See the precise syntax, examples, type behavior, and deliberate limits in
134
+ filters, aggregates, grouping, time travel, ordering, and pagination. The
135
+ current query surface includes `AS`/bare table aliases, N-table equality
136
+ `INNER`/`LEFT` joins, searched `CASE WHEN`, and the focused `LOWER`, `UPPER`,
137
+ `TRIM`, `LENGTH`, `ABS`, `COALESCE`, and `NULLIF` scalar functions. Schema-light
138
+ types, literal defaults, named inserts, and persisted `CHECK` constraints cover
139
+ common adapter DDL. See the precise syntax, examples, type behavior, and
140
+ deliberate limits in
132
141
  [`docs/SQL.md`](docs/SQL.md). Rust callers can cache `Database::prepare(...)`
133
142
  templates; C, WebAssembly, JavaScript, Python, and Go expose the same reusable
134
143
  prepared-statement lifecycle. Callers can use explicit transactions or atomic
@@ -138,10 +147,10 @@ Durability is selectable via `Database::set_durability` (`Fast` OS-cache default
138
147
  or crash-safe `Sync` with fsync and an atomic manifest).
139
148
 
140
149
  Measured results and the methodology are in [BENCHMARKS.md](BENCHMARKS.md). In
141
- short, PicoVolt is a page-backed engine with O(1) durable appends (autocommit
150
+ short, PicoVolt is a page-backed engine with O(1) filesystem appends (autocommit
142
151
  around 33k rows/s, linear), larger-than-RAM reads through a bounded buffer pool (a
143
152
  667-page dataset serves from a 16-page pool), ordered secondary indexes (point
144
- lookups roughly 11,000 times faster than a scan, plus range predicates), MVCC
153
+ lookups roughly 6,100 times faster than a scan, plus range predicates), MVCC
145
154
  time-travel, opt-in crash-safe durability (`Durability::Sync`), and a fast
146
155
  compile-and-publish path (CAS dedup, columnar compression, memory-mappable
147
156
  single-file artifacts). Current limits include full-workspace transaction
@@ -155,7 +164,8 @@ general SQL planner, and no concurrent writers.
155
164
  | **Rust** (crates.io) | `cargo add picovolt` |
156
165
  | **JavaScript / npm** (WebAssembly, browser and Node) | `npm install picovolt` |
157
166
  | **Python** (native wheels) | `python -m pip install picovolt` |
158
- | **C / Go** (native, via the C ABI) | `cargo build --release --features capi`, then see [`bindings/`](bindings) |
167
+ | **Go** (`database/sql` and direct API) | `go get github.com/MiniJe/picovolt/bindings/go@latest`, then provide the matching native C ABI library described in [`bindings/go/`](bindings/go) |
168
+ | **C** | Download the matching `picovolt-capi-*` bundle from the [latest release](https://github.com/MiniJe/picovolt/releases/latest), or run `cargo build --release --features capi` |
159
169
  | **In-memory** (native, no filesystem) | `Database::open_memory()`, export with `bake_to_bytes()` |
160
170
 
161
171
  PicoVolt runs in the browser through its in-memory backend plus an OPFS persistence
@@ -172,13 +182,14 @@ binding. The bindings suit embedded use, not a concurrent server's primary store
172
182
 
173
183
  All bindings accept positional `?` parameters
174
184
  (`db.query("... WHERE id = ?", [1])`), bound as safely-escaped SQL literals. For
175
- a familiar surface, drop-in adapters are provided: a `better-sqlite3`-style
176
- JavaScript API (`import Database from "picovolt/sqlite"`), a Python DB-API 2.0
177
- module (`import picovolt.dbapi2 as sqlite`), and the Go `database/sql` driver
178
- ([`bindings/go/pvsql`](bindings/go/pvsql)). Shared limits include positional `?`
179
- only and the intentionally compact SQL grammar; JavaScript and in-memory Rust
180
- also expose rollback-capable transaction wrappers. Native bindings expose the
181
- same transaction lifecycle through the C ABI.
185
+ a familiar surface, PicoVolt provides a `better-sqlite3`-inspired JavaScript API
186
+ (`import Database from "picovolt/sqlite"`), a Python DB-API 2.0 module
187
+ (`import picovolt.dbapi2 as sqlite`), and a Go `database/sql` driver
188
+ ([`bindings/go/pvsql`](bindings/go/pvsql)). These are interface adapters, not
189
+ drop-in compatibility layers: shared limits include positional `?` only and the
190
+ intentionally compact SQL grammar. JavaScript and in-memory Rust also expose
191
+ rollback-capable transaction wrappers. Native bindings expose the same
192
+ transaction lifecycle through the C ABI.
182
193
 
183
194
  ## Server mode
184
195
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "picovolt",
3
3
  "type": "module",
4
- "description": "PicoVolt (PVDB): a polymorphic embedded database engine in Rust.",
5
- "version": "1.7.0",
4
+ "description": "Embedded SQL database with MVCC history and single-file deployment",
5
+ "version": "1.8.0",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/MiniJe/picovolt"
9
+ "url": "git+https://github.com/MiniJe/picovolt.git"
10
10
  },
11
11
  "files": [
12
12
  "picovolt_bg.wasm",
@@ -18,6 +18,7 @@
18
18
  "worker.js"
19
19
  ],
20
20
  "main": "picovolt.js",
21
+ "homepage": "https://github.com/MiniJe/picovolt",
21
22
  "types": "picovolt.d.ts",
22
23
  "sideEffects": [
23
24
  "./picovolt.js",
package/picovolt_bg.wasm CHANGED
Binary file
package/sqlite.js CHANGED
@@ -1,5 +1,6 @@
1
- // A better-sqlite3-style synchronous API over PicoVolt's WebAssembly engine, so
2
- // code written for better-sqlite3 can use PicoVolt with minimal change:
1
+ // A better-sqlite3-inspired synchronous API over PicoVolt's WebAssembly engine.
2
+ // It follows the familiar prepare/run/get/all shape while retaining PicoVolt's
3
+ // focused SQL surface:
3
4
  //
4
5
  // import Database from "picovolt/sqlite";
5
6
  // const db = new Database();