def append.first.written

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

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 mylsm-lsm-store@0.6.0.1/src/CrashPoint.bend as CrashPoint
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

538# Stops between WAL chunks or writes the remaining frame before sync.
539def append.first.written(
540  pair: File & Result<&1, &1, U32 & String, Unit>,
541  remaining: Bytes.Bytes,
542  +path: String
543) -> IO(Result<&1, &1, U32 & String, Unit>):
544  match pair:
545    case (file, Fail{failure}):
546      do IO<Result<&1, &1, U32 & String, Unit>>:
547        _closed : Unit <- File.close(file)
548        return Fail{failure}
549    case (file, Done{Unit{}}):
550      do IO<Result<&1, &1, U32 & String, Unit>>:
551        _checkpoint : Result<&1, &1, U32 & String, Unit> <-
552          CrashPoint.hit("wal.during_append")
553        written : File & Result<&1, &1, U32 & String, Unit> <-
554          Fs.write_bytes(file, remaining)
555        append.written(written, path)

Uses (15)

Used by (1)