def snapshot.root.cursor.open.copied

mylsm-lsm-store@0.6.0.1 · src/ByteDurableDb.bend:2794

import mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend as ByteDurableDb
import Base
import mylsm-lsm-store@0.6.0.1/src/scan/SstCursor.bend as SstCursor
import mylsm-lsm-store@0.6.0.1/src/scan/RangeCursor.bend as RangeCursor
import mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend as VisibleCursor

2794def snapshot.root.cursor.open.copied(
2795  bounds: RangeCursor.Bounds & RangeCursor.Bounds,
2796  root: SnapshotRoot
2797) -> IO(Result<&1, &1, Error, SnapshotCursorRoot>):
2798  match bounds:
2799    case (visible_bounds, sst_bounds):
2800      match root:
2801        case SnapshotRoot{sst_path, _, retained_bytes, delta}:
2802          match sst_path:
2803            case None{}:
2804              IO.pure(Result<&1, &1, Error, SnapshotCursorRoot>,
2805                Done{SnapshotCursorRoot{retained_bytes,
2806                  VisibleCursor.open(None{}, delta, visible_bounds)}})
2807            case Some{path}:
2808              do IO<Result<&1, &1, Error, SnapshotCursorRoot>>:
2809                opened : Result<&1, &1, U32 & String, SstCursor.Cursor> <-
2810                  SstCursor.open.trusted(path,
2811                    snapshot.root.sst.bounds(sst_bounds))
2812                snapshot.root.cursor.opened(retained_bytes, delta,
2813                  visible_bounds, opened)

Uses (18)

Used by (1)