SstStreamIo.write.step: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/SstStreamIo.bend as SstStreamIo Lines 498-541 of mylsm-lsm-store@0.6.0.1/src/SstStreamIo.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/SstStreamIo.bend&start_line=498&end_line=541 import Base import mylsm-lsm-store@0.6.0.1/src/Fs.bend as Fs import mylsm-lsm-store@0.6.0.1/src/SstFile.bend as SstFile def write.step( fuel: Nat, +path: String, state: WriteState ) -> IO(Result<&1, &1, U32 & String, Unit>): match fuel: case 0n: match state: case WriteNext{file, _}: do IO>: _closed : Unit <- File.close(file) return Fail{(U32.from_nat(7n), "table exceeds packed write limit")} case WriteOutput{file, _}: do IO>: _closed : Unit <- File.close(file) return Fail{(U32.from_nat(7n), "table exceeds packed write limit")} case WriteResult{pair, _}: match pair: case (file, _): do IO>: _closed : Unit <- File.close(file) return Fail{(U32.from_nat(7n), "table exceeds packed write limit")} case 1n+rest: match state: case WriteNext{file, encoder}: write.step(rest, path, WriteOutput{file, SstFile.next_chunk(encoder)}) case WriteOutput{file, pair}: match pair: case (_, None{}): write.finish(file, path) case (next, Some{bytes}): do IO>: written : File & Result<&1, &1, U32 & String, Unit> <- Fs.write_bytes(file, bytes) write.step(rest, path, WriteResult{written, next}) case WriteResult{pair, encoder}: match pair: case (file, Fail{error}): do IO>: _closed : Unit <- File.close(file) return Fail{error} case (file, Done{Unit{}}): write.step(rest, path, WriteNext{file, encoder}) Uses (18): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=File https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=File.close https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.pure 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=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.from_nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/Fs.bend&name=write_bytes https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/SstFile.bend&name=next_chunk https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/SstStreamIo.bend&name=WriteState https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/SstStreamIo.bend&name=write.finish