tracker
All repositories: gitoria
2.7 KB
# `hl:mpackdb` — the MessagePack file databaseA document store in plain files. Server realm. The class surface and itsgenerated API docs live in `MPackDB.hl` and `cursor.hl`(`projects/homepage/docs/mpackdb.md`).```hybrielimport { MPackDB } from 'hl:mpackdb'db = new MPackDB(file = 'users.db', primaryKey = '*id', indexes = ['!email', 'age'])id = db.put({ name = "Alice"; email = "[email protected]"; age = 30; }) \\ 1```## Primary keys| declaration | key | generated by `put()` ||---|---|---|| `*name` | a number | the table's counter: **1, 2, 3, …** || `@name` | a string | a random 12-character id || `name` | a string | nothing — the record must carry it |**A fresh `*id` table starts at 1** (ticket #4, the creator's ruling "start at1"). The counter is stored as `nextId` in `<base>.meta.json`, and an existingtable keeps counting from its stored value. A table written before this ruletherefore goes on from wherever it was, and its record 0 remains record 0.A record put with an explicit key takes that key if it is free, 0 included.## One open table per process (ticket #110)Within one process, a table path has **one** open table, shared by every`open()` — another module instance, another realm, it doesn't matter, theyall get the same handle. The file is never compacted or rewritten while ahandle on it is live; compaction happens only when asked for explicitly(`compactNow()` / `#handle.compact()`) or when the **last** handle on thatpath closes. A second `open()` of an already-open table ignores its own`primaryKey`/`indexes`/`compact` arguments — the schema was fixed by whoeveropened it first.This matters because compaction rewrites `<base>.mpack` and shifts everyrecord after the first tombstone to a new offset. Before this rule, a second`open()` from anywhere in the process ran its own compact-on-open (ticket#21) against the same file, and the first handle's already-looked-up offsetswent stale under it — reads through the first handle then missed ormisread records until something compacted again. Related: ticket #21("opening a table rewrote its files").## Compatibility with the JS mpackdbThe on-disk format is the JS mpackdb 1.0.7 format: `<base>.mpack`,`<base>.meta.json`, one `<base>.<field>.txt` per index, `<base>.idxstate.json`and the `<base>.lock` protocol. Either side reads and changes the other'sfiles. The first id is not part of the format; `nextId` is. Therefore:- a table the JS mpackdb created carries `nextId` and keeps its sequence here,even when that sequence started at 0;- a table Hybriel created carries `nextId` too, and the JS mpackdb continues it;- the one divergence is a table with **no** `.meta.json` yet: Hybriel's firstid is 1, the JS mpackdb's is 0.The other documented divergences are listed at the top of `engine.zig`.
Branches
- mainmain branch
Latest commits
- 1ed5457etracker#20 + #21 (mission 068): typed headings "<Type> | <name>" in type colours; TV titles split into Series (/series) and Shows (/shows) by TMDB type + Reality/Talk/News genres — kind stored by sync/import/adult backfill + new kind backfill (resumes), /movies/<slug>, /shows/<slug> of a series/movie → 301, /my/series + /my/shows, home 5 tiles + 3 rows, search/filmography labels; gates kinds 32 + browser 266, tests/realdata-068.mjs, tools/count-kinds.hl, docs/kinds.md, README + STATUSmre
- fa1f9dfatracker#29 (mission 063): unwatched check muted grey outline + check (accent only on hover), watched stays solid — no code regression, the accent outline read as ticked; gate checks real checks visibly (computed style + screenshot pixel) on /my/unwatched, show, movie, /my/movies; gate 266, tests/realdata-063.mjs, README + STATUSmre
- d8b12d67tracker#27 (mission 060): short ids for movies, series and persons — old 702 kept (data/old-short-ids.json), new random [a-z0-9]{5} unique across both, claimed at creation, background backfill (resumes), shown under poster/photo, /<shortId> → 301; gate 259, tests/realdata-060*, README + STATUSmre
- f14db671tracker#22-#25 (mission 058): episode air dates, season check = all episodes watched, movie watched check (+ /my/movies count), /genres/<genre> pages (movies + series, newest first, paginated); gate 238, tests/realdata-058.mjs, README + STATUSmre
- 1704ec45tracker#17 (mission 057): season caret down/up, skeleton rows while a season loads, sessionless showSeasonEpisodes face (no page re-mount), client-only close; gate 214, tests/realdata-057.mjs, README + STATUSmre
- f2fe3e36mission 056: README + STATUS (merge, fixes, Hybriel 8590df63, real-data check), tests/realdata-056.mjs, tools/check-public-slugs.hlmre
- f40c250emission 056: re-vendor hybriel master 8590df63 (#121, #122); an adult title's page is Not found for non-followers; gate: leave the page before stopping the servermre
- 2b7fdd6cmission 056: signed-out header one row on phones ("Log in", nowrap), backfill skips adult titles' posters, gate checksmre
- 2c53d5efMerge branch 't16-person' (tracker#16 person pages) into main; filmography shows only public titles (054 adult flag), gate race fix (backfill start line)mre
- c171227emission 054: hide adult/unknown titles from the public lists and the search; in-app adult-flag backfill (TMDB details + poster per title, resumes), gate + real-data proofmre
- 139fafd8tracker#16: short bio (4 lines, click = all), real-data check script, README + STATUSmre
- 93be9476tracker#16: person pages /person/<slug> with the filmography fetched from TMDB on the first visit (step by step), gatemre
- 47a3cae6STATUS: mission 053 merge commit idsmre
- dcc5eecaMerge branch 't14-search'mre
- 03edc783Merge branch 't15-tvmaze'mre
- 71b46345tracker#15: numbering check by date or title, placeholder titles in other languages, docs + real-data proofmre
- 6bb2daf1tracker#13: homepage (tiles, intro, latest movies/shows), /shows, /movies/page/N, /my/movies; lists cached in memorymre
- b8bd1157tracker#14: README + STATUS (search, real-data numbers, gate, merge notes)mre
- 65c694a8tracker#14: search — header magnifier, /search/<text> (in-memory word-prefix index over titles + people), Fetch from web (TMDB search/multi, ours left out), Add = import via syncShow; gate +25 checks, real-data scriptmre
- 34f2c15btracker#15: TVmaze merge in the sync (gaps only: new episodes/seasons, empty titles/air dates; numbering check), fake TVmaze episodes + gatemre