def recover.opened
mylsm-lsm-store@0.6.0.1 · src/ByteWalIo.bend:384
import mylsm-lsm-store@0.6.0.1/src/ByteWalIo.bend as ByteWalIo
import Base
import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable
import mylsm-lsm-store@0.6.0.1/src/SstStreamIo.bend as SstStreamIo
384def recover.opened(
385 +path: String,
386 +size: Nat,
387 opened: Result<&1, &1, U32 & String, File>,
388 initial: ByteMemTable.Table
389) -> IO(Result<&1, &1, U32 & String, ByteMemTable.Table>):
390 match opened:
391 case Fail{failure}:
392 IO.pure(Result<&1, &1, U32 & String, ByteMemTable.Table>, Fail{failure})
393 case Done{file}:
394 do IO<Result<&1, &1, U32 & String, ByteMemTable.Table>>:
395 pair : File & Result<&1, &1, U32 & String, SstStreamIo.ExactResult> <-
396 SstStreamIo.exact.start(file, 8n)
397 header.pair(path, size, SstStreamIo.read.exact.state(pair), initial)