def write.published

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

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

241# Atomically renames the synced temporary SST and syncs its directory.
242def write.published(
243  +directory: String,
244  temporary: String,
245  final_path: String,
246  result: Result<&1, &1, U32 & String, Unit>
247) -> IO(Result<&1, &1, U32 & String, Unit>):
248  match result:
249    case Fail{error}:
250      IO.pure(Result<&1, &1, U32 & String, Unit>, Fail{error})
251    case Done{Unit{}}:
252      do IO<Result<&1, &1, U32 & String, Unit>>:
253        renamed : Result<&1, &1, U32 & String, Unit> <-
254          Fs.rename(temporary, final_path)
255        write.directory.synced(directory, renamed)

Uses (10)

Used by (1)