def Bytes.scan_next.owned

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

import mylsm-lsm-store@0.6.0.1/mylsm.bend as Mylsm
import Base
import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable
import mylsm-lsm-store@0.6.0.1/src/scan/RangeCursor.bend as ByteRangeCursor

1676def Bytes.scan_next.owned(
1677  snapshot: Bytes.Snapshot,
1678  bounds: ByteRangeCursor.Bounds,
1679  step: Bytes.StreamStep
1680) -> IO(Bytes.StreamStep):
1681  match step:
1682    case StreamItem{key, value, inner}:
1683      IO.pure(Bytes.StreamStep, Bytes.scan_next.owned.checked(snapshot, inner,
1684        ByteRangeCursor.key.copies.first(ByteMemTable.bytes.clone(key)), value,
1685        ByteRangeCursor.bounds.clone(bounds)))
1686    case StreamSkip{inner}:
1687      IO.pure(Bytes.StreamStep, StreamSkip{ByteOwnedCursor{snapshot, inner, bounds}})
1688    case StreamFailure{error, inner}:
1689      IO.pure(Bytes.StreamStep, StreamFailure{error, ByteOwnedCursor{snapshot, inner, bounds}})
1690    case StreamEnd{inner}:
1691      do IO<Bytes.StreamStep>:
1692        closed : Result<&1, &1, Bytes.Error, Unit> <-
1693          Bytes.scan_close(ByteOwnedCursor{snapshot, inner, bounds})
1694        return Bytes.scan_next.owned.ended(closed)

Uses (16)

Used by (1)