def compact.if

bend-kit-runner@0.13.0.1 · runner.bend:1509

import bend-kit-runner@0.13.0.1/runner.bend as Runner
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import bend-kit-journal@0.3.0.1/journal.bend as J

1509def compact.if(~A: Data, ~penc: A -> Bytes.Bytes, ok: Bool, j: J.Journal, +max: U32, +path: String, +limit: U32, +base: U32, s: State<A>) -> IO(Log & Out(Unit)):
1510  match ok:
1511    case False{}:
1512      IO.pure(Log & Out(Unit), (Log{j, path, limit, base}, Fail{(5, "runner: an append failed; reopen the runner")}))
1513    case True{}:
1514      do IO<Log & Out(Unit)>:
1515        x : Swap <- swap(path, limit, encode.snap(~A, ~penc, s))
1516        compact.moved(x, j, max, path, limit, base)

Uses (19)

Used by (1)