Skip to main content

Module migrate

Module migrate 

Source
Expand description

Migration toolchain (export / import). See migrate::run_export and migrate::run_import. Migration toolchain: export / import.

Wire format = a RESP command stream of rebuild frames (SET / HSET / RPUSH / SADD / ZADD / PEXPIREAT) — bidirectionally compatible with redis-cli --pipe. Export walks SCAN cursors (per-key point-in-time; SCAN-class consistency). Import pipelines 512 commands per batch with a fsynced progress file for --resume. Every key’s frames start with DEL, so replay REBUILDS the key from scratch — genuinely idempotent for every type (RPUSH would otherwise append on re-import; the round-trip test caught exactly that). No cross-batch atomicity to lose.

Structs§

Export
Run export — walk the keyspace (optionally under prefix) and write rebuild frames to out_path. Returns exported key count. What an export did — including what it did NOT do. The skipped map is the half that used to be invisible: a type with no rebuild verb produced no frames, no error and no mention, so a migration could report success while leaving a whole type behind.
ImportReport
Import stats.

Functions§

run_export
Walk the keyspace (optionally under prefix) and write rebuild frames to out_path, reporting both what went in and what could not.
run_import
Run import — stream src (a RESP command file) into the server, PIPELINE commands per batch. The progress file <src>.progress records the safely-applied byte offset after every batch (fsynced); resume starts there. Idempotent replay.