def parse.header.blocks
mylsm-lsm-store@0.6.0.1 · src/SstFile.bend:1573
import mylsm-lsm-store@0.6.0.1/src/SstFile.bend as SstFile
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
1573def parse.header.blocks(
1574 pair: Bytes.Cursor & Maybe<&2, U32>,
1575 +level: U32,
1576 +total: U32
1577) -> Bytes.Cursor & Result<&1, &1, Error, SstHeader>:
1578 match pair:
1579 case (cursor, Some{+count}):
1580 parse.header.blocks.valid(cursor, level, total, count,
1581 (U32.is_eq(total, 0) && U32.is_eq(count, 0)) ||
1582 (U32.is_lt(0, total) && U32.is_lt(0, count)))
1583 case (cursor, None{}):
1584 (cursor, Fail{Malformed{}})