@cbnsndwch/zero-sources

zero-watermark-zqlite

SQLite-based watermark storage for Zero Sources

SQLite-based watermark storage implementation for tracking client synchronization progress.

Overview

The zero-watermark-zqlite library provides a lightweight, file-based watermark storage solution using SQLite. Perfect for single-instance deployments or development environments.

Key Features

  • File-Based: No external dependencies
  • Fast: In-memory mode available
  • Reliable: ACID transactions
  • Portable: Single file database
  • Simple: Easy setup and configuration

Installation

pnpm add @cbnsndwch/zero-watermark-zqlite

Quick Start

import { ZQLiteWatermarkStorage } from '@cbnsndwch/zero-watermark-zqlite';

const storage = new ZQLiteWatermarkStorage({
    filename: './data/watermarks.db'
});

await storage.init();

// Store watermark
await storage.setWatermark('client-123', 'table-1', '1234567890');

// Retrieve watermark
const watermark = await storage.getWatermark('client-123', 'table-1');

Configuration

const storage = new ZQLiteWatermarkStorage({
    filename: './data/watermarks.db', // Database file path
    memory: false, // Use in-memory database
    verbose: false // Enable SQL logging
});

Use Cases

  • Development: Local development and testing
  • Single Instance: Small deployments
  • Embedded: Applications with embedded database
  • Serverless: Lightweight deployments

How was this page?