def seek.block.construct

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

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

481def seek.block.construct(
482  file: File,
483  size: Nat,
484  header: Bytes.Bytes,
485  index_offset: Nat,
486  total: U32,
487  block_count: U32,
488  root_hash: SHA.Stream,
489  index_hash: SHA.Stream,
490  index: U32,
491  offset: U32,
492  valid: Bool
493) -> IO(Result<&1, &1, U32 & String, Reader>):
494  match valid:
495    case False{}: seek.block.invalid(file)
496    case True{}:
497      IO.pure(Result<&1, &1, U32 & String, Reader>,
498        Done{Reader{file, State{size, header, index_offset,
499          Nat.sub(U32.to_nat(offset), 20n), total, block_count, index, 0,
500          root_hash, index_hash, None{}, True{}}}})

Uses (17)

Used by (1)