def destination.checked

mylsm-lsm-store@0.6.0.1 · src/transfer/BackupOwnerCursorIo.bend:341

import mylsm-lsm-store@0.6.0.1/src/transfer/BackupOwnerCursorIo.bend as BackupOwnerCursorIo
import Base
import mylsm-lsm-store@0.6.0.1/src/Fs.bend as Fs
import mylsm-lsm-store@0.6.0.1/src/transfer/BackupCursor.bend as BackupCursor
import mylsm-lsm-store@0.6.0.1/src/transfer/BackupCursorIo.bend as BackupCursorIo
import mylsm-lsm-store@0.6.0.1/src/transfer/BackupIo.bend as BackupIo

341def destination.checked(
342  +destination: String,
343  +temporary: String,
344  source: OwnerSource,
345  initial: BackupCursor.Step,
346  fuel: Nat,
347  exists: Result<&1, &1, U32 & String, Bool>
348) -> IO(Result<&1, &1, BackupIo.Error, Unit>):
349  match exists:
350    case Fail{error}:
351      do IO<Result<&1, &1, BackupIo.Error, Unit>>:
352        _closed : Unit <- close.failed.source.no_file(source)
353        BackupCursorIo.initial.failed(initial, error.io(error))
354    case Done{True{}}:
355      do IO<Result<&1, &1, BackupIo.Error, Unit>>:
356        _closed : Unit <- close.failed.source.no_file(source)
357        BackupCursorIo.initial.failed(initial, BackupIo.AlreadyExists{})
358    case Done{False{}}:
359      do IO<Result<&1, &1, BackupIo.Error, Unit>>:
360        created : Result<&1, &1, U32 & String, Unit> <-
361          Fs.make_dir(BackupCursorIo.path.clone(temporary))
362        directory.created(destination, temporary, source, initial, fuel,
363          created)

Uses (18)

Used by (1)