SqlitePersistAdapter (persist/sqlite.ts)

VidBee · database, Database / ORM

* SQLite implementation of PersistAdapter using better-sqlite3. Reference: docs/vidbee-task-queue-state-machine-design.md §9. Operational rules implemented here: - WAL + synchronous=NORMAL on connect. - Single writer: every write goes through this adapter.

// Source: https://github.com/mperkins0155/VidBee | License: MIT | Copyright 2025 VidBee
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * SQLite implementation of PersistAdapter using better-sqlite3.
 *
 * Reference: docs/vidbee-task-queue-state-machine-design.md §9.
 *
 * Operational rules implemented here:
 *   - WAL + synchronous=NORMAL on connect.
 *   - Single writer: every write goes through this adapter.
 *   - transition writes use BEGIN IMMEDIATE.
 *   - PID/pidStartedAt are written synchronously at spawn.
 *   - maintenance() runs `wal_checkpoint(TRUNCATE)` and ages process_journal
 *     entries older than 30 days.
 *
 * The DDL itself is owned by `@vidbee/db/migrations` (added in this PR);
 * this adapter only opens the file and assumes migrations have ru

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key