def read.block.header.size

mylsm-lsm-store@0.6.0.1 · src/SstStreamIo.bend:164

import mylsm-lsm-store@0.6.0.1/src/SstStreamIo.bend as SstStreamIo
import Base
import mylsm-lsm-store@0.6.0.1/src/SstFile.bend as SstFile
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

164def read.block.header.size(
165  file: File,
166  +size: Nat,
167  +used: Nat,
168  parser: SstFile.StreamState,
169  header: Bytes.Bytes,
170  tail: Maybe<&2, U32>
171) -> StreamReadState:
172  match tail:
173    case None{}:
174      ReadClose{file, Fail{(corruption_error_code(), "invalid SST block size")}}
175    case Some{+tail_len}:
176      read.block.header.bound(file, size, used, parser, header, tail_len,
177        Nat.is_le(Nat.add(Nat.add(used, 8n), U32.to_nat(tail_len)),
178        Nat.sub(size, 40n)))

Uses (15)

Used by (1)