Update plan: use rsync --itemize-changes for change detection, no dir walk

This commit is contained in:
2026-03-07 01:07:21 +00:00
parent 33bd288f9e
commit 84801a7971

18
PLAN.md
View File

@@ -20,7 +20,7 @@ backup storage grow proportionally to what actually changed.
1. **Clear PEND** — remove all contents
2. **rsync PREV → PEND** — seed locally (fast)
3. **rsync SOURCE → PEND** — apply remote changes (only diffs travel over the wire)
4. **Generate delta**diff PREV vs PEND, produce per-file deltas + manifest
4. **Generate delta**parse rsync itemize output to get change list, produce per-file deltas + manifest
5. **Commit delta** — write to DELTAS atomically
6. **Promote PEND → PREV** — swap working area to become new base
@@ -47,6 +47,22 @@ State.json is a recoverable cache — can be reconstructed by scanning DELTAS.
- `DELTAS/N/` exists but `last_complete` is N-1 → finish promotion, update state
- state.json missing → reconstruct from directory scan
## Change Detection
No directory walk needed. rsync SOURCE→PEND is run with `--itemize-changes`, producing a
machine-readable list of exactly what changed. Output is captured (not streamed) and parsed:
| rsync prefix | Meaning |
|-------------|----------|
| `>f+++++++++` | New file |
| `>f.st......` | Modified file (any combination of change flags) |
| `*deleting` | Deleted file |
| `cd+++++++++` | New directory (ignored for delta purposes) |
Lines starting with `>f` or `*deleting` are extracted. The path is the remainder after the
11-character itemize code + space. This becomes the change list fed directly into delta generation
— no separate directory walk required.
## Delta Format
Pluggable backend interface with two operations: