def read.fields
mylsm-lsm-store@0.6.0.1 · src/coordinator/OptionsCodec.bend:63
import mylsm-lsm-store@0.6.0.1/src/coordinator/OptionsCodec.bend as OptionsCodec
import Base
import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
63def read.fields(
64 remaining: Nat,
65 input: Bytes.Bytes & Bytes.Bytes,
66 +offset: U32,
67 fields: List<&2, U32>
68) -> List<&2, U32>:
69 match remaining:
70 case 0n:
71 match input:
72 case (_, _): fields
73 case 1n+rest:
74 match input:
75 case (to_read, retained):
76 read.fields(rest, ByteMemTable.bytes.clone(retained),
77 U32.add(offset, 4), Con{read.word(to_read, offset), fields})