def stream.blocks.footer.parse

mylsm-lsm-store@0.6.0.1 · src/SstFile.bend:1257

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

1257# Parses a footer only after the block and entry counts reach zero.
1258def stream.blocks.footer.parse(
1259  +level: U32,
1260  +total: U32,
1261  +block_count: U32,
1262  hashes: List<&1, Bytes.Bytes>,
1263  bytes: Bytes.Bytes,
1264  valid: Bool
1265) -> Result<&1, &1, Error, Unit>:
1266  match valid:
1267    case False{}:
1268      Fail{Malformed{}}
1269    case True{}:
1270      stream.blocks.footer.result(parse.footer.magic(
1271        Bytes.Cursor.u32be(Bytes.Cursor.new(bytes)), level, total,
1272        block_count, Nil{}, hashes))

Uses (11)

Used by (1)