brainy/src/db
David Snelling 300d9f2a16 feat: flush() never compacts — history maintenance moves to close() with bounded passes
flush() is durability work: it must cost what the current window's
deltas cost, never what the history backlog costs. Under adaptive
retention the byte budget derives from free memory, so bulk-load
pressure shrank the budget exactly at peak write volume and flush paid
actual reclaim inline — a production deployment measured single writes
blocked 25-191s behind reclaim-on-flush.

- flush() no longer calls autoCompactHistory(); close() is THE
  auto-compaction site (already ran there; now alone).
- Every auto pass is time-bounded (CLOSE_COMPACTION_BUDGET_MS = 5s):
  reclamation is oldest-first, so an early stop is a consistent prefix
  and the next pass resumes. Explicit compactHistory() gains an
  optional timeBudgetMs for caller-chosen maintenance windows.
- Documented trade stated where operators read: a long-lived writer
  that never closes accumulates history until its next explicit
  compactHistory() — predictable writes, explicit maintenance.

Pins: flush-never-reclaims + close-reclaims-durably (db-mvcc), bounded
pass stops-then-resumes as a consistent prefix (generationStore unit).
2026-07-19 12:04:39 -07:00
..
db.ts docs: external-backups/sparse-storage guide + generation fact log concept 2026-07-16 10:30:32 -07:00
errors.ts fix: refuse writes when single-op history cannot be made durable 2026-07-13 09:31:25 -07:00
factLog.ts feat: committedGeneration capability + pinned durability/stability contracts 2026-07-15 12:44:52 -07:00
familyStamp.ts feat: provider access to the fact log + shared stamp verifier via internals 2026-07-15 12:36:27 -07:00
generationStore.ts feat: flush() never compacts — history maintenance moves to close() with bounded passes 2026-07-19 12:04:39 -07:00
portableGraph.ts refactor(8.0): rename BackupData → PortableGraph (the type is interchange, not a backup) 2026-06-19 12:37:23 -07:00
stableEqual.ts feat(8.0): temporal range verbs — diff, history, since(gen|Date), asOf{exclusive}, transactionLog window 2026-06-19 13:21:02 -07:00
types.ts feat: flush() never compacts — history maintenance moves to close() with bounded passes 2026-07-19 12:04:39 -07:00
whereMatcher.ts refactor(8.0): remove the 4 deprecated query-operator aliases (clean break) 2026-06-29 10:29:20 -07:00