ByteClient.snapshot.cursor.count.loop: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/coordinator/ByteClient.bend as ByteClient Lines 532-570 of mylsm-lsm-store@0.6.0.1/src/coordinator/ByteClient.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/ByteClient.bend&start_line=532&end_line=570 import Base import mylsm-lsm-store@0.6.0.1/src/coordinator/Client.bend as Client import mylsm-lsm-store@0.6.0.1/src/coordinator/Protocol.bend as Protocol import mylsm-lsm-store@0.6.0.1/src/coordinator/CursorCodec.bend as CursorCodec import mylsm-lsm-store@0.6.0.1/src/coordinator/CursorCountPolicy.bend as CursorCountPolicy def snapshot.cursor.count.loop( fuel: Nat, state: SnapshotCountState ) -> IO(Client.Session & Result<&1, &1, Client.Error, U32>): match fuel: case 0n: snapshot.cursor.count.close.state(state, Client.OwnerRejected{Protocol.ResponseResourceLimit{}}) case 1n+rest: match state: case SnapshotCountFrame{pair, cursor_id, count}: match pair: case (session, Fail{error}): snapshot.cursor.count.close.resource(session, cursor_id, error) case (session, Done{CursorCodec.CursorEnd{}}): IO.pure(Client.Session & Result<&1, &1, Client.Error, U32>, (session, Done{count})) case (session, Done{CursorCodec.CursorItem{_, _}}): snapshot.cursor.count.loop(rest, SnapshotCountItem{session, cursor_id, CursorCountPolicy.next(count)}) case SnapshotCountItem{session, cursor_id, decision}: match decision: case CursorCountPolicy.CountLimit{}: snapshot.cursor.count.close.resource(session, cursor_id, Client.OwnerRejected{Protocol.ResponseResourceLimit{}}) case CursorCountPolicy.CountContinue{next_count}: snapshot.cursor.count.loop(rest, SnapshotCountNeed{session, CursorCountPolicy.u32.pair(cursor_id), next_count}) case SnapshotCountNeed{session, cursor_ids, count}: match cursor_ids: case (wire_id, retained_id): do IO>: next : Client.Session & Result<&1, &1, Client.Error, CursorCodec.Frame> <- snapshot.cursor.next(session, wire_id) snapshot.cursor.count.loop(rest, SnapshotCountFrame{next, retained_id, count}) Uses (19): 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=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=U32 https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/ByteClient.bend&name=SnapshotCountState https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/ByteClient.bend&name=snapshot.cursor.count.close.resource https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/ByteClient.bend&name=snapshot.cursor.count.close.state https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/ByteClient.bend&name=snapshot.cursor.next https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/Client.bend&name=Error https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/Client.bend&name=Session https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/CursorCodec.bend&name=Frame https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/CursorCountPolicy.bend&name=Decision https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/CursorCountPolicy.bend&name=next https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/CursorCountPolicy.bend&name=u32.pair https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/coordinator/Protocol.bend&name=ResponseStatus