def read_go
import mylsm-lsm-store@0.6.0.1/src/Fs.bend as Fsimport Base
455# Fuel-bounded sweep 0..count-1. Startup-only use (spec §10 below): the
456# directory is stable during recovery, so count-then-fetch is exact.
457def read_go(fuel: Nat, +path: String, +idx: Nat, acc: List<String>) -> IO(List<String>):
458 match fuel:
459 case 0n:
460 IO.pure(List<String>, List.reverse(&1, String, acc))
461 case 1n+f:
462 do IO<List<String>>:
463 nm : String <- IO.try(String, read_dir_at(path, idx))
464 read_go(f, path, Nat.add(idx, 1n), grab_name(nm, acc))