Update plan: use rsync --itemize-changes for change detection, no dir walk
This commit is contained in:
18
PLAN.md
18
PLAN.md
@@ -20,7 +20,7 @@ backup storage grow proportionally to what actually changed.
|
|||||||
1. **Clear PEND** — remove all contents
|
1. **Clear PEND** — remove all contents
|
||||||
2. **rsync PREV → PEND** — seed locally (fast)
|
2. **rsync PREV → PEND** — seed locally (fast)
|
||||||
3. **rsync SOURCE → PEND** — apply remote changes (only diffs travel over the wire)
|
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
|
5. **Commit delta** — write to DELTAS atomically
|
||||||
6. **Promote PEND → PREV** — swap working area to become new base
|
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
|
- `DELTAS/N/` exists but `last_complete` is N-1 → finish promotion, update state
|
||||||
- state.json missing → reconstruct from directory scan
|
- 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
|
## Delta Format
|
||||||
|
|
||||||
Pluggable backend interface with two operations:
|
Pluggable backend interface with two operations:
|
||||||
|
|||||||
Reference in New Issue
Block a user