def parse.blocks.start
mylsm-lsm-store@0.6.0.1 · src/SstFile.bend:1413
import mylsm-lsm-store@0.6.0.1/src/SstFile.bend as SstFile
import Base
import mylsm-lsm-store@0.6.0.1/src/Sstable.bend as Sstable
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
1413def parse.blocks.start(
1414 cursor: Bytes.Cursor,
1415 valid: Bool,
1416 +count: U32,
1417 +total: U32,
1418 +level: U32
1419) -> Result<&1, &1, Error, Sstable.Table>:
1420 match valid:
1421 case False{}:
1422 Fail{Malformed{}}
1423 case True{}:
1424 match count:
1425 case 0:
1426 parse.footer.magic(Bytes.Cursor.u32be(cursor), level, total,
1427 count, Nil{}, Nil{})
1428 case _:
1429 parse.blocks.go(U32.to_nat(count),
1430 parse.blocks.decision(
1431 parse.block.read(parse.block(cursor, None{})), U32.to_nat(count),
1432 total, Nil{}, Nil{}),
1433 level, total, count)