def seek.block.offsets
mylsm-lsm-store@0.6.0.1 · src/scan/ByteBlockReader.bend:609
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/hub_sha/sha256.bend as SHA
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
609def seek.block.offsets(
610 file: File,
611 size: Nat,
612 header: Bytes.Bytes,
613 offsets: Nat & Nat,
614 total: U32,
615 block_count: U32,
616 root_hash: SHA.Stream,
617 index_hash: SHA.Stream,
618 indices: U32 & U32 & U32,
619 valid: Bool
620) -> IO(Result<&1, &1, U32 & String, Reader>):
621 match offsets:
622 case (state_offset, read_offset):
623 match indices:
624 case (state_index, (address_index, read_index)):
625 match valid:
626 case False{}: seek.block.invalid(file)
627 case True{}:
628 seek.block.index.read(file,
629 State{size, header, state_offset, 0n, total, block_count,
630 state_index, 0, root_hash, index_hash, None{}, True{}},
631 read_offset, (address_index, read_index))