1 Commits
Author SHA1 Message Date
sneak dbc9afb4ef Stream report and trees instead of loading every record (closes #14)
check / check (push) Successful in 2m41s
report now has SQLite group the records and put the rows in report
order, helped by a new files_signature index on (size, head, tail,
content), and writes each row as it reads it. trees reads the records
in path order, where all the paths under a directory come together, so
it computes each directory's digest as soon as the stream leaves it and
keeps only its path, parent, digest and totals. Output is unchanged.

The tests that called the removed in-memory grouping functions now group
records stored in a database. New tests check that both commands give
the same output whatever order the records were inserted in, and that a
stdout failure partway through a long report is reported as one.

Model: opus-5-5
2026-10-04 03:17:47 +00:00
+4 -4
View File
@@ -122,12 +122,12 @@ func TestReportStdoutFailsWhileReading(t *testing.T) {
// still being read, not at the final flush.
dir := "/" + strings.Repeat("d", 4096)
var recs []scanRec
for i := range ioBufSize / len(dir) {
recs = append(recs, scanRec{
recs := make([]scanRec, ioBufSize/len(dir))
for i := range recs {
recs[i] = scanRec{
size: 1, head: "h", tail: "t", content: "c",
path: fmt.Sprintf("%s/%d", dir, i),
})
}
}
t.Setenv(databaseEnv, seedDatabase(t, recs))