def parse.blocks.go
mylsm-lsm-store@0.6.0.1 · src/SstFile.bend:1387
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
1387def parse.blocks.go(
1388 remaining: Nat,
1389 decision: BlockDecision,
1390 +level: U32,
1391 +total: U32,
1392 +block_count: U32
1393) -> Result<&1, &1, Error, Sstable.Table>:
1394 match remaining:
1395 case 0n:
1396 Fail{Malformed{}}
1397 case 1n++rest:
1398 match decision:
1399 case BlockRejected{error}:
1400 Fail{error}
1401 case BlockOutOfBounds{}:
1402 Fail{Malformed{}}
1403 case BlockFinish{cursor, entries, hashes}:
1404 parse.footer.magic(Bytes.Cursor.u32be(cursor), level, total,
1405 block_count, entries, hashes)
1406 case BlockContinue{cursor, entries_left, previous, entries, hashes}:
1407 parse.blocks.go(rest,
1408 parse.blocks.decision(
1409 parse.block.read(parse.block(cursor, previous)), rest,
1410 entries_left, entries, hashes),
1411 level, total, block_count)