def append.encoded
mylsm-lsm-store@0.6.0.1 · src/ByteWalIo.bend:637
import mylsm-lsm-store@0.6.0.1/src/ByteWalIo.bend as ByteWalIo
import Base
import mylsm-lsm-store@0.6.0.1/src/Wal.bend as Wal
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
637def append.encoded(
638 result: Result<&1, &1, Wal.Error, Bytes.Bytes>,
639 +path: String
640) -> IO(Result<&1, &1, U32 & String, Unit>):
641 match result:
642 case Fail{_}:
643 IO.pure(Result<&1, &1, U32 & String, Unit>,
644 Fail{(3, "byte WAL batch cannot be encoded")})
645 case Done{frame}:
646 do IO<Result<&1, &1, U32 & String, Unit>>:
647 opened : Result<&1, &1, U32 & String, File> <- File.open(path, "a")
648 append.opened(opened, frame, path)