def verify.loop
mylsm-lsm-store@0.6.0.1 · src/scan/SstCursor.bend:308
import mylsm-lsm-store@0.6.0.1/src/scan/SstCursor.bend as SstCursor
import Base
import mylsm-lsm-store@0.6.0.1/src/scan/ByteBlockReader.bend as ByteBlockReader
308def verify.loop(
309 fuel: Nat,
310 path: String,
311 state: VerifyState
312) -> IO(Result<&1, &1, U32 & String, Cursor>):
313 match fuel:
314 case 0n: verify.exhausted(state)
315 case 1n+rest:
316 match state:
317 case VerifyNeed{reader, bounds}:
318 do IO<Result<&1, &1, U32 & String, Cursor>>:
319 result : Result<&1, &1, U32 & String, ByteBlockReader.Step> <-
320 ByteBlockReader.next(reader)
321 verify.loop(rest, path, VerifyRead{result, bounds})
322 case VerifyRead{result, bounds}:
323 match result:
324 case Fail{error}:
325 IO.pure(Result<&1, &1, U32 & String, Cursor>, Fail{error})
326 case Done{ByteBlockReader.End{}}:
327 do IO<Result<&1, &1, U32 & String, Cursor>>:
328 reopened : Result<&1, &1, U32 & String, ByteBlockReader.Reader> <-
329 ByteBlockReader.open(path)
330 verify.complete(bounds, reopened)
331 case Done{ByteBlockReader.Block{reader, _}}:
332 verify.loop(rest, path, VerifyNeed{reader, bounds})