def append.opened.checked

mylsm-lsm-store@0.6.0.1 · src/ByteWalIo.bend:595

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

595# Selects full-frame or chunked writing after opening the WAL.
596def append.opened.checked(
597  file: File,
598  frame: Bytes.Bytes,
599  total: U32,
600  +path: String,
601  large: Bool
602) -> IO(Result<&1, &1, U32 & String, Unit>):
603  match large:
604    case True{}:
605      append.chunked.slices(file, frame, total, path)
606    case False{}:
607      do IO<Result<&1, &1, U32 & String, Unit>>:
608        written : File & Result<&1, &1, U32 & String, Unit> <-
609          Fs.write_bytes(file, frame)
610        append.written(written, path)

Uses (13)

Used by (1)