def next_chunk
mylsm-lsm-store@0.6.0.1 · src/SstFile.bend:529
import mylsm-lsm-store@0.6.0.1/src/SstFile.bend as SstFile
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
529
530def next_chunk(encoder: Encoder) -> Encoder & Maybe<&1, Bytes.Bytes>:
531 match encoder:
532 case Enc{Header{}, chunks, +level, +total, +block_count, footer}:
533 (Enc{Blocks{}, chunks, level, total, block_count, footer}, Some{header_bytes(level, total, block_count)})
534 case Enc{Blocks{}, Nil{}, level, total, block_count, footer}:
535 (Enc{Finished{}, Nil{}, level, total, block_count, Bytes.new(0)}, Some{footer})
536 case Enc{Blocks{}, Con{bytes, rest}, level, total, block_count, footer}:
537 (Enc{Blocks{}, rest, level, total, block_count, footer}, Some{bytes})
538 case Enc{Finished{}, chunks, level, total, block_count, footer}:
539 (Enc{Finished{}, chunks, level, total, block_count, footer}, None{})