]> git.giacomolli.uk - onechat/commit
Build the nodes from a queue in the background
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Fri, 6 Nov 2026 14:44:12 +0000 (11:44 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Fri, 6 Nov 2026 14:44:12 +0000 (11:44 -0300)
commite754189bc2aa32ec43a5dc4ee01d7a6c6e4e388c
tree0e31173a532d1fa4fa1f4823510d60426742514b
parente5343bd4c3ec69192e92f4be339b855eef36b6ec
Build the nodes from a queue in the background

The core keeps the nodes that are ready for a model build in a queue and
never scans the tree for work. A leaf joins the queue when its message
is too long to be its own node. A merge joins when both of its children
are built and their texts do not fit in one node. A parent that fits is
built at once, up the tree.

At most 8 builds run at once. A leaf starts once fewer than 8 leaves
before it are unbuilt. Leaves start before merges, oldest first, because
a turn waits for the leaves of all earlier messages. A failed build
starts again at the next message. Each build gets its compaction view
and its input, the source of a leaf or the two child lines of a merge.

The model stays behind a small Summarizer interface, and the tests use a
fake one. The start reads the log and the tree once to fill the queue
again, and builds the free nodes that a crash left out.

Issue: beb9a70
memory.go
memory_test.go
queue.go [new file with mode: 0644]
tree.go