attach

fun attach()

Builds derived data for segments that have none, in one pass over them.

Run by open unless RaboshOptions.backfill is false, and the call a caller who set it to false uses to finish the job later. Idempotent and cheap to repeat: a segment already covered by every layer opens no observation and is not read.

The shape is what makes it one pass rather than two. Each layer is attached without backfilling — which loads its sidecars and reclaims what it can — then a single DocumentStore.backfill feeds the composite, and then each layer is attached again. That last step is not redundant: both layers deliberately re-read the live segment set after their own scan, because a compaction landing during a long backfill makes the pre-scan set wrong for reclamation, and the facade preserves that rather than shortcutting it.