@quatrain/queue-sqlite
v1.0.2
Published
SQLite Queue Adapter for the @quatrain/queue namespace
Downloads
242
Readme
@quatrain/queue-sqlite
SQLite Task Queue Adapter for the @quatrain/queue namespace.
This package provides a robust local-first persistent queue adapter using SQLite. It is designed to queue tasks locally in memory or write them persistently on disk, processing them sequentially or concurrently under unprivileged user execution constraints.
Features
- Local Persistence: Save tasks to a local SQLite database (
:memory:or persistent file). - Concurrency Locking: Utilizes transactions and
BEGIN IMMEDIATEstatements to prevent multi-process locking conflicts. - Task Lifecycle Management: Supports progress reporting, task retries, deletion, and query utilities.
- Agnostic Interface: Conforms strictly to Quatrain Core's
AbstractQueueAdapterspecification.
Installation
yarn add @quatrain/queue-sqliteConfiguration
Initialize the adapter with a path to your SQLite database file:
import { Queue } from '@quatrain/queue';
import { SQLiteQueueAdapter } from '@quatrain/queue-sqlite';
const queueDbPath = './data/queue.sqlite';
Queue.addQueue(new SQLiteQueueAdapter({
config: { database: queueDbPath }
}), 'default', true);