def parse.footer.verify

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

import mylsm-lsm-store@0.6.0.1/src/SstFile.bend as SstFile
import Base
import mylsm-lsm-store@0.6.0.1/src/MemTable.bend as MemTable
import mylsm-lsm-store@0.6.0.1/src/Sstable.bend as Sstable
import mylsm-lsm-store@0.6.0.1/src/hub_sha/sha256.bend as SHA
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

1049def parse.footer.verify(
1050  cursor: Bytes.Cursor,
1051  claimed: Bytes.Bytes,
1052  +level: U32,
1053  +total: U32,
1054  +block_count: U32,
1055  entries: List<&2, MemTable.Entry>,
1056  hashes: List<&1, Bytes.Bytes>
1057) -> Result<&1, &1, Error, Sstable.Table>:
1058  match cursor:
1059    case Bytes.Cursor{bytes, +pos, _, +end}:
1060      expected = SHA.sha256_packed_bytes(Bytes.concat(
1061        header_bytes(level, total, block_count) <> List.reverse(&1, Bytes.Bytes, hashes)))
1062      parse.footer.check(level, entries, U32.is_eq(pos, end),
1063        Bytes.eq(claimed, expected))

Uses (15)

Used by (1)