Snapshot.snapshot.list.cursor.acquire.loop: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend as Snapshot Lines 741-781 of mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend&start_line=741&end_line=781 import Base # Updates exactly one snapshot cursor count and preserves every unrelated entry. def snapshot.list.cursor.acquire.loop( fuel: Nat, state: SnapshotListCursorState ) -> SnapshotListCursorDecision: match fuel: case 0n: snapshot.list.cursor.exhausted(state) case 1n+rest: match state: case SnapshotCursorSearch{snapshots, snapshot_id, action, prefix}: match snapshots: case Nil{}: SnapshotListRejected{snapshot.list.cursor.restore(prefix, Nil{})} case Con{resource, tail}: snapshot.list.cursor.acquire.loop(rest, SnapshotCursorCompareCopies{ snapshot.resource.duplicate(resource), tail, u32.duplicate(snapshot_id), action, prefix}) case SnapshotCursorCompareCopies{copies, tail, snapshot_ids, action, prefix}: match copies: case (for_check, for_update): match for_check: case SnapshotResource{id, _, _, _}: match snapshot_ids: case (current_id, next_id): snapshot.list.cursor.acquire.loop(rest, SnapshotCursorCompare{U32.is_eq(id, current_id), for_update, tail, next_id, action, prefix}) case SnapshotCursorCompare{matches, resource, tail, snapshot_id, action, prefix}: match matches: case True{}: snapshot.list.cursor.action(prefix, tail, resource, action) case False{}: snapshot.list.cursor.acquire.loop(rest, SnapshotCursorSearch{tail, snapshot_id, action, Con{resource, prefix}}) Uses (13): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool 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=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend&name=SnapshotListCursorDecision https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend&name=SnapshotListCursorState https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend&name=SnapshotResource https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend&name=snapshot.list.cursor.action https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend&name=snapshot.list.cursor.exhausted https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend&name=snapshot.list.cursor.restore https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend&name=snapshot.resource.duplicate https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend&name=u32.duplicate