An ORPHAN is a chunk file on disk that the persisted index
(_cache_meta.json) does not list: the index is saved on a debounce, so a
session killed (or navigated away) between a chunk write and the next index
save leaves files the index cannot name. Without this crawl they would never
be reclaimed (disk use grows across interrupted sessions) nor accounted in the
index's size and LRU. Serving them does not wait for it: until the crawl is
complete, OPFSStore.get() reads an unindexed key's file directly.
This module only WALKS the bucket directories and hands each unlisted file to
the caller, under a hard per-session budget; the decision (re-index vs
delete) and every mutation of the index belong to OPFSStore, which owns the
race rules against its own in-flight writes.
Orphan crawl for the OPFS L2 directory.
An ORPHAN is a chunk file on disk that the persisted index (
_cache_meta.json) does not list: the index is saved on a debounce, so a session killed (or navigated away) between a chunk write and the next index save leaves files the index cannot name. Without this crawl they would never be reclaimed (disk use grows across interrupted sessions) nor accounted in the index's size and LRU. Serving them does not wait for it: until the crawl is complete,OPFSStore.get()reads an unindexed key's file directly.This module only WALKS the bucket directories and hands each unlisted file to the caller, under a hard per-session budget; the decision (re-index vs delete) and every mutation of the index belong to
OPFSStore, which owns the race rules against its own in-flight writes.