def reserve.bytes

mylsm-lsm-store@0.6.0.1 · src/scan/Snapshot.bend:278

import mylsm-lsm-store@0.6.0.1/src/scan/Snapshot.bend as Snapshot
import Base

278# Computes the updated retained-byte total and both admission checks.
279def reserve.bytes(
280  retained: Nat & Nat,
281  requested: Nat & Nat,
282  snapshot_count: Nat & Nat,
283  max_snapshots: Nat,
284  max_retained_bytes: Nat
285) -> Nat & (Nat & (Bool & Bool)):
286  match retained:
287    case (retained_value, retained_check):
288      match requested:
289        case (requested_value, requested_check):
290          match snapshot_count:
291            case (count_output, count_check):
292              (count_output,
293                (Nat.add(retained_value, requested_value),
294                  (Nat.is_lt(count_check, max_snapshots),
295                  Nat.is_le(Nat.add(retained_check, requested_check), max_retained_bytes))))

Uses (7)

Used by (1)