SstFile.encode.chunks: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/SstFile.bend as SstFile Lines 1771-1786 of mylsm-lsm-store@0.6.0.1/src/SstFile.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/SstFile.bend&start_line=1771&end_line=1786 import Base import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes # Pure whole-file encoder for fixtures and small in-memory callers. Production # persistence uses next_chunk directly and never joins the complete file. def encode.chunks( fuel: Nat, pair: Encoder & Maybe<&1, Bytes.Bytes>, acc: List<&1, Bytes.Bytes> ) -> Result<&1, &1, Error, Bytes.Bytes>: match fuel: case 0n: Fail{TooLarge{}} case 1n+rest: match pair: case (_, None{}): Done{Bytes.concat(List.reverse(&1, Bytes.Bytes, acc))} case (encoder, Some{chunk}): encode.chunks(rest, next_chunk(encoder), Con{chunk, acc}) Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.reverse https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=concat https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/SstFile.bend&name=Encoder https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/SstFile.bend&name=Error https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/SstFile.bend&name=next_chunk