def measure_key_header_length
mylsm-lsm-store@0.6.0.1 · src/scan/ByteBlockReader.bend:1016
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/ByteWal.bend as ByteWal
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
1016
1017def measure_key_header_length(
1018 +index_offset: Nat,
1019 +used: Nat,
1020 key: Bytes.Bytes,
1021 pair: Bytes.Bytes & Maybe<&2, U32>,
1022 file: File
1023) -> IO(Result<&1, &1, U32 & String, ByteWal.ValueMetadata>):
1024 match pair:
1025 case (_, None{}):
1026 do IO<Result<&1, &1, U32 & String, ByteWal.ValueMetadata>>:
1027 _closed : Unit <- File.close(file)
1028 return Fail{corruption("invalid byte SST block length")}
1029 case (_, Some{+payload_length}):
1030 measure_key_header_valid(index_offset, used, key, payload_length,
1031 file, measure_key_bounds(index_offset, used, payload_length))