def Bytes.backup_to.opened

mylsm-lsm-store@0.6.0.1 · mylsm.bend:1114

import mylsm-lsm-store@0.6.0.1/mylsm.bend as Mylsm
import Base
import mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend as RawByteDb
import mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend as VisibleByteCursor
import mylsm-lsm-store@0.6.0.1/src/transfer/BackupIo.bend as BackupIo
import mylsm-lsm-store@0.6.0.1/src/transfer/BackupCursorIo.bend as BackupCursorIo

1114def Bytes.backup_to.opened(
1115  path: String,
1116  entries: Nat,
1117  fuel: Nat,
1118  pair: RawByteDb.Handle & Result<&1, &1, RawByteDb.Error, VisibleByteCursor.Cursor>
1119) -> IO(Bytes.Handle & Result<&1, &1, Bytes.Error, Unit>):
1120  match pair:
1121    case (raw, Fail{error}):
1122      IO.pure(Bytes.Handle & Result<&1, &1, Bytes.Error, Unit>,
1123        (ByteHandle{raw}, Fail{Bytes.error(error)}))
1124    case (raw, Done{cursor}):
1125      do IO<Bytes.Handle & Result<&1, &1, Bytes.Error, Unit>>:
1126        result : Result<&1, &1, BackupIo.Error, Unit> <-
1127          BackupCursorIo.export(path, cursor, entries, fuel)
1128        return Bytes.backup_to.result(ByteHandle{raw}, result)

Uses (18)

Used by (1)