def append.ok
bend-kit-journal@0.3.1.0 · journal.bend:383
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
383def append.ok(ok: Bool, file: File, +max: U32, +end: U32, p: Bytes.Bytes) -> IO(Journal & Result<&1, &1, U32 & String, Unit>):
384 match ok:
385 case False{}:
386 append.refuse(file, max, end, False{}, (5, "journal: an append failed; reopen the journal"))
387 case True{}:
388 Bytes.Bytes{+len, buf} = p
389 append.size(U32.is_gt(len, max), Bool.or(U32.is_gt(end, 4294967283), U32.is_lt((4294967283 - end : U32), len)), file, max, end, Bytes.Bytes{len, buf})