def Bytes.backup_to.rooted

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

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/RangeCursor.bend as ByteRangeCursor
import mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend as VisibleByteCursor

1130def Bytes.backup_to.rooted(
1131  path: String,
1132  entries: Nat,
1133  fuel: Nat,
1134  pair:
1135    RawByteDb.Handle &
1136    Result<&1, &1, RawByteDb.Error, RawByteDb.SnapshotRoot>
1137) -> IO(Bytes.Handle & Result<&1, &1, Bytes.Error, Unit>):
1138  match pair:
1139    case (raw, Fail{error}):
1140      IO.pure(Bytes.Handle & Result<&1, &1, Bytes.Error, Unit>,
1141        (ByteHandle{raw}, Fail{Bytes.error(error)}))
1142    case (raw, Done{root}):
1143      do IO<Bytes.Handle & Result<&1, &1, Bytes.Error, Unit>>:
1144        opened : Result<&1, &1, RawByteDb.Error, VisibleByteCursor.Cursor> <-
1145          RawByteDb.snapshot.root.cursor.open(root,
1146            ByteRangeCursor.Bounds{None{}, None{}, None{}})
1147        exported : Bytes.Handle & Result<&1, &1, Bytes.Error, Unit> <-
1148          Bytes.backup_to.opened(path, entries, fuel, (raw, opened))
1149        return exported

Uses (20)

Used by (1)