def publish.directory.synced

mylsm-lsm-store@0.6.0.1 · src/transfer/BackupIo.bend:116

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

116def publish.directory.synced(
117  +destination: String,
118  +temporary: String,
119  result: Result<&1, &1, U32 & String, Unit>
120) -> IO(Result<&1, &1, Error, Unit>):
121  match result:
122    case Fail{(code, message)}:
123      do IO<Result<&1, &1, Error, Unit>>:
124        cleanup(temporary)
125        return Fail{Io{code, message}}
126    case Done{Unit{}}:
127      do IO<Result<&1, &1, Error, Unit>>:
128        _stopped : Result<&1, &1, U32 & String, Unit> <- CrashPoint.hit("backup.before_rename")
129        renamed : Result<&1, &1, U32 & String, Unit> <-
130          Fs.rename_noreplace(path.clone(temporary), path.clone(destination))
131        publish.rename(destination, temporary, renamed)

Uses (15)

Used by (1)