/** * Bulk import from Redis with checkpointing, resume, and throttling (SPEC_F §F.7). */ import type { MigrationRun } from './registry.ts'; import type { MigrationRedisClient } from './redis-client.ts'; /** Run row plus throughput and ETA fields, passed to `onProgress`. */ export interface BulkProgress extends MigrationRun { elapsed_seconds: number; keys_per_second: number; /** Null when no estimate was given. */ estimated_total_keys: number | null; remaining_keys_estimate: number | null; eta_seconds: number | null; progress_pct: number | null; } export interface BulkImportOptions { sourceUri: string; /** PRAGMA preset. Default `'default'`. */ pragmaTemplate?: string; /** SCAN COUNT hint. Default 1000. */ scan_count?: number; /** Max requests/s; 0 = no limit. Default 0. */ max_rps?: number; /** Number of concurrent key imports. Default 1. */ concurrency?: number; /** Optional key count estimate used for ETA/progress. Default 0. */ estimated_total_keys?: number; /** Keys per checkpoint. Default 200. */ batch_keys?: number; /** Bytes per checkpoint. Default 64MB. */ batch_bytes?: number; /** Seconds between checkpoints. Default 30. */ checkpoint_interval_sec?: number; /** true: start from 0 or continue from checkpoint; false: always start from 0. Default true. */ resume?: boolean; /** Called after checkpoint with run row. */ onProgress?: (run: BulkProgress) => void; } /** * Run bulk import: SCAN keys from Redis, import into RespLite DB with checkpointing. * On SIGINT/SIGTERM, checkpoint progress, set run status to ABORTED, close DB and rethrow. * DB is always closed in a finally block (graceful shutdown when process is interrupted). */ export declare function runBulkImport(redisClient: MigrationRedisClient, dbPath: string, runId: string, options?: BulkImportOptions): Promise;