def destination.checked

mylsm-lsm-store@0.6.0.1 · src/transfer/RestoreIo.bend:414

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/Fs.bend as Fs
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

414def destination.checked(
415  +destination: String,
416  +temporary: String,
417  input: Bytes.Bytes,
418  result: Result<&1, &1, U32 & String, Bool>
419) -> IO(Result<&1, &1, Error, Unit>):
420  match result:
421    case Fail{(code, message)}:
422      IO.pure(Result<&1, &1, Error, Unit>, Fail{Io{code, message}})
423    case Done{True{}}:
424      IO.pure(Result<&1, &1, Error, Unit>, Fail{DestinationExists{}})
425    case Done{False{}}:
426      do IO<Result<&1, &1, Error, Unit>>:
427        exists : Result<&1, &1, U32 & String, Bool> <- Fs.exists(path.clone(temporary))
428        temporary.checked(destination, temporary, input, exists)

Uses (15)

Used by (1)