def retained.go

mylsm-lsm-store@0.6.0.1 · src/ByteMemTable.bend:463

import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

463# Adds a fixed per-entry estimate to encoded payload bytes for retention limits.
464def retained.go(entries: List<&1, Entry>, total: Nat) -> Nat:
465  match entries:
466    case Nil{}: total
467    case Con{Entry{Bytes.Bytes{+len, _}, val}, tail}:
468      retained.go(tail,
469        Nat.add(Nat.add(Nat.add(total, 32n), U32.to_nat(len)), payload.value(val)))

Uses (7)

Used by (1)