def measure_key_header_valid
mylsm-lsm-store@0.6.0.1 · src/scan/ByteBlockReader.bend:1000
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
1000
1001def measure_key_header_valid(
1002 +_index_offset: Nat,
1003 +used: Nat,
1004 key: Bytes.Bytes,
1005 +payload_length: U32,
1006 file: File,
1007 valid: Bool
1008) -> IO(Result<&1, &1, U32 & String, ByteWal.ValueMetadata>):
1009 match valid:
1010 case True{}: measure_key_body_read(used, key, payload_length, file)
1011 case False{}:
1012 do IO<Result<&1, &1, U32 & String, ByteWal.ValueMetadata>>:
1013 _closed : Unit <- File.close(file)
1014 return Fail{corruption("byte SST block exceeds file bounds")}