def get.sst.exhausted

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

import mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend as ByteDurableDb
import Base
import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable
import mylsm-lsm-store@0.6.0.1/src/DbLock.bend as DbLock
import mylsm-lsm-store@0.6.0.1/src/scan/SstCursor.bend as SstCursor
import mylsm-lsm-store@0.6.0.1/src/scan/VisibleStats.bend as VisibleStats
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

1100def get.sst.exhausted(
1101  +path: String,
1102  lock: DbLock.Lock,
1103  table: ByteMemTable.Table,
1104  state: PointRead
1105) -> IO(Handle & Result<&1, &1, Error, Maybe<&1, Bytes.Bytes>>):
1106  match state:
1107    case Need{cursor, _}:
1108      get.sst.exhausted.cursor(path, lock, table, cursor)
1109    case Compare{_, cursor, _, _}:
1110      get.sst.exhausted.cursor(path, lock, table, cursor)
1111    case Read{step, _}:
1112      match step:
1113        case SstCursor.Item{_, cursor}:
1114          get.sst.exhausted.cursor(path, lock, table, cursor)
1115        case SstCursor.Skip{cursor}:
1116          get.sst.exhausted.cursor(path, lock, table, cursor)
1117        case SstCursor.End{}:
1118          IO.pure(Handle & Result<&1, &1, Error, Maybe<&1, Bytes.Bytes>>,
1119            (Handle{path, lock, table, Open{}, VisibleStats.Stats{0n, 0n}}, Done{None{}}))
1120        case SstCursor.Error{(code, message)}:
1121          IO.pure(Handle & Result<&1, &1, Error, Maybe<&1, Bytes.Bytes>>,
1122            (Handle{path, lock, table, Open{}, VisibleStats.Stats{0n, 0n}}, Fail{recovery.error(code, message)}))

Uses (18)

Used by (1)