def decode.header.length

mylsm-lsm-store@0.6.0.1 · src/ByteWal.bend:848

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

848# Reads frame length and count into a validated header.
849def decode.header.length(
850  pair: Bytes.Bytes & Maybe<&2, U32>,
851  total: U32
852) -> Result<&1, &1, Wal.Error, FrameHeader>:
853  match pair:
854    case (frame, None{}):
855      Fail{Wal.Malformed{}}
856    case (frame, Some{+length}):
857      decode.header.count(Bytes.get.u32be(frame, 4), length, total)

Uses (10)

Used by (1)