def get.sst.sized

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

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

1184def get.sst.sized(
1185  paths: String & String,
1186  lock: DbLock.Lock,
1187  table: ByteMemTable.Table,
1188  keys: Bytes.Bytes & Bytes.Bytes,
1189  size: Result<&1, &1, U32 & String, Nat>
1190) -> IO(Handle & Result<&1, &1, Error, Maybe<&1, Bytes.Bytes>>):
1191  match paths:
1192    case (cursor_path, retained_path):
1193      match keys:
1194        case (lower, query):
1195          match size:
1196            case Fail{(code, message)}:
1197              IO.pure(Handle & Result<&1, &1, Error, Maybe<&1, Bytes.Bytes>>,
1198                (Handle{retained_path, lock, table, Open{}, VisibleStats.Stats{0n, 0n}},
1199                  Fail{io.error((code, message))}))
1200            case Done{size}:
1201              do IO<Handle & Result<&1, &1, Error, Maybe<&1, Bytes.Bytes>>>:
1202                opened : Result<&1, &1, U32 & String, SstCursor.Cursor> <-
1203                  SstCursor.open.trusted(cursor_path,
1204                    SstCursor.Bounds{Some{lower}, None{}, None{}})
1205                get.sst.opened(retained_path, lock, table, query, size, opened)

Uses (22)

Used by (2)