def Bytes.scan_seek

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

import mylsm-lsm-store@0.6.0.1/mylsm.bend as Mylsm
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as PackedBytes
import mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend as VisibleByteCursor
import mylsm-lsm-store@0.6.0.1/src/coordinator/CursorCodec.bend as OwnerCursorCodec

1751def Bytes.scan_seek(
1752  cursor: Bytes.Cursor,
1753  lower: Maybe<&1, PackedBytes.Bytes>
1754) -> IO(Bytes.Cursor & Result<&1, &1, Bytes.Error, Unit>):
1755  match cursor:
1756    case ByteOwnedCursor{snapshot, inner, bounds}:
1757      do IO<Bytes.Cursor & Result<&1, &1, Bytes.Error, Unit>>:
1758        pair : Bytes.Cursor & Result<&1, &1, Bytes.Error, Unit> <-
1759          Bytes.scan_seek(inner, lower)
1760        return Bytes.scan_seek.owned(snapshot, bounds, pair)
1761    case ByteStreamCursor{inner}:
1762      IO.pure(Bytes.Cursor & Result<&1, &1, Bytes.Error, Unit>,
1763        (ByteStreamCursor{VisibleByteCursor.seek(inner, lower)}, Done{Unit{}}))
1764    case ByteOwnerCursor{session, snapshot_id, cursor_id}:
1765      Bytes.scan_seek.ids(session, snapshot_id,
1766        OwnerCursorCodec.u32.duplicate(cursor_id), lower)
1767    case ByteCursor{_, _}:
1768      IO.pure(Bytes.Cursor & Result<&1, &1, Bytes.Error, Unit>,
1769        (Bytes.snapshot.scan_seek(cursor, lower), Done{Unit{}}))
1770    case ByteClosedCursor{}:
1771      IO.pure(Bytes.Cursor & Result<&1, &1, Bytes.Error, Unit>,
1772        (ByteClosedCursor{}, Done{Unit{}}))
1773    case ByteFailureCursor{error}:
1774      IO.pure(Bytes.Cursor & Result<&1, &1, Bytes.Error, Unit>,
1775        (ByteClosedCursor{}, Fail{error}))

Uses (16)

Used by (1)