Skip to content

Commit 4b5dd19

Browse files
committed
feat(fsck): add --page-size override, --help, and split exit codes
Split pagedb-fsck.rs into a directory module (cli/run/main) so grammar parsing, execution, and exit-code policy are separately testable. Adds --page-size for stores created at a non-default page size and a --help/-h flag, and gives usage errors, an unreadable store, and an actual integrity failure distinct exit codes (2, 3, 1) instead of one generic non-zero.
1 parent d624869 commit 4b5dd19

7 files changed

Lines changed: 871 additions & 204 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fluxbench = "0.1"
142142

143143
[[bin]]
144144
name = "pagedb-fsck"
145-
path = "src/bin/pagedb-fsck.rs"
145+
path = "src/bin/pagedb-fsck/main.rs"
146146

147147
# These are executable benchmarks, not test harnesses. The cross-engine suite
148148
# is a separate non-default workspace package so normal PageDB tests never

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,19 @@ cargo run --bin pagedb-fsck -- <path> --deep \
6767

6868
The KEK may instead come from `PAGEDB_KEK` and defaults to all zeros. The realm
6969
defaults to all ones; nodedb-lite stores use the all-zero realm shown above.
70-
Argument parsing rejects duplicate flags, unknown options, missing realm
71-
values, and multiple positional KEKs. Inspection disables commit-history
72-
retention and does not rewrite authoritative `main.db` or segment bytes.
70+
Add `--page-size` for a store created at anything other than 4096 bytes, and
71+
`--help` for the full grammar. Inspection disables commit-history retention and
72+
does not rewrite authoritative `main.db` or segment bytes.
73+
74+
Arguments are validated before the store is touched, and each failure class
75+
gets its own exit code so a caller can tell them apart:
76+
77+
| Code | Meaning |
78+
| ---: | --- |
79+
| 0 | Opened cleanly; with `--deep`, the report was clean |
80+
| 1 | An integrity problem was found |
81+
| 2 | The command line was invalid; the store was never opened |
82+
| 3 | The store could not be opened, or the report could not be written |
7383

7484
## Benchmarks
7585

src/bin/pagedb-fsck.rs

Lines changed: 0 additions & 174 deletions
This file was deleted.

0 commit comments

Comments
 (0)