pub fn spawn_worker_v2(
index: Arc<dyn MetadataIndex>,
config: PrefetchConfig,
fetcher: Arc<dyn PrefetchFetcher>,
emit_outcome: Arc<dyn Fn(&PrefetchFetchOutcome) + Send + Sync>,
) -> PrefetchWorkerExpand description
Spawn the v2 worker that actually fetches the top-K each cycle.
Per cycle:
- Snapshot the metadata index + score per RFC 0008 ยง6.
- Take top-K candidates.
- Filter out candidates already present in the local flat cache.
- For each remaining: call
fetcher.fetch_block(namespace, key)sequentially. On error, log + continue. - Emit a per-cycle
[MyelonInstr]event with detailed stage counts.
The fetch loop is sequential by design. v3 may parallelize via
std::thread::scope when cycle-time becomes a bottleneck, see
module docs.