def seek.block.checked.bounds

mylsm-lsm-store@0.6.0.1 · src/scan/ByteBlockReader.bend:648

import mylsm-lsm-store@0.6.0.1/src/scan/ByteBlockReader.bend as ByteBlockReader
import Base
import mylsm-lsm-store@0.6.0.1/src/scan/BlockIndexPolicy.bend as BlockIndexPolicy
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

648def seek.block.checked.bounds(
649  file: File,
650  size: Nat,
651  header: Bytes.Bytes,
652  index_offset: Nat,
653  total: U32,
654  block_counts: U32 & U32,
655  root_hash: SHA.Stream,
656  index_hash: SHA.Stream,
657  indices: U32 & (U32 & (U32 & U32))
658) -> IO(Result<&1, &1, U32 & String, Reader>):
659  match block_counts:
660    case (result_count, check_count):
661      match indices:
662        case (compare_index, (state_index, (address_index, read_index))):
663          seek.block.validated(file, size, header, index_offset, total,
664            result_count, root_hash, index_hash,
665            (state_index, (address_index, read_index)),
666            BlockIndexPolicy.contains(U32.to_nat(check_count),
667              U32.to_nat(compare_index)))

Uses (14)

Used by (1)