def directory.created

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

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/transfer/Backup.bend as Backup

219def directory.created(
220  +destination: String,
221  +temporary: String,
222  result: Result<&1, &1, U32 & String, Unit>,
223  stream: Backup.Stream,
224  fuel: Nat
225) -> IO(Result<&1, &1, Error, Unit>):
226  match result:
227    case Fail{(code, _)}:
228      match code:
229        case 17: IO.pure(Result<&1, &1, Error, Unit>, Fail{AlreadyExists{}})
230        case _: IO.pure(Result<&1, &1, Error, Unit>, Fail{Io{code, "backup staging directory creation failed"}})
231    case Done{Unit{}}:
232      do IO<Result<&1, &1, Error, Unit>>:
233        opened : Result<&1, &1, U32 & String, File> <- File.open(path.clone(temporary ++ "/BACKUP"), "w")
234        directory.file.opened(destination, temporary, stream, fuel, opened)

Uses (20)

Used by (1)