def publish.synced
mylsm-lsm-store@0.6.0.1 · src/transfer/RestoreIo.bend:308
import mylsm-lsm-store@0.6.0.1/src/transfer/RestoreIo.bend as RestoreIo
import Base
import mylsm-lsm-store@0.6.0.1/src/CrashPoint.bend as CrashPoint
import mylsm-lsm-store@0.6.0.1/src/Fs.bend as Fs
308def publish.synced(
309 +destination: String,
310 +temporary: String,
311 result: Result<&1, &1, U32 & String, Unit>
312) -> IO(Result<&1, &1, Error, Unit>):
313 match result:
314 case Fail{(code, message)}:
315 do IO<Result<&1, &1, Error, Unit>>:
316 cleanup.directory(temporary)
317 return Fail{Io{code, "staged directory sync failed: " ++ message}}
318 case Done{Unit{}}:
319 do IO<Result<&1, &1, Error, Unit>>:
320 _checkpoint : Result<&1, &1, U32 & String, Unit> <-
321 CrashPoint.hit("restore.before_rename")
322 renamed : Result<&1, &1, U32 & String, Unit> <-
323 Fs.rename_noreplace(path.clone(temporary), path.clone(destination))
324 published : Result<&1, &1, Error, Unit> <- publish.renamed(destination, temporary, renamed)
325 return published