def write.encoded

mylsm-lsm-store@0.6.0.1 · src/ByteSstIo.bend:287

import mylsm-lsm-store@0.6.0.1/src/ByteSstIo.bend as ByteSstIo
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

287# Writes the encoded SST bytes to the temporary file.
288def write.encoded(
289  +directory: String,
290  temporary: String,
291  final_path: String,
292  bytes: Bytes.Bytes,
293  opened: Result<&1, &1, U32 & String, File>
294) -> IO(Result<&1, &1, U32 & String, Unit>):
295  match opened:
296    case Fail{error}:
297      IO.pure(Result<&1, &1, U32 & String, Unit>, Fail{error})
298    case Done{file}:
299      do IO<Result<&1, &1, U32 & String, Unit>>:
300        pair : File & Result<&1, &1, U32 & String, Unit> <- Fs.write_bytes(file, bytes)
301        write.written(directory, temporary, final_path, pair)

Uses (12)

Used by (1)