def open.header.index.counts
mylsm-lsm-store@0.6.0.1 · src/scan/ByteBlockReader.bend:365
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/Fs.bend as Fs
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
365def open.header.index.counts(
366 file: File,
367 +size: Nat,
368 header: Bytes.Bytes,
369 total: U32,
370 counts: Nat & Nat
371) -> IO(Result<&1, &1, U32 & String, Reader>):
372 match counts:
373 case (for_offset, for_reader):
374 do IO<Result<&1, &1, U32 & String, Reader>>:
375 footer_length : File & Result<&1, &1, U32 & String, Bytes.Bytes> <-
376 Fs.read_at(file, U32.from_nat(Nat.sub(size, 36n)), 4)
377 open.header.index.length.exact(
378 read_at.exact.pair(4, footer_length), size, header, total,
379 U32.from_nat(for_reader), U32.from_nat(for_offset))