def append.size

bend-kit-journal@0.3.1.0 · journal.bend:373

import bend-kit-journal@0.3.1.0/journal.bend as Journal
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

373# The file stays under 4 GiB, so every offset and the next open's read fit a U32.
374def append.size(over: Bool, big: Bool, file: File, +max: U32, +end: U32, p: Bytes.Bytes) -> IO(Journal & Result<&1, &1, U32 & String, Unit>):
375  match over big:
376    case True{} _:
377      append.refuse(file, max, end, True{}, (22, "journal: record over max"))
378    case False{} True{}:
379      append.refuse(file, max, end, True{}, (27, "journal: file would reach 4 GiB"))
380    case False{} False{}:
381      append.write(file, max, end, frame(p))

Uses (14)

Used by (1)