def partition_go

mylsm-lsm-store@0.6.0.1 · src/SortedRun.bend:370

import mylsm-lsm-store@0.6.0.1/src/SortedRun.bend as SortedRun
import Base
import mylsm-lsm-store@0.6.0.1/src/MemTable.bend as MemTable

370# Partition go for the sorted-run operations.
371def partition_go(
372  fuel: Nat,
373  +target: Nat,
374  state: PartitionState
375) -> List<&2, List<&2, MemTable.Entry>>:
376  match fuel state:
377    case 0n PartitionState{room, entries, current_rev, chunks_rev}:
378      partition_finish(current_rev, chunks_rev)
379    case 1n+f PartitionState{0n, entries, current_rev, chunks_rev}:
380      partition_finish(current_rev, chunks_rev)
381    case 1n+f PartitionState{1n+r, Nil{}, current_rev, chunks_rev}:
382      partition_finish(current_rev, chunks_rev)
383    case 1n+f PartitionState{1n++r, Con{entry, rest}, current_rev, chunks_rev}:
384      partition_go(f, target, partition_step(Nat.is_eq(r, 0n), target, r, entry, rest, current_rev, chunks_rev))

Uses (7)

Used by (1)