RestoreIo.write.loop: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/transfer/RestoreIo.bend as RestoreIo Lines 84-115 of mylsm-lsm-store@0.6.0.1/src/transfer/RestoreIo.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/RestoreIo.bend&start_line=84&end_line=115 import Base import mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend as Db def write.loop(fuel: Nat, state: WriteState) -> IO(Db.Handle & Result<&1, &1, Db.Error, Unit>): match fuel: case 0n: match state: case WriteNeed{handle, _}: IO.pure(Db.Handle & Result<&1, &1, Db.Error, Unit>, (handle, Fail{Db.ResourceLimit{}})) case WriteBatch{handle, _}: IO.pure(Db.Handle & Result<&1, &1, Db.Error, Unit>, (handle, Fail{Db.ResourceLimit{}})) case WriteResult{pair, _}: IO.pure(Db.Handle & Result<&1, &1, Db.Error, Unit>, pair) case 1n+rest_fuel: match state: case WriteNeed{handle, entries}: match entries: case Nil{}: IO.pure(Db.Handle & Result<&1, &1, Db.Error, Unit>, (handle, Done{Unit{}})) case Con{_, _}: write.loop(rest_fuel, WriteBatch{handle, write.page(entries)}) case WriteBatch{handle, WritePage{batch, rest}}: do IO>: pair : Db.Handle & Result<&1, &1, Db.Error, Unit> <- Db.write_batch(handle, write.mutations(batch)) write.loop(rest_fuel, WriteResult{pair, rest}) case WriteResult{pair, rest}: match pair: case (handle, Fail{error}): IO.pure(Db.Handle & Result<&1, &1, Db.Error, Unit>, (handle, Fail{error})) case (handle, Done{Unit{}}): write.loop(rest_fuel, WriteNeed{handle, rest}) Uses (16): 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=List 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=Unit https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend&name=Error https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend&name=Handle https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend&name=write_batch https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/RestoreIo.bend&name=WritePage https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/RestoreIo.bend&name=WriteState https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/RestoreIo.bend&name=write.mutations https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/transfer/RestoreIo.bend&name=write.page