Single-file page store. One writer, crash recovery from a write-ahead log.
import {
"Nanaloveyuki/vellum@0.3.0",
}import {
"Nanaloveyuki/vellum",
"moonbitlang/async",
}
pkgtype(kind: "executable")async fn main {
let db = @vellum.open("notes.db")
defer db.close()
let txn = db.begin()
txn.put(b"hello", b"vellum")
txn.commit()
db.close()
let again = @vellum.open("notes.db")
defer again.close()
let read = again.begin()
match read.get(b"hello") {
Some(value) => println(value.to_string())
None => println("missing")
}
read.abort()
}| 工作负载 | 0.2.0 | 0.3.0 |
|---|---|---|
| 4096 键、32 字节值:5 万热点查询 | 186–190 | 15–17 |
| 同规模:1 万同值写入 | 74–77 | 16–19 |
| 4096 键、3000 字节值:约 16 MiB 建库提交 | 337–357 | 58–61 |
| 同规模:5 万随机查询 | 275–300 | 64–70 |
moon run src/cmd/bench --target native --releasemoon fmt --check
moon check --target native --deny-warn
moon test --target native
moon test --target wasm-gc -p Nanaloveyuki/vellumpub struct Db {
// private fields
}pub struct Txn {
// private fields
}Install
Download zipSingle-file page store. One writer, crash recovery from a write-ahead log.