Restore.restore.loop: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend as Restore Lines 836-883 of mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend&start_line=836&end_line=883 import Base import mylsm-lsm-store@0.6.0.1/src/transfer/RestorePolicy.bend as RestorePolicy import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes def restore.loop( fuel: Nat, state: State, current: Result<&1, &1, Error, BlockMeta> ) -> Result<&1, &1, Error, Decoded>: match fuel: case 0n: Fail{InvalidFormat{}} case 1n+fuel_rest: match state: case State{input, +offset, entry_count, block_count, +remaining_blocks, +block_index, +decoded_count, reversed}: match input: case (for_size, retained): match remaining_blocks: case 0n: Fail{InvalidFormat{}} case 1n+rest: match rest: case 0n: match current: case Fail{error}: Fail{error} case Done{block}: match block: case BlockMeta{_, _, _, _, +record_count, +block_length, entries}: +next_offset = Nat.add(offset, block_length) +next_count = Nat.add(decoded_count, record_count) next_reversed = restore.prepend.entries(entries, reversed) restore.finish(Bytes.length(for_size), next_offset, entry_count, block_count, next_count, next_reversed) case 1n+more: match current: case Fail{error}: Fail{error} case Done{block}: match block: case BlockMeta{_, _, _, _, +record_count, +block_length, entries}: +next_offset = Nat.add(offset, block_length) +next_index = Nat.add(block_index, 1n) +next_count = Nat.add(decoded_count, record_count) next_reversed = restore.prepend.entries(entries, reversed) restore.loop(fuel_rest, State{clone.split(retained), next_offset, entry_count, block_count, RestorePolicy.remaining( RestorePolicy.after_block(remaining_blocks)), next_index, next_count, next_reversed}, restore.block.open(for_size, next_offset, U32.from_nat(next_index))) Uses (16): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add 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=U32.from_nat https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=length https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend&name=BlockMeta https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend&name=Decoded https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend&name=Error https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend&name=State https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend&name=clone.split https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend&name=restore.block.open https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend&name=restore.finish https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/Restore.bend&name=restore.prepend.entries https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/RestorePolicy.bend&name=after_block https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/RestorePolicy.bend&name=remaining