def decide.target
import mylsm-lsm-store@0.6.0.1/src/scan/ByteBlockBuilder.bend as ByteBlockBuilderimport Base
81# Fills blocks up to a target size while admitting any record within the hard cap.
82def decide.target(
83 +used_bytes: Nat,
84 +record_bytes: Nat,
85 target_bytes: Nat,
86 max_bytes: Nat
87) -> Decision:
88 decide.target.sized(used_bytes, record_bytes, Nat.is_le(record_bytes, max_bytes),
89 Nat.is_eq(used_bytes, 0n) || Nat.is_le(Nat.add(used_bytes, record_bytes), target_bytes))